You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2018/09/29 09:33:52 UTC

svn commit: r1842302 - in /poi/trunk/src: examples/src/org/apache/poi/hssf/view/ java/org/apache/poi/ddf/ java/org/apache/poi/ss/formula/ scratchpad/src/org/apache/poi/hslf/record/

Author: fanningpj
Date: Sat Sep 29 09:33:52 2018
New Revision: 1842302

URL: http://svn.apache.org/viewvc?rev=1842302&view=rev
Log:
lgtm issues

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVBorder.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java
    poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVBorder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVBorder.java?rev=1842302&r1=1842301&r2=1842302&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVBorder.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVBorder.java Sat Sep 29 09:33:52 2018
@@ -348,14 +348,16 @@ public void paintBorder(Component c, Gra
 
                 // if there are borders on the west or east then
                 // the second line shouldn't cross them
-        if (westBorder)
-           leftx = x+3;
+        if (westBorder) {
+            leftx = x + 3;
+        }
+
+        if (eastBorder) {
+            rightx = width - 3;
+        }
 
-        if (eastBorder)
-           rightx = width-3;
-
-           g.drawLine(x,y,width,y);
-           g.drawLine(leftx,y+2,rightx,y+2);
+        g.drawLine(x,y,width,y);
+        g.drawLine(leftx,y+2,rightx,y+2);
       }
 
       if (eastBorder &&
@@ -370,11 +372,13 @@ public void paintBorder(Component c, Gra
         int topy=y;
         int bottomy=height;
 
-        if (northBorder)
-          topy=y+3;
-
-        if (southBorder)
-            bottomy=height-3;
+        if (northBorder) {
+            topy = y + 3;
+        }
+
+        if (southBorder) {
+            bottomy = height - 3;
+        }
 
         g.drawLine(width-1,y,width-1,height);
         g.drawLine(width-3,topy,width-3,bottomy);

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java?rev=1842302&r1=1842301&r2=1842302&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java Sat Sep 29 09:33:52 2018
@@ -336,7 +336,7 @@ public abstract class EscherRecord imple
                 String tagName = capitalizeAndTrim((String)attrs[0]);
                 boolean hasValue = false;
                 boolean lastChildComplex = false;
-                for (int i=0; i<attrs.length; i+=2) {
+                for (int i=0; i<attrs.length-1; i+=2) {
                     Object value = attrs[i+1];
                     if (value == null) {
                         // ignore null values
@@ -384,7 +384,7 @@ public abstract class EscherRecord imple
         if (attrList != null && attrList.length > 0) {
             String childTab = "  ";
             for (Object[] attrs : attrList) {
-                for (int i=0; i<attrs.length; i+=2) {
+                for (int i=0; i<attrs.length-1; i+=2) {
                     Object value = attrs[i+1];
                     if (value == null) {
                         // ignore null values

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java?rev=1842302&r1=1842301&r2=1842302&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java Sat Sep 29 09:33:52 2018
@@ -21,15 +21,7 @@ import java.text.CollationKey;
 import java.text.Collator;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import org.apache.poi.ss.formula.eval.BlankEval;
 import org.apache.poi.ss.formula.eval.BoolEval;
@@ -900,9 +892,9 @@ public class EvaluationConditionalFormat
                 return false;
             }
             ValueAndFormat o = (ValueAndFormat) obj;
-            return ( value == o.value || value.equals(o.value))
-                    && ( format == o.format || format.equals(o.format))
-                    && (string == o.string || string.equals(o.string));
+            return (Objects.equals(value, o.value)
+                    && Objects.equals(format, o.format)
+                    && Objects.equals(string, o.string));
         }
         
         /**

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java?rev=1842302&r1=1842301&r2=1842302&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java Sat Sep 29 09:33:52 2018
@@ -382,9 +382,6 @@ public final class FormulaParser {
         if (token instanceof OperandPtg) {
             return false;
         }
-        if (token instanceof OperationPtg) {
-            return true;
-        }
 
         return false;
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java?rev=1842302&r1=1842301&r2=1842302&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java Sat Sep 29 09:33:52 2018
@@ -187,7 +187,7 @@ public class TextSpecInfoRun {
             smartTagFld, smartTagsBytes, "smart tags"
         };
         
-        for (int i=0; i<flds.length; i+=3) {
+        for (int i=0; i<flds.length-1; i+=3) {
             BitField fld = (BitField)flds[i+0];
             Object valO = flds[i+1];
             if (!fld.isSet(mask)) continue;
@@ -210,7 +210,8 @@ public class TextSpecInfoRun {
                 valid = false;
             }
             if (!valid) {
-                throw new IOException(flds[i+2]+" is activated, but its value is invalid");
+                Object fval = (i + 2) < flds.length ? flds[i + 2] : null;
+                throw new IOException(fval + " is activated, but its value is invalid");
             }
         }
     }        



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