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;
}
}
} 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);
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);
import java.io.FileOutputStream;\r
import java.io.IOException;\r
import java.net.URL;\r
+import java.util.Locale;\r
\r
import org.apache.poi.hssf.usermodel.HSSFWorkbook;\r
import org.apache.poi.hssf.usermodel.HSSFSheet;\r
// the image files location is identified by interrogating the URL passed\r
// to the method, the images type is identified before it is added to the\r
// sheet.\r
- String sURL = imageFile.toString().toLowerCase();\r
+ String sURL = imageFile.toString().toLowerCase(Locale.ROOT);\r
if( sURL.endsWith(".png") ) {\r
imageType = Workbook.PICTURE_TYPE_PNG;\r
}\r
return points / 72D * 25.4;\r
}\r
}\r
-}
\ No newline at end of file
+}\r
\r
package org.apache.poi.ss.formula.functions;\r
\r
+import java.util.Locale;\r
+\r
import org.apache.poi.ss.formula.OperationEvaluationContext;\r
import org.apache.poi.ss.formula.eval.*;\r
\r
hex = "FF"+ hex.substring(2);\r
}\r
\r
- return new StringEval(hex.toUpperCase());\r
+ return new StringEval(hex.toUpperCase(Locale.ROOT));\r
}\r
\r
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) {\r
* @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;
}
package org.apache.poi.openxml4j.opc;
+import java.util.Locale;
+
/**
* Open Packaging Convention content types (see Annex F : Standard Namespaces
* and Content Types).
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;
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;
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;
@Override
public int hashCode() {
- return this.partNameURI.toASCIIString().toLowerCase().hashCode();
+ return this.partNameURI.toASCIIString().toLowerCase(Locale.ROOT).hashCode();
}
@Override
return compare
(
- obj1.getURI().toASCIIString().toLowerCase(),
- obj2.getURI().toASCIIString().toLowerCase()
+ obj1.getURI().toASCIIString().toLowerCase(Locale.ROOT),
+ obj2.getURI().toASCIIString().toLowerCase(Locale.ROOT)
);
}
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;
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;
}
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;
*/
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);
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);
}
/**
&& 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);
\r
import java.io.FileOutputStream;\r
import java.util.LinkedHashMap;\r
+import java.util.Locale;\r
import java.util.Map;\r
\r
import org.apache.commons.codec.binary.Hex;\r
ThemeElement themeElem = ThemeElement.byId(expectedThemeIdx);\r
assertEquals(\r
"Wrong theme at " + ref + " in " + whatWorkbook,\r
- themeElem.name.toLowerCase(), cell.getStringCellValue());\r
+ themeElem.name.toLowerCase(Locale.ROOT), cell.getStringCellValue());\r
\r
// Fonts are theme-based in their colours\r
XSSFFont font = cell.getCellStyle().getFont();\r
}\r
private static void assertCellContents(String expected, XSSFCell cell) {\r
assertNotNull(cell);\r
- assertEquals(expected.toLowerCase(), cell.getStringCellValue().toLowerCase());\r
+ assertEquals(expected.toLowerCase(Locale.ROOT), \r
+ cell.getStringCellValue().toLowerCase(Locale.ROOT));\r
}\r
\r
@Test\r
package org.apache.poi.xwpf.extractor;
import java.io.IOException;
+import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
"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) {
"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.
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;
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");
}
});