diff options
author | Glenn Adams <gadams@apache.org> | 2012-04-25 14:48:09 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2012-04-25 14:48:09 +0000 |
commit | 1ec5b70b5a20beecb2a34682bbf0c6df77a74912 (patch) | |
tree | 8f1e9b4992e281fcc22f672943744f889b8a9949 | |
parent | c3bc9e8b04ee93dc3e3cc421ee7b52861b04dc16 (diff) | |
download | xmlgraphics-fop-1ec5b70b5a20beecb2a34682bbf0c6df77a74912.tar.gz xmlgraphics-fop-1ec5b70b5a20beecb2a34682bbf0c6df77a74912.zip |
Bugzilla #53148: Fix performance regression in JDK 1.6 Update 19 due to use of Java Beans API. Fix checkstyle errors.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1330317 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/expr/Function.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/expr/PropertyParser.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/truetype/TTFFile.java | 26 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/type1/AFMParser.java | 53 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java | 2 | ||||
-rw-r--r-- | status.xml | 5 |
7 files changed, 38 insertions, 53 deletions
diff --git a/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java b/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java index dc51c2670..48ea4e152 100644 --- a/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java +++ b/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java @@ -59,7 +59,7 @@ public class FromTableColumnFunction extends FunctionBase { } /** {@inheritDoc} */ - public Property eval(Property[] args,PropertyInfo pInfo) throws PropertyException { + public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException { FObj fo = pInfo.getPropertyList().getFObj(); diff --git a/src/java/org/apache/fop/fo/expr/Function.java b/src/java/org/apache/fop/fo/expr/Function.java index 4a0331b66..f558543c0 100644 --- a/src/java/org/apache/fop/fo/expr/Function.java +++ b/src/java/org/apache/fop/fo/expr/Function.java @@ -47,7 +47,7 @@ public interface Function { * position is index 0; if no default for a given index, then null is returned * @throws PropertyException if index is greater than or equal to optional args count */ - public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException; + Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException; /** * Determine if function allows variable arguments. If it does, then they must appear diff --git a/src/java/org/apache/fop/fo/expr/PropertyParser.java b/src/java/org/apache/fop/fo/expr/PropertyParser.java index 4e26ceeb5..f3e3e4a50 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyParser.java +++ b/src/java/org/apache/fop/fo/expr/PropertyParser.java @@ -20,7 +20,6 @@ package org.apache.fop.fo.expr; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import org.apache.xmlgraphics.util.UnitConv; diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index f9eaab74b..65ab560cf 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -420,32 +420,6 @@ public class TTFFile { unicodeMappings.add(new UnicodeMapping(glyphIdx, j)); mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(j)); - /* - * Removing this feature, since it violates XSL-FO and Unicode - * semantics. All characters used in an XSL-FO file (once decoded from - * the document encoding) are interpreted as Unicode code points. - * This precludes using Unicode code points in the Basic Latin range - * for any purpose other than use as Basic Latin characters. In - * order to use characters in the Wingding or Symbols font, then - * the user must use the specific Unicode code point that is mapped - * to the desired glyph via the font's cmap tables. What this means - * is that the user must use an appropriate private use character - * as defined by the font manufacturer and supported by some cmap - * provided in the font. [GA] 2012-04-20 - * - * if (encodingID == 0 && j >= 0xF020 && j <= 0xF0FF) { - * //Experimental: Mapping 0xF020-0xF0FF to 0x0020-0x00FF - * //Tested with Wingdings and Symbol TTF fonts which map their - * //glyphs in the region 0xF020-0xF0FF. - * int mapped = j - 0xF000; - * if (!eightBitGlyphs.get(mapped)) { - * //Only map if Unicode code point hasn't been mapped before - * unicodeMappings.add(new UnicodeMapping(glyphIdx, mapped)); - * mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(mapped)); - * } - * } - */ - // Also add winAnsiWidth List v = (List)ansiIndex.get(new Integer(j)); if (v != null) { diff --git a/src/java/org/apache/fop/fonts/type1/AFMParser.java b/src/java/org/apache/fop/fonts/type1/AFMParser.java index 3117f3bcb..f2711be3c 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMParser.java +++ b/src/java/org/apache/fop/fonts/type1/AFMParser.java @@ -20,11 +20,12 @@ package org.apache.fop.fonts.type1; import java.awt.Rectangle; -import java.beans.Statement; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.Stack; @@ -313,20 +314,24 @@ public class AFMParser { } private abstract static class BeanSetter extends AbstractValueHandler { - private String method; + protected String method; public BeanSetter(String variable) { this.method = "set" + variable; } - protected void setValue(Object target, Object value) { - //Uses Java Beans API - Statement statement = new Statement(target, method, new Object[] {value}); + protected void setValue(Object target, Class<?> argType, Object value) { + Class<?> c = target.getClass(); + try { - statement.execute(); - } catch (Exception e) { - //Should never happen - throw new RuntimeException("Bean error: " + e.getMessage()); + Method mth = c.getMethod(method, argType); + mth.invoke(target, value); + } catch ( NoSuchMethodException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); + } catch ( IllegalAccessException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); + } catch ( InvocationTargetException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); } } } @@ -340,7 +345,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { String s = getStringValue(line, startpos); Object obj = stack.peek(); - setValue(obj, s); + setValue(obj, String.class, s); } } @@ -353,7 +358,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { NamedCharacter ch = new NamedCharacter(getStringValue(line, startpos)); Object obj = stack.peek(); - setValue(obj, ch); + setValue(obj, NamedCharacter.class, ch); } } @@ -368,7 +373,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { Number num = getNumberValue(line, startpos); - setValue(getContextObject(stack), num); + setValue(getContextObject(stack), Number.class, num); } } @@ -379,7 +384,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { int value = getIntegerValue(line, startpos); - setValue(getContextObject(stack), new Integer(value)); + setValue(getContextObject(stack), int.class, new Integer(value)); } } @@ -390,7 +395,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { double value = getDoubleValue(line, startpos); - setValue(getContextObject(stack), new Double(value)); + setValue(getContextObject(stack), double.class, new Double(value)); } } @@ -424,7 +429,7 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { double value = getDoubleValue(line, startpos); - setValue(getContextObject(stack), new Double(value)); + setValue(getContextObject(stack), double.class, new Double(value)); } } @@ -441,14 +446,18 @@ public class AFMParser { public void parse(String line, int startpos, Stack<Object> stack) throws IOException { Boolean b = getBooleanValue(line, startpos); - //Uses Java Beans API - Statement statement = new Statement(getContextObject(stack), - method, new Object[] {b}); + + Object target = getContextObject(stack); + Class<?> c = target.getClass(); try { - statement.execute(); - } catch (Exception e) { - //Should never happen - throw new RuntimeException("Bean error: " + e.getMessage()); + Method mth = c.getMethod(method, boolean.class); + mth.invoke(target, b); + } catch ( NoSuchMethodException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); + } catch ( IllegalAccessException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); + } catch ( InvocationTargetException e ) { + throw new RuntimeException("Bean error: " + e.getMessage(), e); } } } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java index 424ad2215..2074d3bab 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java @@ -195,7 +195,7 @@ implements protected void writeRtfSuffix() throws IOException { List siblings = parent.getChildren(); // write suffix /sect only if this section is not last section (see bug #51484) - if ( siblings.listIterator ( siblings.indexOf ( this ) ) . hasNext() ) { + if ( siblings.listIterator ( siblings.indexOf ( this ) ) .hasNext() ) { writeControlWord("sect"); } } diff --git a/status.xml b/status.xml index acfc01b73..b0cec45dd 100644 --- a/status.xml +++ b/status.xml @@ -63,7 +63,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> - <action context="Fonts" dev="GA" type="fix" fixes-bug="51484" due-to="Benjamin Riefenstahl"> + <action context="Fonts" dev="GA" type="fix" fixes-bug="53148" due-to="Tassos Charoulis"> + Fix performance regression in JDK 1.6 Update 19 due to use of Java Beans API. Fix checkstyle errors. + </action> + <action context="Renderers" dev="GA" type="fix" fixes-bug="51484" due-to="Benjamin Riefenstahl"> Don't write final /sect suffix in RTF if section is last section. </action> <action context="Fonts" dev="GA" type="fix" fixes-bug="53143"> |