import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.util.Locale;
import org.apache.poi.hpsf.ClassID;
-
-
/**
* <p>Provides utility methods for encoding and decoding hexadecimal
* data.</p>
("String has odd length " + length);
byte[] b = new byte[length / 2];
char[] c = new char[length];
- s.toUpperCase().getChars(0, length, c, 0);
+ s.toUpperCase(Locale.ROOT).getChars(0, length, c, 0);
for (int i = 0; i < length; i += 2)
b[i/2] = (byte) (decodeNibble(c[i]) << 4 & 0xF0 |
decodeNibble(c[i+1]) & 0x0F);
import java.io.FileOutputStream;\r
import java.io.IOException;\r
import java.util.HashMap;\r
+import java.util.Locale;\r
import java.util.Map;\r
\r
/**\r
}\r
\r
public FreeRefFunction findFunction(String name) {\r
- return _functionsByName.get(name.toUpperCase());\r
+ return _functionsByName.get(name.toUpperCase(Locale.ROOT));\r
}\r
\r
}\r
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.regex.Pattern;
import org.apache.poi.ss.SpreadsheetVersion;
* (b) LOG10 + 1
* In (a) LOG10 is a name of a built-in function. In (b) LOG10 is a cell reference
*/
- boolean isFunc = FunctionMetadataRegistry.getFunctionByName(str.toUpperCase()) != null;
+ boolean isFunc = FunctionMetadataRegistry.getFunctionByName(str.toUpperCase(Locale.ROOT)) != null;
if(isFunc){
int savePointer = _pointer;
resetPointer(_pointer + str.length());
*/
private ParseNode getFunction(String name, Ptg namePtg, ParseNode[] args) {
- FunctionMetadata fm = FunctionMetadataRegistry.getFunctionByName(name.toUpperCase());
+ FunctionMetadata fm = FunctionMetadataRegistry.getFunctionByName(name.toUpperCase(Locale.ROOT));
int numArgs = args.length;
if(fm == null) {
if (namePtg == null) {
private int parseErrorLiteral() {
Match('#');
- String part1 = parseUnquotedIdentifier().toUpperCase();
+ String part1 = parseUnquotedIdentifier().toUpperCase(Locale.ROOT);
if (part1 == null) {
throw expected("remainder of error constant literal");
}
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.TreeSet;
// if you save such a .xlsx workbook as .xls
if(name.startsWith("_xlfn.")) name = name.substring(6);
- return _functionsByName.get(name.toUpperCase());
+ return _functionsByName.get(name.toUpperCase(Locale.ROOT));
}
private Map<String, FreeRefFunction> createFunctionsMap() {
if (_isCaseSensitive) {
result = haystack.indexOf(needle, startIndex);
} else {
- result = haystack.toUpperCase().indexOf(needle.toUpperCase(), startIndex);
+ result = haystack.toUpperCase(Locale.ROOT)
+ .indexOf(needle.toUpperCase(Locale.ROOT), startIndex);
}
if (result == -1) {
return ErrorEval.VALUE_INVALID;
package org.apache.poi.ss.formula.udf;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
}
HashMap<String, FreeRefFunction> m = new HashMap<String, FreeRefFunction>(nFuncs * 3 / 2);
for (int i = 0; i < functionImpls.length; i++) {
- m.put(functionNames[i].toUpperCase(), functionImpls[i]);
+ m.put(functionNames[i].toUpperCase(Locale.ROOT), functionImpls[i]);
}
_functionsByName = m;
}
public FreeRefFunction findFunction(String name) {
- return _functionsByName.get(name.toUpperCase());
+ return _functionsByName.get(name.toUpperCase(Locale.ROOT));
}
}
\r
import java.security.SecureRandom;\r
import java.util.Arrays;\r
+import java.util.Locale;\r
\r
import javax.xml.bind.DatatypeConverter;\r
import javax.xml.namespace.QName;\r
cur.toFirstContentToken();\r
if (hashAlgo == null) {\r
int hash = CryptoFunctions.createXorVerifier1(password);\r
- cur.insertAttributeWithValue(getAttrName(prefix, "password"), Integer.toHexString(hash).toUpperCase());\r
+ cur.insertAttributeWithValue(getAttrName(prefix, "password"), \r
+ Integer.toHexString(hash).toUpperCase(Locale.ROOT));\r
} else {\r
SecureRandom random = new SecureRandom(); \r
byte salt[] = random.generateSeed(16);\r
package org.apache.poi.hdf.extractor.util;
+import java.util.Locale;
/**
- * Comment me
- *
- * @author Ryan Ackley
+ * TODO Comment me
*/
@Deprecated
public final class NumberFormatter
case ARABIC:
return _arabic[num - 1];
case UPPER_ROMAN:
- return _roman[num-1].toUpperCase();
+ return _roman[num-1].toUpperCase(Locale.ROOT);
case LOWER_ROMAN:
return _roman[num-1];
case UPPER_LETTER:
- return _letter[num-1].toUpperCase();
+ return _letter[num-1].toUpperCase(Locale.ROOT);
case LOWER_LETTER:
return _letter[num-1];
case ORDINAL:
package org.apache.poi.hdf.model.util;
+import java.util.Locale;
/**
- * Comment me
- *
- * @author Ryan Ackley
+ * TODO Comment me
*/
@Deprecated
public final class NumberFormatter
case ARABIC:
return _arabic[num - 1];
case UPPER_ROMAN:
- return _roman[num-1].toUpperCase();
+ return _roman[num-1].toUpperCase(Locale.ROOT);
case LOWER_ROMAN:
return _roman[num-1];
case UPPER_LETTER:
- return _letter[num-1].toUpperCase();
+ return _letter[num-1].toUpperCase(Locale.ROOT);
case LOWER_LETTER:
return _letter[num-1];
case ORDINAL:
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Locale;
import org.apache.poi.ddf.DefaultEscherRecordFactory;
import org.apache.poi.ddf.EscherContainerRecord;
}
public String makeHex(short s) {
- String hex = Integer.toHexString(s).toUpperCase();
+ String hex = Integer.toHexString(s).toUpperCase(Locale.ROOT);
if(hex.length() == 1) { return "0" + hex; }
return hex;
}
public String makeHex(int i) {
- String hex = Integer.toHexString(i).toUpperCase();
+ String hex = Integer.toHexString(i).toUpperCase(Locale.ROOT);
if(hex.length() == 1) { return "000" + hex; }
if(hex.length() == 2) { return "00" + hex; }
if(hex.length() == 3) { return "0" + hex; }
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Iterator;
+import java.util.Locale;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.util.HexDump;
}
public String makeHex(int number, int padding) {
- String hex = Integer.toHexString(number).toUpperCase();
+ String hex = Integer.toHexString(number).toUpperCase(Locale.ROOT);
while(hex.length() < padding) {
hex = "0" + hex;
}
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Locale;
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
String chunkId = Integer.toHexString(this.chunkId);
while(chunkId.length() < 4) chunkId = "0" + chunkId;
- return this.namePrefix + chunkId.toUpperCase() + type.toUpperCase();
+ return this.namePrefix + chunkId.toUpperCase(Locale.ROOT)
+ + type.toUpperCase(Locale.ROOT);
}
/**
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
}
public String asFileName() {
- String str = Integer.toHexString(id).toUpperCase();
+ String str = Integer.toHexString(id).toUpperCase(Locale.ROOT);
while(str.length() < 4) {
str = "0" + str;
}
package org.apache.poi.hsmf.datatypes;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
/**
}
public static String asFileEnding(int type) {
- String str = Integer.toHexString(type).toUpperCase();
+ String str = Integer.toHexString(type).toUpperCase(Locale.ROOT);
while(str.length() < 4) {
str = "0" + str;
}
package org.apache.poi.hwpf.converter;
+import java.util.Locale;
+
import org.apache.poi.util.Beta;
/**
switch ( style )
{
case T_UPPER_ROMAN:
- return toRoman( num ).toUpperCase();
+ return toRoman( num ).toUpperCase(Locale.ROOT);
case T_LOWER_ROMAN:
return toRoman( num );
case T_UPPER_LETTER:
- return toLetters( num ).toUpperCase();
+ return toLetters( num ).toUpperCase(Locale.ROOT);
case T_LOWER_LETTER:
return toLetters( num );
case T_ARABIC:
package org.apache.poi.hpsf.basic;
+import java.util.Locale;
+
import junit.framework.Assert;
import junit.framework.TestCase;
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
, 0
);
- Assert.assertEquals(clsidTest.toString().toUpperCase(),
+ Assert.assertEquals(clsidTest.toString().toUpperCase(Locale.ROOT),
"{04030201-0605-0807-090A-0B0C0D0E0F10}"
);
}
import java.io.PrintStream;
import java.util.Collection;
+import java.util.Locale;
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
default:
throw new RuntimeException("unexpected result");
case Result.NO_EVALUATIONS_FOUND: // do nothing
- String uname = targetFunctionName.toUpperCase();
+ String uname = targetFunctionName.toUpperCase(Locale.ROOT);
if(startRowIndex >= SS.START_FUNCTIONS_ROW_INDEX &&
funcs.contains(uname)) {
logger.log(POILogger.WARN, uname + ": function is supported but missing test data");
import java.io.PrintStream;
import java.util.Collection;
+import java.util.Locale;
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
default:
throw new RuntimeException("unexpected result");
case Result.NO_EVALUATIONS_FOUND: // do nothing
- String uname = targetFunctionName.toUpperCase();
+ String uname = targetFunctionName.toUpperCase(Locale.ROOT);
if(startRowIndex >= SS.START_FUNCTIONS_ROW_INDEX &&
funcs.contains(uname)) {
logger.log(POILogger.WARN, uname + ": function is supported but missing test data");
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
} catch (IOException e) {
throw new RuntimeException(e);
}
- return "0x" + Long.toHexString(l).toUpperCase();
+ return "0x" + Long.toHexString(l).toUpperCase(Locale.ROOT);
}
private static boolean isNaNBytes(byte[] fileContent, int offset) {
==================================================================== */
package org.apache.poi.ss.util;
+
+import java.util.Locale;
+
/**
* Contains specific examples of <tt>double</tt> values and their rendering in Excel.
- *
- * @author Josh Micich
*/
final class NumberToTextConversionExamples {
_doubleValue = d;
}
private static String doubleToHexString(double d) {
- return "0x" + Long.toHexString(Double.doubleToLongBits(d)).toUpperCase() + "L";
+ return "0x" + Long.toHexString(Double.doubleToLongBits(d)).toUpperCase(Locale.ROOT) + "L";
}
public String getJavaRendering() {
return _javaRendering;
import junit.framework.ComparisonFailure;
import junit.framework.TestCase;
+import java.util.Locale;
+
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.ss.formula.constant.ConstantValueParser;
import org.apache.poi.ss.formula.ptg.NumberPtg;
}
private static String formatExample(ExampleConversion example) {
- String hexLong = Long.toHexString(example.getRawDoubleBits()).toUpperCase();
+ String hexLong = Long.toHexString(example.getRawDoubleBits()).toUpperCase(Locale.ROOT);
String longRep = "0x" + "0000000000000000".substring(hexLong.length()) + hexLong+ "L";
return "ec(" + longRep + ", \"" + example.getJavaRendering() + "\", \"" + example.getExcelRendering() + "\")";
}