Author: kiwiwings
Date: Thu Mar 17 21:52:53 2016
New Revision: 1735507

URL: http://svn.apache.org/viewvc?rev=1735507&view=rev
Log:
sonar fix

Modified:
    poi/trunk/src/java/org/apache/poi/ss/format/CellNumberPartHandler.java

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellNumberPartHandler.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellNumberPartHandler.java?rev=1735507&r1=1735506&r2=1735507&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellNumberPartHandler.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellNumberPartHandler.java Thu 
Mar 17 21:52:53 2016
@@ -49,7 +49,8 @@ public class CellNumberPartHandler imple
             // (1) When parsing the format, remove the sign from after the 'e' 
and
             // put it before the first digit of the exponent.
             if (exponent == null && specials.size() > 0) {
-                specials.add(exponent = new Special('.', pos));
+                exponent = new Special('.', pos);
+                specials.add(exponent);
                 insertSignForExponent = part.charAt(1);
                 return part.substring(0, 1);
             }
@@ -71,8 +72,10 @@ public class CellNumberPartHandler imple
             break;
 
         case '.':
-            if (decimalPoint == null && specials.size() > 0)
-                specials.add(decimalPoint = new Special('.', pos));
+            if (decimalPoint == null && specials.size() > 0) {
+                decimalPoint = new Special('.', pos);
+                specials.add(decimalPoint);
+            }
             break;
 
         case '/':
@@ -81,9 +84,9 @@ public class CellNumberPartHandler imple
                 numerator = previousNumber();
                 // If the first number in the whole format is the numerator, 
the
                 // entire number should be printed as an improper fraction
-                if (numerator == firstDigit(specials))
-                    improperFraction = true;
-                specials.add(slash = new Special('.', pos));
+                improperFraction |= (numerator == firstDigit(specials));
+                slash = new Special('.', pos);
+                specials.add(slash);
             }
             break;
 
@@ -98,10 +101,6 @@ public class CellNumberPartHandler imple
         return part;
     }
 
-    public char getInsertSignForExponent() {
-        return insertSignForExponent;
-    }
-
     public double getScale() {
         return scale;
     }
@@ -135,19 +134,16 @@ public class CellNumberPartHandler imple
         while (it.hasPrevious()) {
             Special s = it.previous();
             if (isDigitFmt(s)) {
-                Special numStart = s;
                 Special last = s;
                 while (it.hasPrevious()) {
                     s = it.previous();
-                    if (last.pos - s.pos > 1) // it has to be continuous digits
-                        break;
-                    if (isDigitFmt(s))
-                        numStart = s;
-                    else
+                    // it has to be continuous digits
+                    if (last.pos - s.pos > 1 || !isDigitFmt(s)) {
                         break;
+                    }
                     last = s;
                 }
-                return numStart;
+                return last;
             }
         }
         return null;
@@ -159,8 +155,9 @@ public class CellNumberPartHandler imple
 
     private static Special firstDigit(List<Special> specials) {
         for (Special s : specials) {
-            if (isDigitFmt(s))
+            if (isDigitFmt(s)) {
                 return s;
+            }
         }
         return null;
     }



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

Reply via email to