aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/fop.xconf20
-rw-r--r--findbugs-exclude.xml97
-rw-r--r--src/java/org/apache/fop/cli/CommandLineOptions.java2
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java1
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java22
-rw-r--r--src/java/org/apache/fop/fo/extensions/svg/SVGElement.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonTextDecoration.java5
-rw-r--r--src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java3
-rw-r--r--src/java/org/apache/fop/fonts/AbstractCodePointMapping.java4
-rw-r--r--src/java/org/apache/fop/fonts/truetype/OpenFont.java14
-rw-r--r--src/java/org/apache/fop/fonts/type1/PFMFile.java3
-rw-r--r--src/java/org/apache/fop/hyphenation/HyphenationTree.java48
-rw-r--r--src/java/org/apache/fop/hyphenation/Hyphenator.java6
-rw-r--r--src/java/org/apache/fop/hyphenation/TernaryTree.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java8
-rw-r--r--src/java/org/apache/fop/pdf/DestinationComparator.java4
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFGraphicContext.java1
-rw-r--r--src/java/org/apache/fop/render/java2d/Java2DRenderer.java3
-rw-r--r--src/java/org/apache/fop/render/print/PageableRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/ps/PSSVGHandler.java10
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java7
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java2
-rw-r--r--src/java/org/apache/fop/tools/fontlist/FontSpec.java25
-rw-r--r--src/java/org/apache/fop/util/text/AdvancedMessageFormat.java5
24 files changed, 148 insertions, 149 deletions
diff --git a/conf/fop.xconf b/conf/fop.xconf
index 01f12fd14..7514573c5 100644
--- a/conf/fop.xconf
+++ b/conf/fop.xconf
@@ -23,9 +23,8 @@ the location of this file.
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
- <!-- Default page-height and page-width, in case
- value is specified as auto -->
- <default-page-settings height="11in" width="8.26in"/>
+ <!-- Default page-height and page-width, in case value is specified as auto -->
+ <default-page-settings height="11.00in" width="8.50in"/>
<!-- Information for specific renderers -->
<!-- Uses renderer mime type for renderers -->
@@ -78,6 +77,10 @@ the location of this file.
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
-->
+
+ <!-- auto-detect fonts -->
+ <auto-detect/>
+
</fonts>
<!-- This option lets you specify additional options on an XML handler -->
@@ -403,11 +406,11 @@ the location of this file.
example:
<font>
- <afp-font type="CIDKeyed" encoding="UnicodeBigUnmarked"
- codepage="T1120000" characterset="CZJHMNU"
- base-uri="fonts" />
- <font-triplet name="J-Heisei Mincho" style="normal" weight="normal" />
- </font>
+ <afp-font type="CIDKeyed" encoding="UnicodeBigUnmarked"
+ codepage="T1120000" characterset="CZJHMNU"
+ base-uri="fonts" />
+ <font-triplet name="J-Heisei Mincho" style="normal" weight="normal" />
+ </font>
-->
@@ -461,4 +464,3 @@ the location of this file.
</renderers>
</fop>
-
diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml
index 8c3af2022..4af7948ad 100644
--- a/findbugs-exclude.xml
+++ b/findbugs-exclude.xml
@@ -9,18 +9,19 @@
<Bug pattern="CI_CONFUSED_INHERITANCE"/>
</Match>
<Match>
- <!-- 1 warning -->
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.render.intermediate.IFGraphicContext"/>
+ <Method name="clone"/>
+ </And>
+ </Or>
</Match>
<Match>
<!-- 15 warnings -->
<Bug pattern="DB_DUPLICATE_SWITCH_CLAUSES"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="DE_MIGHT_IGNORE"/>
- </Match>
- <Match>
<!-- 27 warnings -->
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
</Match>
@@ -53,10 +54,6 @@
<Bug pattern="DM_NUMBER_CTOR"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="DM_STRING_CTOR"/>
- </Match>
- <Match>
<!-- 2 warnings -->
<Bug pattern="DM_STRING_TOSTRING"/>
</Match>
@@ -81,22 +78,19 @@
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<Match>
- <!-- 1 warning -->
<Bug pattern="EQ_ALWAYS_TRUE"/>
- </Match>
- <Match>
- <!-- 1 warning -->
- <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.fo.properties.ToBeImplementedProperty"/>
+ <Method name="equals"/>
+ </And>
+ </Or>
</Match>
<Match>
<!-- 2 warnings -->
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="EQ_UNUSUAL"/>
- </Match>
- <Match>
<!-- 3 warnings -->
<Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
</Match>
@@ -109,18 +103,6 @@
<Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="ICAST_IDIV_CAST_TO_DOUBLE"/>
- </Match>
- <Match>
- <!-- 1 warning -->
- <Bug pattern="ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND"/>
- </Match>
- <Match>
- <!-- 1 warning -->
- <Bug pattern="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW"/>
- </Match>
- <Match>
<!-- 2 warnings -->
<Bug pattern="IM_BAD_CHECK_FOR_ODD"/>
</Match>
@@ -137,16 +119,17 @@
<Bug pattern="LI_LAZY_INIT_STATIC"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="LI_LAZY_INIT_UPDATE_STATIC"/>
- </Match>
- <Match>
<!-- 2 warnings -->
<Bug pattern="MF_CLASS_MASKS_FIELD"/>
</Match>
<Match>
- <!-- 1 warning -->
<Bug pattern="MS_EXPOSE_REP"/>
+ <Or>
+ <And>
+ <Class name="org.apache.fop.fo.FOPropertyMapping"/>
+ <Method name="getGenericMappings"/>
+ </And>
+ </Or>
</Match>
<Match>
<!-- 12 warnings -->
@@ -169,14 +152,6 @@
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="NP_GUARANTEED_DEREF"/>
- </Match>
- <Match>
- <!-- 1 warning -->
- <Bug pattern="NP_IMMEDIATE_DEREFERENCE_OF_READLINE"/>
- </Match>
- <Match>
<!-- 4 warnings -->
<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE"/>
</Match>
@@ -205,10 +180,6 @@
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/>
- </Match>
- <Match>
<!-- 10 warnings -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
@@ -217,10 +188,6 @@
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
- </Match>
- <Match>
<!-- 23 warnings -->
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
@@ -229,22 +196,10 @@
<Bug pattern="RI_REDUNDANT_INTERFACES"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="RR_NOT_CHECKED"/>
- </Match>
- <Match>
- <!-- 1 warning -->
- <Bug pattern="RV_EXCEPTION_NOT_THROWN"/>
- </Match>
- <Match>
<!-- 11 warnings -->
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="SA_FIELD_SELF_COMPARISON"/>
- </Match>
- <Match>
<!-- 2 warnings -->
<Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION"/>
</Match>
@@ -261,10 +216,6 @@
<Bug pattern="SE_BAD_FIELD_STORE"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
- </Match>
- <Match>
<!-- 6 warnings -->
<Bug pattern="SE_INNER_CLASS"/>
</Match>
@@ -277,10 +228,6 @@
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="SF_SWITCH_NO_DEFAULT"/>
- </Match>
- <Match>
<!-- 21 warnings -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
</Match>
@@ -289,10 +236,6 @@
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS"/>
- </Match>
- <Match>
<!-- 5 warnings -->
<Bug pattern="SR_NOT_CHECKED"/>
</Match>
@@ -309,10 +252,6 @@
<Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
</Match>
<Match>
- <!-- 1 warning -->
- <Bug pattern="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS"/>
- </Match>
- <Match>
<!-- 6 warnings -->
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
</Match>
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java
index 8a5259ef0..325dc6703 100644
--- a/src/java/org/apache/fop/cli/CommandLineOptions.java
+++ b/src/java/org/apache/fop/cli/CommandLineOptions.java
@@ -164,7 +164,7 @@ public class CommandLineOptions {
try {
optionsParsed = parseOptions(args);
if (optionsParsed) {
- if (showConfiguration == Boolean.TRUE) {
+ if (showConfiguration.equals(Boolean.TRUE)) {
dumpConfiguration();
}
checkSettings();
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 413438c16..9089304df 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -343,6 +343,7 @@ public final class FOPropertyMapping implements Constants {
addSubpropMakerName("precedence", CP_PRECEDENCE);
}
+ // SuppressFBWarnings("MS_EXPOSE_REP")
return generics;
}
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index 2f4d16480..0412091a5 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -52,9 +52,17 @@ import org.apache.fop.fo.properties.PropertyMaker;
*/
public abstract class PropertyList {
-
private static boolean[] inheritableProperty;
+ static {
+ inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
+ PropertyMaker maker = null;
+ for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
+ maker = findMaker(prop);
+ inheritableProperty[prop] = (maker != null && maker.isInherited());
+ }
+ }
+
/** reference to the parent FO's propertyList **/
protected PropertyList parentPropertyList;
private FObj fobj;
@@ -620,15 +628,6 @@ public abstract class PropertyList {
* @return isInherited value from the requested Property.Maker
*/
private boolean isInherited(int propId) {
- if (inheritableProperty == null) {
- inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
- PropertyMaker maker = null;
- for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
- maker = findMaker(prop);
- inheritableProperty[prop] = (maker != null && maker.isInherited());
- }
- }
-
return inheritableProperty[propId];
}
@@ -636,8 +635,7 @@ public abstract class PropertyList {
* @param propId Id of property
* @return the Property.Maker for this property
*/
- private PropertyMaker findMaker(int propId) {
-
+ private static PropertyMaker findMaker(int propId) {
if (propId < 1 || propId > Constants.PROPERTY_COUNT) {
return null;
} else {
diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
index eac8338aa..63506dd0a 100644
--- a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
+++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
@@ -130,9 +130,6 @@ public class SVGElement extends SVGObj {
public float getFontSize() {
return 12;
}
-
- public void deselectAll() {
- }
};
SVGOMElement e = (SVGOMElement)svgRoot;
e.setSVGContext(dc);
diff --git a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java b/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
index 8ef62ced0..7f843279e 100644
--- a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
+++ b/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
@@ -64,6 +64,7 @@ public class CommonTextDecoration {
private static CommonTextDecoration calcTextDecoration(PropertyList pList)
throws PropertyException {
+ assert pList != null;
CommonTextDecoration deco = null;
PropertyList parentList = pList.getParentPropertyList();
if (parentList != null) {
@@ -78,9 +79,7 @@ public class CommonTextDecoration {
while (i.hasNext()) {
Property prop = (Property)i.next();
int propEnum = prop.getEnum();
- FOUserAgent ua = (pList == null)
- ? null
- : (pList.getFObj() == null ? null : pList.getFObj().getUserAgent());
+ FOUserAgent ua = pList.getFObj() == null ? null : pList.getFObj().getUserAgent();
if (propEnum == Constants.EN_NONE) {
if (deco != null) {
deco.decoration = 0;
diff --git a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
index 0315e0e74..6c820eeab 100644
--- a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
+++ b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
@@ -74,11 +74,12 @@ public class ToBeImplementedProperty extends Property {
@Override
public boolean equals(Object obj) {
- return true;
/*
* Since a PropertyCache is not used here, returning true helps the PropertyCache when a non
* implemented property is part of an implemented one.
*/
+ // FBOFF: EQ_ALWAYS_TRUE
+ return true;
}
}
diff --git a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java b/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
index 20cef2d0b..ca0c52d5e 100644
--- a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
+++ b/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
@@ -128,7 +128,9 @@ public class AbstractCodePointMapping implements SingleByteEncoding {
int bot = 0;
int top = characters.length - 1;
while (top >= bot) {
- int mid = (bot + top) / 2;
+ assert bot < 65536;
+ assert top < 65536;
+ int mid = (bot + top) >>> 1;
char mc = characters[mid];
if (c == mc) {
diff --git a/src/java/org/apache/fop/fonts/truetype/OpenFont.java b/src/java/org/apache/fop/fonts/truetype/OpenFont.java
index ecd344f99..fc2acf8ca 100644
--- a/src/java/org/apache/fop/fonts/truetype/OpenFont.java
+++ b/src/java/org/apache/fop/fonts/truetype/OpenFont.java
@@ -266,16 +266,16 @@ public abstract class OpenFont {
/**
* Key-value helper class.
*/
- final class UnicodeMapping implements Comparable {
+ final static class UnicodeMapping implements Comparable {
private final int unicodeIndex;
private final int glyphIndex;
- UnicodeMapping(int glyphIndex, int unicodeIndex) {
+ UnicodeMapping(OpenFont font, int glyphIndex, int unicodeIndex) {
this.unicodeIndex = unicodeIndex;
this.glyphIndex = glyphIndex;
- glyphToUnicodeMap.put(new Integer(glyphIndex), new Integer(unicodeIndex));
- unicodeToGlyphMap.put(new Integer(unicodeIndex), new Integer(glyphIndex));
+ font.glyphToUnicodeMap.put(new Integer(glyphIndex), new Integer(unicodeIndex));
+ font.unicodeToGlyphMap.put(new Integer(unicodeIndex), new Integer(glyphIndex));
}
/**
@@ -533,7 +533,7 @@ public abstract class OpenFont {
glyphIdx = (fontFile.readTTFUShort() + cmapDeltas[i])
& 0xffff;
//mtxTab[glyphIdx].setName(mtxTab[glyphIdx].getName() + " - "+(char)j);
- unicodeMappings.add(new UnicodeMapping(glyphIdx, j));
+ unicodeMappings.add(new UnicodeMapping(this, glyphIdx, j));
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(j));
if (encodingID == 0 && j >= 0xF020 && j <= 0xF0FF) {
@@ -543,7 +543,7 @@ public abstract class OpenFont {
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));
+ unicodeMappings.add(new UnicodeMapping(this, glyphIdx, mapped));
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(mapped));
}
}
@@ -582,7 +582,7 @@ public abstract class OpenFont {
+ mtxTab.length);
}
- unicodeMappings.add(new UnicodeMapping(glyphIdx, j));
+ unicodeMappings.add(new UnicodeMapping(this, glyphIdx, j));
if (glyphIdx < mtxTab.length) {
mtxTab[glyphIdx].getUnicodeIndex().add(new Integer(j));
} else {
diff --git a/src/java/org/apache/fop/fonts/type1/PFMFile.java b/src/java/org/apache/fop/fonts/type1/PFMFile.java
index d19c8d478..a2d384e7f 100644
--- a/src/java/org/apache/fop/fonts/type1/PFMFile.java
+++ b/src/java/org/apache/fop/fonts/type1/PFMFile.java
@@ -91,8 +91,7 @@ public class PFMFile {
}
bufin.reset();
byte[] b = new byte[16];
- bufin.read(b);
- if (new String(b, "US-ASCII").equalsIgnoreCase("StartFontMetrics")) {
+ if ((bufin.read(b) == b.length) && new String(b, "US-ASCII").equalsIgnoreCase("StartFontMetrics")) {
//Found the header of a AFM file!
IOUtils.closeQuietly(in);
throw new IOException("Cannot parse PFM file. You probably specified the AFM file"
diff --git a/src/java/org/apache/fop/hyphenation/HyphenationTree.java b/src/java/org/apache/fop/hyphenation/HyphenationTree.java
index 60d280f7c..24730a529 100644
--- a/src/java/org/apache/fop/hyphenation/HyphenationTree.java
+++ b/src/java/org/apache/fop/hyphenation/HyphenationTree.java
@@ -641,24 +641,44 @@ public class HyphenationTree extends TernaryTree
+ "b:\tbenchmark\n"
+ "q:\tquit\n\n"
+ "Command:");
- String token = in.readLine().trim();
+ String token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
if (token.equals("f")) {
System.out.print("Pattern: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
System.out.println("Values: " + ht.findPattern(token));
} else if (token.equals("s")) {
System.out.print("Minimun value: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
minCharCount = Integer.parseInt(token);
} else if (token.equals("l")) {
ht = new HyphenationTree();
System.out.print("XML file name: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
ht.loadPatterns(token);
} else if (token.equals("L")) {
ObjectInputStream ois = null;
System.out.print("Object file name: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
try {
ois = new ObjectInputStream(new FileInputStream(token));
ht = (HyphenationTree)ois.readObject();
@@ -675,7 +695,11 @@ public class HyphenationTree extends TernaryTree
}
} else if (token.equals("w")) {
System.out.print("Object file name: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(token));
@@ -698,7 +722,11 @@ public class HyphenationTree extends TernaryTree
}
} else if (token.equals("h")) {
System.out.print("Word: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
System.out.print("Hyphenation points: ");
System.out.println(ht.hyphenate(token, minCharCount,
minCharCount));
@@ -708,7 +736,11 @@ public class HyphenationTree extends TernaryTree
break;
}
System.out.print("Word list filename: ");
- token = in.readLine().trim();
+ token = in.readLine();
+ if (token == null) {
+ break;
+ }
+ token = token.trim();
long starttime = 0;
int counter = 0;
BufferedReader reader = null;
diff --git a/src/java/org/apache/fop/hyphenation/Hyphenator.java b/src/java/org/apache/fop/hyphenation/Hyphenator.java
index 9e61263e6..90848cd69 100644
--- a/src/java/org/apache/fop/hyphenation/Hyphenator.java
+++ b/src/java/org/apache/fop/hyphenation/Hyphenator.java
@@ -174,7 +174,11 @@ public final class Hyphenator {
is = contextClassLoader.getResourceAsStream("hyph/" + key
+ ".hyp");
}
- } catch (Exception e) {
+ } catch (NoSuchMethodException e) {
+ //ignore, fallback further down
+ } catch (IllegalAccessException e) {
+ //ignore, fallback further down
+ } catch (java.lang.reflect.InvocationTargetException e) {
//ignore, fallback further down
}
diff --git a/src/java/org/apache/fop/hyphenation/TernaryTree.java b/src/java/org/apache/fop/hyphenation/TernaryTree.java
index e9798fa9c..359c729b6 100644
--- a/src/java/org/apache/fop/hyphenation/TernaryTree.java
+++ b/src/java/org/apache/fop/hyphenation/TernaryTree.java
@@ -589,7 +589,7 @@ public class TernaryTree implements Cloneable, Serializable {
/** @return next element */
public Object nextElement() {
- String res = new String(curkey);
+ String res = curkey;
cur = up();
run();
return res;
diff --git a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
index 192956abc..931938697 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
@@ -318,13 +318,13 @@ public class AlignmentContext implements Constants {
case EN_BASELINE: //Nothing to do
break;
case EN_SUB:
- baselineShiftValue = Math.round(-(xHeight / 2)
- + parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
+ baselineShiftValue = Math.round(-((float)xHeight / 2)
+ + (float)parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
);
break;
case EN_SUPER:
- baselineShiftValue = Math.round(parentAlignmentContext.getXHeight()
- + parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
+ baselineShiftValue = Math.round((float)parentAlignmentContext.getXHeight()
+ + (float)parentAlignmentContext.getActualBaselineOffset(EN_ALPHABETIC)
);
break;
case 0: // A <length> or <percentage> value
diff --git a/src/java/org/apache/fop/pdf/DestinationComparator.java b/src/java/org/apache/fop/pdf/DestinationComparator.java
index bb298ade3..6e193dc3d 100644
--- a/src/java/org/apache/fop/pdf/DestinationComparator.java
+++ b/src/java/org/apache/fop/pdf/DestinationComparator.java
@@ -23,11 +23,13 @@ package org.apache.fop.pdf;
* Comparator class to enable comparing (and
* hence sorting) of PDFDestination objects.
*/
-public class DestinationComparator implements java.util.Comparator {
+public class DestinationComparator implements java.util.Comparator, java.io.Serializable {
/* public int compare (PDFDestination dest1, PDFDestination dest2) {
return dest1.getIDRef().compareTo(dest2.getIDRef());
}*/
+ static final long serialVersionUID = 0L;
+
/** {@inheritDoc} */
public int compare(Object obj1, Object obj2) {
if (obj1 instanceof PDFDestination && obj2 instanceof PDFDestination) {
diff --git a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
index c1742be1f..e97c68bd1 100644
--- a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
+++ b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
@@ -57,6 +57,7 @@ public class IFGraphicContext extends GraphicContext {
* {@inheritDoc}
*/
public Object clone() {
+ // FBOFF: CN_IDIOM_NO_SUPER_CALL
return new IFGraphicContext(this);
}
diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
index 576f042ce..ec837c65c 100644
--- a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
+++ b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
@@ -216,9 +216,6 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
renderingDone = true;
int numberOfPages = currentPageNumber;
// TODO set all vars to null for gc
- if (numberOfPages == 0) {
- new FOPException("No page could be rendered");
- }
}
/** @return true if the renderer is not currently processing */
diff --git a/src/java/org/apache/fop/render/print/PageableRenderer.java b/src/java/org/apache/fop/render/print/PageableRenderer.java
index 7f2f40956..7a6f89b9c 100644
--- a/src/java/org/apache/fop/render/print/PageableRenderer.java
+++ b/src/java/org/apache/fop/render/print/PageableRenderer.java
@@ -109,7 +109,7 @@ public class PageableRenderer extends Java2DRenderer implements Pageable {
if (o != null) {
this.endNumber = getPositiveInteger(o);
}
- if (this.endNumber >= 0 && this.endNumber < this.endNumber) {
+ if (this.endNumber >= 0 && this.endNumber < this.startNumber) {
this.endNumber = this.startNumber;
}
}
diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/java/org/apache/fop/render/ps/PSSVGHandler.java
index dfbaf60b7..d6c47d84c 100644
--- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java
+++ b/src/java/org/apache/fop/render/ps/PSSVGHandler.java
@@ -219,18 +219,16 @@ public class PSSVGHandler extends AbstractGenericSVGHandler
* @param context the renderer context
* @param doc the svg document
*/
- protected void renderSVGDocument(RendererContext context,
- Document doc) {
+ protected void renderSVGDocument(RendererContext context, Document doc) {
+ assert context != null;
PSInfo psInfo = getPSInfo(context);
int xOffset = psInfo.currentXPosition;
int yOffset = psInfo.currentYPosition;
PSGenerator gen = psInfo.psGenerator;
boolean paintAsBitmap = false;
- if (context != null) {
- Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
- paintAsBitmap = ImageHandlerUtil.isConversionModeBitmap(foreign);
- }
+ Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+ paintAsBitmap = ImageHandlerUtil.isConversionModeBitmap(foreign);
if (paintAsBitmap) {
try {
super.renderSVGDocument(context, doc);
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
index 22a2a7462..55f8cbf27 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
@@ -113,7 +113,12 @@ public class RtfExtraRowSet extends RtfContainer {
}
public boolean equals(Object o) {
- return o != null && this.compareTo(o) == 0;
+ if (o instanceof PositionedCell) {
+ PositionedCell pc = (PositionedCell) o;
+ return (pc.rowIndex == rowIndex) && (pc.xOffset == xOffset);
+ } else {
+ return false;
+ }
}
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
index 66759e060..88ce01edc 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
@@ -200,7 +200,7 @@ public class RtfLeader extends RtfContainer {
// Depending on font-size 15 -> 1cm = 7,5 spaces
// TODO for rule-thickness this has to be done better
- for (double d = (Integer.parseInt(tabwidth) / 560) * 7.5; d >= 1; d--) {
+ for (double d = (Integer.parseInt(tabwidth) / 560.0) * 7.5; d >= 1; d--) {
RtfStringConverter.getInstance().writeRtfString(writer, " ");
}
diff --git a/src/java/org/apache/fop/tools/fontlist/FontSpec.java b/src/java/org/apache/fop/tools/fontlist/FontSpec.java
index 074cc922c..35b882c46 100644
--- a/src/java/org/apache/fop/tools/fontlist/FontSpec.java
+++ b/src/java/org/apache/fop/tools/fontlist/FontSpec.java
@@ -95,10 +95,29 @@ public class FontSpec implements Comparable {
return this.metrics;
}
- /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return metrics.getFullName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof FontSpec) {
+ FontSpec other = (FontSpec)o;
+ return metrics.getFullName().equals(other.metrics.getFullName());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
public int compareTo(Object o) {
- FontSpec other = (FontSpec)o;
- return metrics.getFullName().compareTo(other.metrics.getFullName());
+ if (o instanceof FontSpec) {
+ FontSpec other = (FontSpec)o;
+ return metrics.getFullName().compareTo(other.metrics.getFullName());
+ } else {
+ return 1;
+ }
}
}
diff --git a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
index 0eae550dc..f8508e082 100644
--- a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
+++ b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
@@ -146,10 +146,13 @@ public class AdvancedMessageFormat {
i++;
ch = pattern.charAt(i);
}
- //no break here! Must be right before "default" section
+ sb.append(ch);
+ i++;
+ break;
default:
sb.append(ch);
i++;
+ break;
}
}
if (sb.length() > 0) {