import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
+import java.util.Locale;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
File destinationPathFile = new File(destinationPath);
destinationPathFile.mkdirs();
String destinationFilepath = destinationPath + "/" + recordName + suffix + ".java";
- transform(file, new File(destinationFilepath), new File(recordStyleDir + "/" + extendstg.toLowerCase() + ".xsl"));
+ transform(file, new File(destinationFilepath),
+ new File(recordStyleDir + "/" + extendstg.toLowerCase(Locale.ROOT) + ".xsl"));
System.out.println("Generated " + suffix + ": " + destinationFilepath);
// Generate test (if not already generated)
destinationPathFile.mkdirs();
destinationFilepath = destinationPath + "/Test" + recordName + suffix + ".java";
if (new File(destinationFilepath).exists() == false) {
- String temp = (recordStyleDir + "/" + extendstg.toLowerCase() + "_test.xsl");
+ String temp = (recordStyleDir + "/" + extendstg.toLowerCase(Locale.ROOT) + "_test.xsl");
transform(file, new File(destinationFilepath), new File(temp));
System.out.println("Generated test: " + destinationFilepath);
} else {
import java.util.Formatter;
import java.util.List;
import java.util.ListIterator;
+import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
if (topmost != null)
throw new IllegalArgumentException(
"Duplicate '[' times in format");
- part = part.toLowerCase();
+ part = part.toLowerCase(Locale.ROOT);
int specLen = part.length() - 2;
topmost = assignSpec(part.charAt(1), pos, specLen);
return part.substring(1, 1 + specLen);
case 'm':
case 's':
case '0':
- part = part.toLowerCase();
+ part = part.toLowerCase(Locale.ROOT);
assignSpec(part.charAt(0), pos, part.length());
return part;
public void simpleValue(StringBuffer toAppendTo, Object value) {
formatValue(toAppendTo, value);
}
-}
\ No newline at end of file
+}
package org.apache.poi.ss.formula.functions;
+import java.util.Locale;
import java.util.regex.Pattern;
import org.apache.poi.ss.formula.eval.BoolEval;
};
public static final Function LOWER = new SingleArgTextFunc() {
protected ValueEval evaluate(String arg) {
- return new StringEval(arg.toLowerCase());
+ return new StringEval(arg.toLowerCase(Locale.ROOT));
}
};
public static final Function UPPER = new SingleArgTextFunc() {
protected ValueEval evaluate(String arg) {
- return new StringEval(arg.toUpperCase());
+ return new StringEval(arg.toUpperCase(Locale.ROOT));
}
};
protected ValueEval evaluate(String text) {
StringBuilder sb = new StringBuilder();
boolean shouldMakeUppercase = true;
- String lowercaseText = text.toLowerCase();
- String uppercaseText = text.toUpperCase();
+ String lowercaseText = text.toLowerCase(Locale.ROOT);
+ String uppercaseText = text.toUpperCase(Locale.ROOT);
for(int i = 0; i < text.length(); ++i) {
if (shouldMakeUppercase) {
sb.append(uppercaseText.charAt(i));
package org.apache.poi.ss.util;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.ss.usermodel.Cell;
String s = cell.getRichStringCellValue().getString();
boolean foundUnicode = false;
- String lowerCaseStr = s.toLowerCase();
+ String lowerCaseStr = s.toLowerCase(Locale.ROOT);
for (int i = 0; i < unicodeMappings.length; i++) {
UnicodeMapping entry = unicodeMappings[i];
}\r
\r
public static String getPrefixForLocale( Locale locale ) {\r
- String localeString = locale.toString().toLowerCase();\r
+ String localeString = locale.toString().toLowerCase(locale);\r
String result = localePrefixes.get( localeString );\r
if( result == null ) {\r
result = localePrefixes.get( localeString.substring( 0, 2 ) );\r
import java.io.IOException;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
for (POIXMLDocumentPart p : getRelations()) {
if (p instanceof XSLFSlideLayout){
XSLFSlideLayout layout = (XSLFSlideLayout)p;
- _layouts.put(layout.getName().toLowerCase(), layout);
+ _layouts.put(layout.getName().toLowerCase(Locale.ROOT), layout);
}
}
}
* @return the layout found or null on failure
*/
public XSLFSlideLayout getLayout(String name) {
- return getLayouts().get(name.toLowerCase());
+ return getLayouts().get(name.toLowerCase(Locale.ROOT));
}
return null;
}
}
-}
\ No newline at end of file
+}
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.VerticalAlignment;
case ALPHA_LC_PARENT_BOTH:
case ALPHA_LC_PARENT_R:
if(scheme == ListAutoNumber.ALPHA_LC_PARENT_BOTH) out.append('(');
- out.append(valueToAlpha(value).toLowerCase());
+ out.append(valueToAlpha(value).toLowerCase(Locale.ROOT));
out.append(')');
break;
case ALPHA_UC_PARENT_BOTH:
out.append(')');
break;
case ALPHA_LC_PERIOD:
- out.append(valueToAlpha(value).toLowerCase());
+ out.append(valueToAlpha(value).toLowerCase(Locale.ROOT));
out.append('.');
break;
case ALPHA_UC_PERIOD:
case ROMAN_LC_PARENT_BOTH:
case ROMAN_LC_PARENT_R:
if(scheme == ListAutoNumber.ROMAN_LC_PARENT_BOTH) out.append('(');
- out.append(valueToRoman(value).toLowerCase());
+ out.append(valueToRoman(value).toLowerCase(Locale.ROOT));
out.append(')');
break;
case ROMAN_UC_PARENT_BOTH:
out.append(')');
break;
case ROMAN_LC_PERIOD:
- out.append(valueToRoman(value).toLowerCase());
+ out.append(valueToRoman(value).toLowerCase(Locale.ROOT));
out.append('.');
break;
case ROMAN_UC_PERIOD:
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
+import java.util.Locale;
import java.util.TimeZone;
import org.apache.poi.POIOLE2TextExtractor;
// Failing that try via the raw headers
String[] headers = msg.getHeaders();
for(String header: headers) {
- if(header.toLowerCase().startsWith("date:")) {
+ if(header.toLowerCase(Locale.ROOT).startsWith("date:")) {
s.append(
"Date:" +
header.substring(header.indexOf(':')+1) +
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
+import java.util.Locale;
import org.apache.poi.POIDataSamples;
import org.apache.poi.POITestCase;
ppe = new PowerPointExtractor(hslf);
text = ppe.getText();
- assertContains(text.toLowerCase(), "master");
+ assertContains(text.toLowerCase(Locale.ROOT), "master");
assertContains(text, masterText);
}
import java.io.ByteArrayOutputStream;\r
import java.io.IOException;\r
import java.io.InputStream;\r
+import java.util.Locale;\r
\r
import junit.framework.TestCase;\r
import org.apache.poi.POIDataSamples;\r
for ( int p = 0; p < range.numParagraphs(); p++ )\r
{\r
Paragraph paragraph = range.getParagraph( p );\r
- char first = paragraph.text().toLowerCase().charAt( 0 );\r
+ char first = paragraph.text().toLowerCase(Locale.ROOT).charAt( 0 );\r
if ( '1' <= first && first < '4' )\r
{\r
assertTrue( paragraph.isInTable() );\r