]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix or suppress 3-instance findbug warnings.
authorGlenn Adams <gadams@apache.org>
Thu, 7 Aug 2014 20:27:59 +0000 (20:27 +0000)
committerGlenn Adams <gadams@apache.org>
Thu, 7 Aug 2014 20:27:59 +0000 (20:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1616590 13f79535-47bb-0310-9956-ffa450edef68

28 files changed:
findbugs-exclude.xml
src/java/org/apache/fop/afp/AFPResourceInfo.java
src/java/org/apache/fop/apps/MimeConstants.java
src/java/org/apache/fop/cli/ImageInputHandler.java
src/java/org/apache/fop/events/EventListener.java
src/java/org/apache/fop/fo/FOPropertyMapping.java
src/java/org/apache/fop/fo/flow/Marker.java
src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
src/java/org/apache/fop/fonts/FontInfo.java
src/java/org/apache/fop/hyphenation/PatternParser.java
src/java/org/apache/fop/layoutmgr/table/TableStepper.java
src/java/org/apache/fop/render/Graphics2DImagePainter.java
src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java
src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java
src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java
src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java
src/java/org/apache/fop/render/java2d/Java2DRenderer.java
src/java/org/apache/fop/render/pcl/PCLGenerator.java
src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
src/java/org/apache/fop/render/ps/NativeTextHandler.java
src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java
src/java/org/apache/fop/render/ps/PSSVGHandler.java
src/java/org/apache/fop/render/rtf/RTFHandler.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageArea.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
src/java/org/apache/fop/tools/anttasks/FileCompare.java
src/java/org/apache/fop/tools/fontlist/FontListSerializer.java

index 791f22ec8c6f7534c95db68ba0d7fcdf5edb1e2a..c11fdc732db020445b5a32f64c7d136977a1c3cb 100644 (file)
     <!-- 27 warnings -->
     <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="DLS_DEAD_LOCAL_STORE_OF_NULL"/>
-  </Match>
   <Match>
     <!-- 4 warnings -->
     <Bug pattern="DM_BOOLEAN_CTOR"/>
       </And>
     </Or>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
-  </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="ES_COMPARING_STRINGS_WITH_EQ"/>
-  </Match>
   <Match>
     <!-- 12 warnings -->
     <Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="IS2_INCONSISTENT_SYNC"/>
-  </Match>
   <Match>
     <!-- 6 warnings -->
     <Bug pattern="ITA_INEFFICIENT_TO_ARRAY"/>
     <Bug pattern="NM_CONFUSING"/>
   </Match>
   <Match>
-    <!-- 3 warnings -->
     <Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
+    <Or>
+      <Class name="org.apache.fop.apps.MimeConstants"/>
+      <Class name="org.apache.fop.events.EventListener"/>
+      <Class name="org.apache.fop.render.Graphics2DImagePainter"/>
+    </Or>
   </Match>
   <Match>
     <!-- 5 warnings -->
     <!-- 4 warnings -->
     <Bug pattern="NP_NULL_ON_SOME_PATH"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT"/>
-  </Match>
   <Match>
     <!-- 4 warnings -->
     <Bug pattern="OS_OPEN_STREAM"/>
     <!-- 10 warnings -->
     <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
-  </Match>
   <Match>
     <!-- 23 warnings -->
     <Bug pattern="REC_CATCH_EXCEPTION"/>
     <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
   </Match>
   <Match>
-    <!-- 3 warnings -->
     <Bug pattern="SF_SWITCH_FALLTHROUGH"/>
+    <Or>
+      <And>
+        <Class name="org.apache.fop.render.awt.viewer.PreviewPanel$Reloader"/>
+        <Method name="run"/>
+      </And>
+    </Or>
   </Match>
   <Match>
     <!-- 21 warnings -->
     <!-- 8 warnings -->
     <Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
-  </Match>
   <Match>
     <!-- 6 warnings -->
     <Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
     <!-- 12 warnings -->
     <Bug pattern="URF_UNREAD_FIELD"/>
   </Match>
-  <Match>
-    <!-- 3 warnings -->
-    <Bug pattern="UUF_UNUSED_FIELD"/>
-  </Match>
   <Match>
     <!-- 58 warnings -->
     <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
index 7cad51596c92d1094dfac8b9fdc43ac47dfa4d30..d668a82af6e0dd50bba33b73ba15a454682bbde4 100644 (file)
@@ -158,11 +158,10 @@ public class AFPResourceInfo {
         }
 
         AFPResourceInfo ri = (AFPResourceInfo)obj;
-        return (uri == ri.uri || uri != null && uri.equals(ri.uri))
-            && (imageDimension == ri.imageDimension
-                    || (imageDimension != null && imageDimension.equals(ri.imageDimension)))
-            && (name == ri.name || name != null && name.equals(ri.name))
-            && (level == ri.level || level != null && level.equals(ri.level));
+        return (uri != null && uri.equals(ri.uri))
+            && (imageDimension != null && imageDimension.equals(ri.imageDimension))
+            && (name != null && name.equals(ri.name))
+            && (level != null && level.equals(ri.level));
     }
 
     /** {@inheritDoc} */
index 75b05c8b72c320c708a42beb5af8bede5f85a397..33030e22fe99c9b560447ba19976ed2f007c7911 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.fop.apps;
 /**
  * Frequently used MIME types for various file formats used when working with Apache FOP.
  */
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
 public interface MimeConstants extends org.apache.xmlgraphics.util.MimeConstants {
 
     /** Apache FOP's AWT preview (non-standard MIME type) */
index b8439bc7a2203645c8f9b7d489587b3b98527994..71c5b00731d73aba34b7ab3d7f1c1b6ac5cb6d60 100644 (file)
@@ -52,7 +52,7 @@ public class ImageInputHandler extends InputHandler {
     protected Source createXSLTSource() {
         Source src = super.createXSLTSource();
         if (src == null) {
-            src = new StreamSource(getClass().getResource("image2fo.xsl").toExternalForm());
+            src = new StreamSource(ImageInputHandler.class.getResource("image2fo.xsl").toExternalForm());
         }
         return src;
     }
index 4889d3299a82c429e68fb0ecc6f295b26d704fe7..fa1bb5beb830cd3b4a5cc16b5628ef9b4359dcf7 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.fop.events;
 /**
  * This interface is implemented by clients who want to listen for events.
  */
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
 public interface EventListener extends java.util.EventListener {
 
     /**
index 9089304dff3f70414daef6319b4ad7d63f648255..937fc62e36a6302a91ca45b55b3a82f269e7f047 100644 (file)
@@ -343,7 +343,7 @@ public final class FOPropertyMapping implements Constants {
             addSubpropMakerName("precedence", CP_PRECEDENCE);
         }
 
-        // SuppressFBWarnings("MS_EXPOSE_REP")
+        // @SuppressFBWarnings("MS_EXPOSE_REP")
         return generics;
     }
 
index 5d525ee8cd387442c31f7f48b0010dd84f54fbb9..8abf3d992ae0faf6322641b0a411b07cc7fbac4c 100644 (file)
@@ -420,18 +420,14 @@ public class Marker extends FObjMixed {
 
             if (o instanceof MarkerAttribute) {
                 MarkerAttribute attr = (MarkerAttribute) o;
-                return ((attr.namespace == this.namespace)
-                            || (attr.namespace != null
-                                    && attr.namespace.equals(this.namespace)))
-                    && ((attr.qname == this.qname)
-                            || (attr.qname != null
-                                    && attr.qname.equals(this.qname)))
-                    && ((attr.name == this.name)
-                            || (attr.name != null
-                                    && attr.name.equals(this.name)))
-                    && ((attr.value == this.value)
-                            || (attr.value != null
-                                    && attr.value.equals(this.value)));
+                return (attr.namespace != null
+                                    && attr.namespace.equals(this.namespace))
+                    && (attr.qname != null
+                                    && attr.qname.equals(this.qname))
+                    && (attr.name != null
+                                    && attr.name.equals(this.name))
+                    && (attr.value != null
+                                    && attr.value.equals(this.value));
             } else {
                 return false;
             }
index 6c820eeabacba2f9b2011b4c9d66ec1db85f3dfb..95ed0de851ce37bdc6ca36e230040d2e43cd713b 100644 (file)
@@ -78,7 +78,7 @@ public class ToBeImplementedProperty extends Property {
          * 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
+        // @SuppressFBWarnings("EQ_ALWAYS_TRUE")
         return true;
     }
 }
index 0c94b256fa92cf08bd9775a45b97ef54dc5f6427..cea7e5107b432f2e1a60355ccf5b87c4ab4d6f3b 100644 (file)
@@ -245,13 +245,13 @@ public class FontInfo {
 
         // only if the font may be substituted
         // fallback 1: try the same font-family and weight with default style
-        if (internalFontKey == null && style != Font.STYLE_NORMAL) {
+        if (internalFontKey == null && !style.equals(Font.STYLE_NORMAL)) {
             key = createFontKey(family, Font.STYLE_NORMAL, weight);
             internalFontKey = getInternalFontKey(key);
         }
 
         // fallback 2: try the same font-family with default style and try to adjust weight
-        if (internalFontKey == null && style != Font.STYLE_NORMAL) {
+        if (internalFontKey == null && !style.equals(Font.STYLE_NORMAL)) {
             key = findAdjustWeight(family, Font.STYLE_NORMAL, weight);
             if (key != null) {
                 internalFontKey = getInternalFontKey(key);
index 7961b28d93bd2de1130b27f61e29eedbb833b4f5..2fc5984ad028a30c0a1865cd208adf9ce81b0e77 100644 (file)
@@ -261,7 +261,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer {
         parser = createParser();
         parser.setContentHandler(this);
         parser.setErrorHandler(this);
-        InputStream stream = this.getClass().getResourceAsStream("classes.xml");
+        InputStream stream = PatternParser.class.getResourceAsStream("classes.xml");
         InputSource source = new InputSource(stream);
         try {
             parser.parse(source);
index c58febd0e0633c4d220b81b4533cf89c18842889..0906e9faa4d197f6e9e6eabfc91e0496eedfd0db 100644 (file)
@@ -419,7 +419,9 @@ public class TableStepper {
         for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
             ActiveCell activeCell = (ActiveCell) iter.next();
             if (activeCell.endsOnRow(activeRowIndex)) {
-                rowFinished &= activeCell.finishes(step);
+                if (!activeCell.finishes(step)) {
+                    rowFinished = false;
+                }
             }
         }
         if (rowFinished) {
index 6b4754720183640179a250f74304c874ad34ebf8..e72fc1e46951fbf886d180a1d492b2db42f92039 100644 (file)
@@ -24,6 +24,7 @@ package org.apache.fop.render;
  * a Graphics2D instance can implement this interface to paint themselves.
  * @deprecated use {@link org.apache.xmlgraphics.java2d.Graphics2DImagePainter} directly!
  */
+// @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
 public interface Graphics2DImagePainter
         extends org.apache.xmlgraphics.java2d.Graphics2DImagePainter {
 
index 0067f8367e0111010383f3729cd3ac7444a8f628..30b3af9dd0daf268215ff3a8846886dea6801de0 100644 (file)
@@ -62,6 +62,15 @@ public class ImageProxyPanel extends JPanel {
     public ImageProxyPanel(AWTRenderer renderer, int page) {
         this.renderer = renderer;
         this.page = page;
+        try {
+            Dimension size = renderer.getPageImageSize(page);
+            Insets insets = getInsets();
+            size.width += insets.left + insets.right;
+            size.height += insets.top + insets.bottom;
+            this.size = size;
+        } catch (Exception e) {
+            this.size = new Dimension(10, 10);
+        }
         // Allows single panel to appear behind page display.
         // Important for textured L&Fs.
         setOpaque(false);
@@ -78,17 +87,6 @@ public class ImageProxyPanel extends JPanel {
      * @return the size of the page plus the border.
      */
     public Dimension getPreferredSize() {
-        if (size == null) {
-            try {
-                Insets insets = getInsets();
-                size = renderer.getPageImageSize(page);
-                size = new Dimension(size.width + insets.left + insets.right,
-                                                         size.height + insets.top + insets.bottom);
-            } catch (FOPException fopEx) {
-                // Arbitary size. Doesn't really matter what's returned here.
-                return new Dimension(10, 10);
-            }
-        }
         return size;
     }
 
@@ -96,7 +94,7 @@ public class ImageProxyPanel extends JPanel {
      * Sets the number of the page to be displayed and refreshes the display.
      * @param pg the page number
      */
-    public void setPage(int pg) {
+    public synchronized void setPage(int pg) {
         if (page != pg) {
             page = pg;
             imageRef = null;
index 53cd585c9353360c0740a6534208b0ef680f440b..643c78b7c1a3ca06ffe92f54c007aab2b0e00194 100644 (file)
@@ -64,7 +64,7 @@ public class PreviewDialogAboutBox extends Dialog implements ActionListener {
         JPanel insetsPanel3 = new JPanel();
         okButton = new JButton();
         JLabel imageControl1 = new JLabel();
-        imageControl1.setIcon(new ImageIcon(getClass().getResource("images/fop.gif")));
+        imageControl1.setIcon(new ImageIcon(PreviewDialogAboutBox.class.getResource("images/fop.gif")));
         JLabel label1 = new JLabel(translator.getString("About.Product"));
         JLabel label2 = new JLabel(translator.getString("About.Version")
                                             + " " + Version.getVersion());
index 36ded2f7f3a841c10e886d1e6c5c1f7d13c97ede..93cc29e4fcd7c86ca2e52fb01a175398b6b44f12 100644 (file)
@@ -320,7 +320,7 @@ public class PreviewPanel extends JPanel {
 
         // ***** MouseListener *****
 
-        public void mousePressed(MouseEvent e) {
+        public synchronized void mousePressed(MouseEvent e) {
             startPosX = e.getX();
             startPosY = e.getY();
         }
@@ -357,6 +357,7 @@ public class PreviewPanel extends JPanel {
                     // This page intentionally left blank
                     // Makes 0th/1st page on rhs
                     gridPanel.add(new JLabel(""));
+                    // @SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
                 case CONTINUOUS:
                     currentPage = 0;
                     firstPage = 0;
index e97c68bd149789f7adf6f888894e00bb364b2fd2..16471fe9caafaf14034d1c30adcf83c216a6a62b 100644 (file)
@@ -56,8 +56,8 @@ public class IFGraphicContext extends GraphicContext {
     /**
      * {@inheritDoc}
      */
+    // @SuppressFBWarnings("CN_IDIOM_NO_SUPER_CALL")
     public Object clone() {
-        // FBOFF: CN_IDIOM_NO_SUPER_CALL
         return new IFGraphicContext(this);
     }
 
index 588d417fa02f45363602b8ea05bdd67c49657f40..c3bf523d3611468152da7dde89a1e198b224877c 100644 (file)
@@ -261,11 +261,13 @@ class Java2DGraphicsPainter implements GraphicsPainter {
             closePath();
             getG2D().fill(currentPath);
             currentPath = null;
+            break;
 
         case Constants.EN_NONE:
             // No rule is drawn
             break;
         default:
+            break;
         } // end switch
         restoreGraphicsState();
     }
index ec837c65c8a295380851ecd2a51f921810189239..75957c396494a27fcba0f7c6513c1c943e9956c4 100644 (file)
@@ -893,11 +893,13 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
             closePath();
             state.getGraph().fill(currentPath);
             currentPath = null;
+            break;
 
         case EN_NONE:
             // No rule is drawn
             break;
         default:
+            break;
         } // end switch
 
         super.renderLeader(area);
index 7b3878627b1e8ad86bc82326e1d223409af84062..05045b7e7f5d4ce56cfdf8298b623437f026760d 100644 (file)
@@ -715,6 +715,7 @@ public class PCLGenerator {
         boolean monochrome = isMonochromeImage(img);
         if (!monochrome) {
             //Transparency mask disabled. Doesn't work reliably
+            /*
             final boolean transparencyDisabled = true;
             RenderedImage mask = (transparencyDisabled ? null : getMask(img, effDim));
             if (mask != null) {
@@ -724,11 +725,12 @@ public class PCLGenerator {
                 paintMonochromeBitmap(mask, effResolution);
                 popCursorPos();
             }
+            */
 
             RenderedImage red = BitmapImageUtil.convertToMonochrome(
                     img, effDim, this.ditheringQuality);
             selectCurrentPattern(0, 0); //Solid black
-            setTransparencyMode(sourceTransparency || mask != null, true);
+            setTransparencyMode(sourceTransparency /*|| mask != null*/, true);
             paintMonochromeBitmap(red, effResolution);
         } else {
             RenderedImage effImg = img;
index a71fe94177f5cff1b7bcf3291145082c59ed6bcf..13d61dc3529ae13677e7e4bbcf2c0bb96313e246 100644 (file)
@@ -101,7 +101,6 @@ public class PDFImageHandlerSVG implements ImageHandler {
         GraphicsNode root;
         try {
             root = builder.build(ctx, clonedDoc);
-            builder = null;
         } catch (Exception e) {
             SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
                     context.getUserAgent().getEventBroadcaster());
index b9784d69c46c7af98544c3b64458cd699b7e4fbf..d487d32791f2176a31541072d65ce4b7f515b338 100644 (file)
@@ -147,7 +147,7 @@ public class NativeTextHandler implements PSTextHandler {
         final int l = text.length();
         for (int i = 0; i < l; i++) {
             final char ch = text.charAt(i);
-            final char mch = this.font.mapChar(ch);
+            final char mch = font.mapChar(ch);
             PSGenerator.escapeChar(mch, target);
         }
     }
@@ -157,13 +157,13 @@ public class NativeTextHandler implements PSTextHandler {
     }
 
     private void establishCurrentFont() throws IOException {
-        if ((currentFontName != this.font.getFontName())
-                || (currentFontSize != this.font.getFontSize())) {
+        if (!currentFontName.equals(font.getFontName())
+                || (currentFontSize != font.getFontSize())) {
             PSGenerator gen = getPSGenerator();
-            gen.writeln("/" + this.font.getFontTriplet().getName() + " "
+            gen.writeln("/" + font.getFontTriplet().getName() + " "
                     + gen.formatDouble(font.getFontSize() / 1000f) + " F");
-            currentFontName = this.font.getFontName();
-            currentFontSize = this.font.getFontSize();
+            currentFontName = font.getFontName();
+            currentFontSize = font.getFontSize();
         }
     }
 
index be479ec31f973b32032102cf806228194afb3315..6d277f2f0054c5612b18840622a6495d03388bd8 100644 (file)
@@ -138,8 +138,6 @@ public class PSImageHandlerSVG implements ImageHandler {
             float sx = pos.width / w;
             float sy = pos.height / h;
 
-            ctx = null;
-
             gen.commentln("%FOPBeginSVG");
             gen.saveGraphicsState();
             final boolean clip = false;
index d6c47d84cf9f01e0f5d612529c7f93f5d8ce6e79..5e3fa1ca54338a53118cd9355cb0f5cd35066a08 100644 (file)
@@ -278,8 +278,6 @@ public class PSSVGHandler extends AbstractGenericSVGHandler
         float sx = psInfo.getWidth() / w;
         float sy = psInfo.getHeight() / h;
 
-        ctx = null;
-
         try {
             gen.commentln("%FOPBeginSVG");
             gen.saveGraphicsState();
index eeb1aff066ef123a2730a171ad9608be7e3dcd5f..d9892ad83628cfcd72975964ad72745d487bd120 100644 (file)
@@ -1101,7 +1101,7 @@ public class RTFHandler extends FOEventHandler {
         } catch (ImageException ie) {
             ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
                     getUserAgent().getEventBroadcaster());
-            eventProducer.imageError(this, (info != null ? info.toString() : uri), ie, null);
+            eventProducer.imageError(this, uri, ie, null);
         } catch (FileNotFoundException fe) {
             ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
                     getUserAgent().getEventBroadcaster());
index 617ad2abcd9e332ac19315ac7b8421c9d2936fd1..4dfcd5becbee94638d97c446df95da5f972c08e2 100644 (file)
@@ -37,8 +37,6 @@ import java.io.Writer;
 public class RtfPageArea
 extends RtfContainer {
     private RtfPage currentPage;
-    private RtfNull nullChild;
-    private RtfAttributes childAttributes;
 
     /** Create an RTF element as a child of given container */
     RtfPageArea(RtfFile f, Writer w) throws IOException {
index b0391e7cc4463964ee94da640601ce587d5fd1bf..5a1615541943b5e63a4cb32e795222b77f717a9c 100644 (file)
@@ -331,8 +331,8 @@ public class RtfTextrun extends RtfContainer {
      * @throws IOException for I/O problems
      */
     public void addBookmark(String id) throws IOException {
-       if (id != "") {
-            // if id is not empty, add boormark
+       if (id.length() > 0) {
+            // if id is not empty, add bookmark
            new RtfBookmark(this, writer, id);
        }
     }
index 8591babe281904cd41692ca23e55bce5b684eaab..2c307869e661c9868cb8062ff68d05aeb454b719 100644 (file)
@@ -42,14 +42,13 @@ public class FileCompare {
     private String referenceDirectory;
     private String testDirectory;
     private String[] filenameList;
-    private String filenames;
 
     /**
      * Sets directory for test files.
      * @param testDirectory the test directory
      */
     public void setTestDirectory(String testDirectory) {
-        if (!(testDirectory.endsWith("/") | testDirectory.endsWith("\\"))) {
+        if (!(testDirectory.endsWith("/") || testDirectory.endsWith("\\"))) {
             testDirectory += File.separator;
         }
         this.testDirectory = testDirectory;
@@ -61,7 +60,7 @@ public class FileCompare {
      */
     public void setReferenceDirectory(String referenceDirectory) {
         if (!(referenceDirectory.endsWith("/")
-                | referenceDirectory.endsWith("\\"))) {
+                || referenceDirectory.endsWith("\\"))) {
             referenceDirectory += File.separator;
         }
         this.referenceDirectory = referenceDirectory;
index eab3caa56353562cc83029bebfbf7fbdaa93bb66..3b3d1324546cd38c9845fef4d2e7b12df590bc22 100644 (file)
@@ -81,7 +81,7 @@ public class FontListSerializer {
         while (iter.hasNext()) {
             Map.Entry entry = (Map.Entry)iter.next();
             String familyName = (String)entry.getKey();
-            if (singleFamily != null && familyName != singleFamily) {
+            if (singleFamily != null && !singleFamily.equals(familyName)) {
                 continue;
             }
             atts.clear();