You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/12/13 10:51:22 UTC

svn commit: r1719778 - in /poi/trunk/src: java/org/apache/poi/ss/usermodel/ resources/devtools/ scratchpad/src/org/apache/poi/hslf/model/textproperties/ testcases/org/apache/poi/hssf/usermodel/

Author: kiwiwings
Date: Sun Dec 13 09:51:22 2015
New Revision: 1719778

URL: http://svn.apache.org/viewvc?rev=1719778&view=rev
Log:
fix forbidden apis issues

Modified:
    poi/trunk/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java
    poi/trunk/src/resources/devtools/forbidden-signatures.txt
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java?rev=1719778&r1=1719777&r2=1719778&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/ExcelGeneralNumberFormat.java Sun Dec 13 09:51:22 2015
@@ -46,7 +46,7 @@ public class ExcelGeneralNumberFormat ex
     private final DecimalFormat scientificFormat;
 
     public ExcelGeneralNumberFormat(final Locale locale) {
-        decimalSymbols = new DecimalFormatSymbols(locale);
+        decimalSymbols = DecimalFormatSymbols.getInstance(locale);
         scientificFormat = new DecimalFormat("0.#####E0", decimalSymbols);
         DataFormatter.setExcelStyleRoundingMode(scientificFormat);
         integerFormat = new DecimalFormat("#", decimalSymbols);

Modified: poi/trunk/src/resources/devtools/forbidden-signatures.txt
URL: http://svn.apache.org/viewvc/poi/trunk/src/resources/devtools/forbidden-signatures.txt?rev=1719778&r1=1719777&r2=1719778&view=diff
==============================================================================
--- poi/trunk/src/resources/devtools/forbidden-signatures.txt (original)
+++ poi/trunk/src/resources/devtools/forbidden-signatures.txt Sun Dec 13 09:51:22 2015
@@ -30,8 +30,8 @@ java.util.Date#toString() @ Do not use m
 java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean) @ Reflection usage fails with SecurityManagers and likely will not work any more in Java 9
 java.lang.reflect.AccessibleObject#setAccessible(boolean) @ Reflection usage fails with SecurityManagers and likely will not work any more in Java 9
 
-java.text.DecimalFormatSymbols#DecimalFormatSymbols() @ use DecimalFormatSymbols.getInstance()
-java.text.DecimalFormatSymbols#DecimalFormatSymbols(Locale) @ use DecimalFormatSymbols.getInstance()
+java.text.DecimalFormatSymbols#<init>() @ use DecimalFormatSymbols.getInstance()
+java.text.DecimalFormatSymbols#<init>(java.util.Locale) @ use DecimalFormatSymbols.getInstance()
 
 # the following are taken from the Elasticsearch source at https://github.com/elastic/elasticsearch/tree/master/buildSrc/src/main/resources/forbidden
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java?rev=1719778&r1=1719777&r2=1719778&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextProp.java Sun Dec 13 09:51:22 2015
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hslf.model.textproperties;
 
+import java.util.Locale;
+
 /** 
  * Definition of a property of some text, or its paragraph. Defines 
  * how to find out if it's present (via the mask on the paragraph or 
@@ -111,16 +113,32 @@ public class TextProp implements Cloneab
 
 	@Override
     public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
         TextProp other = (TextProp) obj;
-        if (dataValue != other.dataValue) return false;
-        if (maskInHeader != other.maskInHeader) return false;
+        if (dataValue != other.dataValue) {
+            return false;
+        }
+        if (maskInHeader != other.maskInHeader) {
+            return false;
+        }
         if (propName == null) {
-            if (other.propName != null) return false;
-        } else if (!propName.equals(other.propName)) return false;
-        if (sizeOfDataBlock != other.sizeOfDataBlock) return false;
+            if (other.propName != null) {
+                return false;
+            }
+        } else if (!propName.equals(other.propName)) {
+            return false;
+        }
+        if (sizeOfDataBlock != other.sizeOfDataBlock) {
+            return false;
+        }
         return true;
     }
     
@@ -132,6 +150,6 @@ public class TextProp implements Cloneab
         case 2: len = 6; break;
         default: len = 10; break;
         }
-        return String.format("%s = %d (%0#"+len+"X mask / %d bytes)", propName, dataValue, maskInHeader, sizeOfDataBlock);
+        return String.format(Locale.ROOT, "%s = %d (%0#"+len+"X mask / %d bytes)", propName, dataValue, maskInHeader, sizeOfDataBlock);
     }
 }
\ No newline at end of file

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java?rev=1719778&r1=1719777&r2=1719778&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java Sun Dec 13 09:51:22 2015
@@ -290,7 +290,7 @@ public final class TestHSSFDataFormatter
             HSSFCell cell = (HSSFCell) it.next();
             log(formatter.formatCellValue(cell));
             // in some locales the the decimal delimiter is a comma, not a dot
-            char decimalSeparator = new DecimalFormatSymbols(LocaleUtil.getUserLocale()).getDecimalSeparator();
+            char decimalSeparator = DecimalFormatSymbols.getInstance(LocaleUtil.getUserLocale()).getDecimalSeparator();
             assertEquals("12345678" + decimalSeparator + "9", formatter.formatCellValue(cell));
         }
 
@@ -336,7 +336,7 @@ public final class TestHSSFDataFormatter
         // now with a formula evaluator
         HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
         log(formatter.formatCellValue(cell, evaluator) + "\t\t\t (with evaluator)");
-        char decimalSeparator = new DecimalFormatSymbols(LocaleUtil.getUserLocale()).getDecimalSeparator();
+        char decimalSeparator = DecimalFormatSymbols.getInstance(LocaleUtil.getUserLocale()).getDecimalSeparator();
         assertEquals("24" + decimalSeparator + "50%", formatter.formatCellValue(cell,evaluator));
 
     }



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