poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1568861 - in /poi/trunk/src: java/org/apache/poi/hssf/record/ java/org/apache/poi/poifs/filesystem/ java/org/apache/poi/ss/format/ resources/devtools/ scratchpad/src/org/apache/poi/hwpf/model/
Date Sun, 16 Feb 2014 23:36:33 GMT
Author: kiwiwings
Date: Sun Feb 16 23:36:32 2014
New Revision: 1568861

URL: http://svn.apache.org/r1568861
Log:
FindBugs fix
- fixed "Equals method should not assume anything about the type of its argument"
- see http://findbugs.sourceforge.net/bugDescriptions.html#BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
    poi/trunk/src/resources/devtools/findbugs-filters.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java Sun Feb 16 23:36:32
2014
@@ -83,9 +83,8 @@ public final class HyperlinkRecord exten
 
 		@Override
 		public boolean equals(Object obj) {
+            if (!(obj instanceof GUID)) return false;
 			GUID other = (GUID) obj;
-            if (obj == null || !(obj instanceof GUID))
-                return false;
 			return _d1 == other._d1 && _d2 == other._d2
 			    && _d3 == other._d3 && _d4 == other._d4;
 		}

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java Sun Feb 16 23:36:32
2014
@@ -98,7 +98,8 @@ public class Ole10Native {
        DocumentEntry nativeEntry = 
           (DocumentEntry)directory.getEntry(OLE10_NATIVE);
        byte[] data = new byte[nativeEntry.getSize()];
-       directory.createDocumentInputStream(nativeEntry).read(data);
+       int readBytes = directory.createDocumentInputStream(nativeEntry).read(data);
+       assert(readBytes == data.length);
   
        return new Ole10Native(data, 0);
     }

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java Sun Feb 16 23:36:32
2014
@@ -16,8 +16,6 @@
 ==================================================================== */
 package org.apache.poi.ss.format;
 
-import org.apache.poi.ss.format.CellFormatPart.PartHandler;
-
 import java.text.DecimalFormat;
 import java.text.FieldPosition;
 import java.util.BitSet;
@@ -31,6 +29,8 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.regex.Matcher;
 
+import org.apache.poi.ss.format.CellFormatPart.PartHandler;
+
 /**
  * This class implements printing out a value using a number format.
  *
@@ -658,7 +658,7 @@ public class CellNumberFormatter extends
                             delEndPos + adjust; // delete end point in current
 
                     if (modPos < modEndPos) {
-                        if (nextChange.toAdd == "")
+                        if ("".equals(nextChange.toAdd))
                             output.delete(modPos, modEndPos);
                         else {
                             char fillCh = nextChange.toAdd.charAt(0);

Modified: poi/trunk/src/resources/devtools/findbugs-filters.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/resources/devtools/findbugs-filters.xml?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/resources/devtools/findbugs-filters.xml (original)
+++ poi/trunk/src/resources/devtools/findbugs-filters.xml Sun Feb 16 23:36:32 2014
@@ -19,6 +19,6 @@
 -->
 <FindBugsFilter>
 	<Match>
-		<Bug pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE,MS_PKGPROTECT,MS_MUTABLE_ARRAY"/>
+		<Bug code="EI,EI2" pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE,MS_PKGPROTECT,MS_MUTABLE_ARRAY"/>
 	</Match>
 </FindBugsFilter>
\ No newline at end of file

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java Sun
Feb 16 23:36:32 2014
@@ -44,10 +44,7 @@ public final class ListFormatOverrideLev
 
     public boolean equals( Object obj )
     {
-        if ( obj == null )
-        {
-            return false;
-        }
+        if (!(obj instanceof ListFormatOverrideLevel)) return false;
         ListFormatOverrideLevel lfolvl = (ListFormatOverrideLevel) obj;
         boolean lvlEquality = false;
         if ( _lvl != null )

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java Sun Feb 16 23:36:32
2014
@@ -104,8 +104,7 @@ public final class ListLevel
     @Override
     public boolean equals( Object obj )
     {
-        if ( obj == null )
-            return false;
+        if (!(obj instanceof ListLevel)) return false;
 
         ListLevel lvl = (ListLevel) obj;
         return lvl._lvlf.equals( this._lvlf )

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java?rev=1568861&r1=1568860&r2=1568861&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java Sun Feb 16 23:36:32 2014
@@ -67,6 +67,7 @@ public final class SEPX extends Property
     @Override
     public boolean equals( Object o )
     {
+        if (!(o instanceof SEPX)) return false;
         SEPX sepx = (SEPX) o;
         if ( super.equals( o ) )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message