Author: gadams
Date: Wed Aug  6 19:19:31 2014
New Revision: 1616312

URL: http://svn.apache.org/r1616312
Log:
Fix or suppress 1-instance findbug warnings.

Modified:
    xmlgraphics/fop/trunk/conf/fop.xconf
    xmlgraphics/fop/trunk/findbugs-exclude.xml
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFMFile.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/DestinationComparator.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/print/PageableRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSSVGHandler.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java

Modified: xmlgraphics/fop/trunk/conf/fop.xconf
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/conf/fop.xconf?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/conf/fop.xconf (original)
+++ xmlgraphics/fop/trunk/conf/fop.xconf Wed Aug  6 19:19:31 2014
@@ -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>
-

Modified: xmlgraphics/fop/trunk/findbugs-exclude.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/findbugs-exclude.xml?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/trunk/findbugs-exclude.xml Wed Aug  6 19:19:31 2014
@@ -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>

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java 
Wed Aug  6 19:19:31 2014
@@ -164,7 +164,7 @@ public class CommandLineOptions {
         try {
             optionsParsed = parseOptions(args);
             if (optionsParsed) {
-                if (showConfiguration == Boolean.TRUE) {
+                if (showConfiguration.equals(Boolean.TRUE)) {
                     dumpConfiguration();
                 }
                 checkSettings();

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java Wed 
Aug  6 19:19:31 2014
@@ -343,6 +343,7 @@ public final class FOPropertyMapping imp
             addSubpropMakerName("precedence", CP_PRECEDENCE);
         }
 
+        // SuppressFBWarnings("MS_EXPOSE_REP")
         return generics;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java Wed Aug  
6 19:19:31 2014
@@ -52,9 +52,17 @@ import org.apache.fop.fo.properties.Prop
  */
 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 {

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java 
Wed Aug  6 19:19:31 2014
@@ -130,9 +130,6 @@ public class SVGElement extends SVGObj {
             public float getFontSize() {
                 return 12;
             }
-
-            public void deselectAll() {
-            }
         };
         SVGOMElement e = (SVGOMElement)svgRoot;
         e.setSVGContext(dc);

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
 Wed Aug  6 19:19:31 2014
@@ -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;

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
 Wed Aug  6 19:19:31 2014
@@ -74,11 +74,12 @@ public class ToBeImplementedProperty ext
 
     @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;
     }
 }
 

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
 Wed Aug  6 19:19:31 2014
@@ -128,7 +128,9 @@ public class AbstractCodePointMapping im
         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) {

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java 
Wed Aug  6 19:19:31 2014
@@ -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 {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFMFile.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFMFile.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFMFile.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFMFile.java Wed 
Aug  6 19:19:31 2014
@@ -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"

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java 
Wed Aug  6 19:19:31 2014
@@ -641,24 +641,44 @@ public class HyphenationTree extends Ter
                     + "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 Ter
                 }
             } 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 Ter
                 }
             } 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 Ter
                     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;

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java 
Wed Aug  6 19:19:31 2014
@@ -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
         }
 

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java 
Wed Aug  6 19:19:31 2014
@@ -589,7 +589,7 @@ public class TernaryTree implements Clon
 
         /** @return next element */
         public Object nextElement() {
-            String res = new String(curkey);
+            String res = curkey;
             cur = up();
             run();
             return res;

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
 Wed Aug  6 19:19:31 2014
@@ -318,13 +318,13 @@ public class AlignmentContext implements
             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

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/DestinationComparator.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/DestinationComparator.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/DestinationComparator.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/DestinationComparator.java 
Wed Aug  6 19:19:31 2014
@@ -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) {

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
 Wed Aug  6 19:19:31 2014
@@ -57,6 +57,7 @@ public class IFGraphicContext extends Gr
      * {@inheritDoc}
      */
     public Object clone() {
+        // FBOFF: CN_IDIOM_NO_SUPER_CALL
         return new IFGraphicContext(this);
     }
 

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java 
Wed Aug  6 19:19:31 2014
@@ -216,9 +216,6 @@ public abstract class Java2DRenderer ext
         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 */

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/print/PageableRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/print/PageableRenderer.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/print/PageableRenderer.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/print/PageableRenderer.java
 Wed Aug  6 19:19:31 2014
@@ -109,7 +109,7 @@ public class PageableRenderer extends Ja
         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;
         }
     }

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSSVGHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSSVGHandler.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSSVGHandler.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSSVGHandler.java 
Wed Aug  6 19:19:31 2014
@@ -219,18 +219,16 @@ public class PSSVGHandler extends Abstra
      * @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);

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
 Wed Aug  6 19:19:31 2014
@@ -113,7 +113,12 @@ public class RtfExtraRowSet extends RtfC
         }
 
         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;
+            }
         }
     }
 

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java
 Wed Aug  6 19:19:31 2014
@@ -200,7 +200,7 @@ public class RtfLeader extends RtfContai
             // 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, " ");
             }
 

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java 
Wed Aug  6 19:19:31 2014
@@ -95,10 +95,29 @@ public class FontSpec implements Compara
         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;
+        }
     }
 
 }

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java?rev=1616312&r1=1616311&r2=1616312&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java
 Wed Aug  6 19:19:31 2014
@@ -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) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to