aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorGlenn Adams <gadams@apache.org>2014-08-06 19:19:31 +0000
committerGlenn Adams <gadams@apache.org>2014-08-06 19:19:31 +0000
commitc7d7ed1ee64ee057fc36b444161b0f982cd6e447 (patch)
treef57d2a3f0d3bd9f9a40aad9d735e160a9d867c6f /src/java
parentd408d2b45d6487f194eeb153830cd8b3ef479c92 (diff)
downloadxmlgraphics-fop-c7d7ed1ee64ee057fc36b444161b0f982cd6e447.tar.gz
xmlgraphics-fop-c7d7ed1ee64ee057fc36b444161b0f982cd6e447.zip
Fix or suppress 1-instance findbug warnings.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1616312 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-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
22 files changed, 119 insertions, 61 deletions
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) {