Author: gadams
Date: Wed Apr 25 14:48:09 2012
New Revision: 1330317
URL: http://svn.apache.org/viewvc?rev=1330317&view=rev
Log:
Bugzilla #53148: Fix performance regression in JDK 1.6 Update 19 due to use of
Java Beans API. Fix checkstyle errors.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/AFMParser.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java
xmlgraphics/fop/trunk/status.xml
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
Wed Apr 25 14:48:09 2012
@@ -59,7 +59,7 @@ public class FromTableColumnFunction ext
}
/** {@inheritDoc} */
- public Property eval(Property[] args,PropertyInfo pInfo) throws
PropertyException {
+ public Property eval(Property[] args, PropertyInfo pInfo) throws
PropertyException {
FObj fo = pInfo.getPropertyList().getFObj();
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java Wed Apr
25 14:48:09 2012
@@ -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
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
Wed Apr 25 14:48:09 2012
@@ -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;
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
Wed Apr 25 14:48:09 2012
@@ -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) {
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/AFMParser.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/AFMParser.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/AFMParser.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/AFMParser.java
Wed Apr 25 14:48:09 2012
@@ -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);
}
}
}
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java
Wed Apr 25 14:48:09 2012
@@ -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");
}
}
Modified: xmlgraphics/fop/trunk/status.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1330317&r1=1330316&r2=1330317&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Wed Apr 25 14:48:09 2012
@@ -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">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]