Browse Source

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
tags/fop-1_1rc1old
Glenn Adams 12 years ago
parent
commit
1ec5b70b5a

+ 1
- 1
src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java View File

@@ -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();


+ 1
- 1
src/java/org/apache/fop/fo/expr/Function.java View File

@@ -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

+ 0
- 1
src/java/org/apache/fop/fo/expr/PropertyParser.java View File

@@ -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;

+ 0
- 26
src/java/org/apache/fop/fonts/truetype/TTFFile.java View File

@@ -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) {

+ 31
- 22
src/java/org/apache/fop/fonts/type1/AFMParser.java View File

@@ -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);
}
}
}

+ 1
- 1
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java View File

@@ -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");
}
}

+ 4
- 1
status.xml View File

@@ -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">

Loading…
Cancel
Save