poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1700644 - in /poi/trunk/src: examples/src/org/apache/poi/hssf/usermodel/examples/ examples/src/org/apache/poi/ss/examples/ java/org/apache/poi/ss/formula/functions/ java/org/apache/poi/ss/formula/ptg/ ooxml/java/org/apache/poi/openxml4j/op...
Date Tue, 01 Sep 2015 19:06:54 GMT
Author: nick
Date: Tue Sep  1 19:06:53 2015
New Revision: 1700644

URL: http://svn.apache.org/r1700644
Log:
Fix some Forbidden APIs errors

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/Dec2Hex.java
    poi/trunk/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ContentTypes.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java Tue
Sep  1 19:06:53 2015
@@ -20,6 +20,7 @@ package org.apache.poi.hssf.usermodel.ex
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.Locale;
 
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
@@ -198,7 +199,7 @@ public final class HSSFReadWrite {
 					}
 				}
 			} else if (args.length == 2) {
-				if (args[1].toLowerCase().equals("write")) {
+				if (args[1].toLowerCase(Locale.ROOT).equals("write")) {
 					System.out.println("Write mode");
 					long time = System.currentTimeMillis();
 					HSSFReadWrite.testCreateSampleSheet(fileName);
@@ -213,7 +214,7 @@ public final class HSSFReadWrite {
 					wb.write(stream);
 					stream.close();
 				}
-			} else if (args.length == 3 && args[2].toLowerCase().equals("modify1")) {
+			} else if (args.length == 3 && args[2].toLowerCase(Locale.ROOT).equals("modify1"))
{
 				// delete row 0-24, row 74 - 99 && change cell 3 on row 39 to string "MODIFIED
CELL!!"
 
 				HSSFWorkbook wb = HSSFReadWrite.readFile(fileName);

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java Tue Sep
 1 19:06:53 2015
@@ -23,6 +23,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URL;
+import java.util.Locale;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -382,7 +383,7 @@ public class AddDimensionedImage {
         // the image files location is identified by interrogating the URL passed
         // to the method, the images type is identified before it is added to the
         // sheet.
-        String sURL = imageFile.toString().toLowerCase();
+        String sURL = imageFile.toString().toLowerCase(Locale.ROOT);
 	if( sURL.endsWith(".png") ) {
             imageType = Workbook.PICTURE_TYPE_PNG;
 	}
@@ -1043,4 +1044,4 @@ public class AddDimensionedImage {
         	return points / 72D * 25.4;
         }
     }
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/Dec2Hex.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/Dec2Hex.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/Dec2Hex.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/Dec2Hex.java Tue Sep  1 19:06:53
2015
@@ -17,6 +17,8 @@
 
 package org.apache.poi.ss.formula.functions;
 
+import java.util.Locale;
+
 import org.apache.poi.ss.formula.OperationEvaluationContext;
 import org.apache.poi.ss.formula.eval.*;
 
@@ -119,7 +121,7 @@ public final class Dec2Hex extends Var1o
             hex =  "FF"+  hex.substring(2);
         }
 
-        return new StringEval(hex.toUpperCase());
+        return new StringEval(hex.toUpperCase(Locale.ROOT));
     }
 
     public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) {

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java Tue Sep  1 19:06:53
2015
@@ -142,7 +142,7 @@ public abstract class AbstractFunctionPt
      * @return the standard worksheet function index if found, otherwise <tt>FUNCTION_INDEX_EXTERNAL</tt>
      */
     protected static short lookupIndex(String name) {
-        short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase());
+        short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase(Locale.ROOT));
         if (ix < 0) {
             return FUNCTION_INDEX_EXTERNAL;
         }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ContentTypes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ContentTypes.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ContentTypes.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ContentTypes.java Tue Sep  1 19:06:53
2015
@@ -17,6 +17,8 @@
 
 package org.apache.poi.openxml4j.opc;
 
+import java.util.Locale;
+
 /**
  * Open Packaging Convention content types (see Annex F : Standard Namespaces
  * and Content Types).
@@ -110,7 +112,7 @@ public final class ContentTypes {
 
 	public static String getContentTypeFromFileExtension(String filename) {
 		String extension = filename.substring(filename.lastIndexOf(".") + 1)
-				.toLowerCase();
+				.toLowerCase(Locale.ROOT);
 		if (extension.equals(EXTENSION_JPG_1)
 				|| extension.equals(EXTENSION_JPG_2))
 			return IMAGE_JPEG;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartName.java Tue Sep  1
19:06:53 2015
@@ -20,6 +20,7 @@ package org.apache.poi.openxml4j.opc;
 import java.math.BigInteger;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Locale;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
@@ -479,9 +480,9 @@ public final class PackagePartName imple
 	public boolean equals(Object other) {
             if (other instanceof PackagePartName) {
                 // String.equals() is compatible with our compareTo(), but cheaper
-                return this.partNameURI.toASCIIString().toLowerCase().equals
+                return this.partNameURI.toASCIIString().toLowerCase(Locale.ROOT).equals
                 (
-                    ((PackagePartName) other).partNameURI.toASCIIString().toLowerCase()
+                    ((PackagePartName) other).partNameURI.toASCIIString().toLowerCase(Locale.ROOT)
                 );
             } else {
                 return false;
@@ -490,7 +491,7 @@ public final class PackagePartName imple
 
 	@Override
 	public int hashCode() {
-		return this.partNameURI.toASCIIString().toLowerCase().hashCode();
+		return this.partNameURI.toASCIIString().toLowerCase(Locale.ROOT).hashCode();
 	}
 
 	@Override
@@ -543,8 +544,8 @@ public final class PackagePartName imple
 
         return compare
         (
-            obj1.getURI().toASCIIString().toLowerCase(),
-            obj2.getURI().toASCIIString().toLowerCase()
+            obj1.getURI().toASCIIString().toLowerCase(Locale.ROOT),
+            obj2.getURI().toASCIIString().toLowerCase(Locale.ROOT)
         );
     }
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
Tue Sep  1 19:06:53 2015
@@ -20,6 +20,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.TreeMap;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -343,7 +344,7 @@ public final class PackageRelationshipCo
                 Attr targetModeAttr = element.getAttributeNode(PackageRelationship.TARGET_MODE_ATTRIBUTE_NAME);
                 TargetMode targetMode = TargetMode.INTERNAL;
                 if (targetModeAttr != null) {
-                    targetMode = targetModeAttr.getValue().toLowerCase()
+                    targetMode = targetModeAttr.getValue().toLowerCase(Locale.ROOT)
                             .equals("internal") ? TargetMode.INTERNAL
                             : TargetMode.EXTERNAL;
                 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
Tue Sep  1 19:06:53 2015
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Locale;
 import java.util.Map.Entry;
 import java.util.TreeMap;
 
@@ -150,7 +151,7 @@ public abstract class ContentTypeManager
 	 */
 	public void addContentType(PackagePartName partName, String contentType) {
 		boolean defaultCTExists = this.defaultContentType.containsValue(contentType);
-		String extension = partName.getExtension().toLowerCase();
+		String extension = partName.getExtension().toLowerCase(Locale.ROOT);
 		if ((extension.length() == 0)
 				|| (this.defaultContentType.containsKey(extension) && !defaultCTExists))
 			this.addOverrideContentType(partName, contentType);
@@ -184,7 +185,7 @@ public abstract class ContentTypeManager
 	private void addDefaultContentType(String extension, String contentType) {
 		// Remark : Originally the latest parameter was :
 		// contentType.toLowerCase(). Change due to a request ID 1996748.
-		defaultContentType.put(extension.toLowerCase(), contentType);
+		defaultContentType.put(extension.toLowerCase(Locale.ROOT), contentType);
 	}
 
 	/**
@@ -327,7 +328,7 @@ public abstract class ContentTypeManager
 				&& this.overrideContentType.containsKey(partName))
 			return this.overrideContentType.get(partName);
 
-		String extension = partName.getExtension().toLowerCase();
+		String extension = partName.getExtension().toLowerCase(Locale.ROOT);
 		if (this.defaultContentType.containsKey(extension))
 			return this.defaultContentType.get(extension);
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java Tue Sep 
1 19:06:53 2015
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNot
 
 import java.io.FileOutputStream;
 import java.util.LinkedHashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.commons.codec.binary.Hex;
@@ -104,7 +105,7 @@ public class TestThemesTable {
                 ThemeElement themeElem = ThemeElement.byId(expectedThemeIdx);
                 assertEquals(
                         "Wrong theme at " + ref + " in " + whatWorkbook,
-                        themeElem.name.toLowerCase(), cell.getStringCellValue());
+                        themeElem.name.toLowerCase(Locale.ROOT), cell.getStringCellValue());
 
                 // Fonts are theme-based in their colours
                 XSSFFont font = cell.getCellStyle().getFont();
@@ -235,7 +236,8 @@ public class TestThemesTable {
     }
     private static void assertCellContents(String expected, XSSFCell cell) {
         assertNotNull(cell);
-        assertEquals(expected.toLowerCase(), cell.getStringCellValue().toLowerCase());
+        assertEquals(expected.toLowerCase(Locale.ROOT), 
+                     cell.getStringCellValue().toLowerCase(Locale.ROOT));
     }
     
     @Test

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
Tue Sep  1 19:06:53 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.xwpf.extractor;
 
 import java.io.IOException;
+import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -349,7 +350,7 @@ public class TestXWPFWordExtractor exten
                 "endnote_sdt"
         };
         XWPFWordExtractor ex = new XWPFWordExtractor(doc);
-        String s = ex.getText().toLowerCase();
+        String s = ex.getText().toLowerCase(Locale.ROOT);
         int hits = 0;
 
         for (String targ : targs) {
@@ -371,7 +372,7 @@ public class TestXWPFWordExtractor exten
                 "test user\n",
         };
         ex = new XWPFWordExtractor(doc);
-        s = ex.getText().toLowerCase();
+        s = ex.getText().toLowerCase(Locale.ROOT);
 
         //At one point in development there were three copies of the text.
         //This ensures that there is only one copy.

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java?rev=1700644&r1=1700643&r2=1700644&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java Tue Sep  1 19:06:53
2015
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -65,7 +66,7 @@ public abstract class BaseXLSIteratingTe
         String[] files = new File(dir).list(new FilenameFilter() {
             @Override
             public boolean accept(File arg0, String arg1) {
-                return arg1.toLowerCase().endsWith(".xls");
+                return arg1.toLowerCase(Locale.ROOT).endsWith(".xls");
             }
         });
         



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


Mime
View raw message