import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
+import java.util.Locale;
import org.apache.poi.POIOLE2TextExtractor;
import org.apache.poi.hssf.usermodel.HSSFCell;
if (i >= args.length) {
throw new CommandParseException("Expected value after '" + args[i-1] + "'");
}
- String value = args[i].toUpperCase();
+ String value = args[i].toUpperCase(Locale.ROOT);
if ("Y".equals(value) || "YES".equals(value) || "ON".equals(value) || "TRUE".equals(value)) {
return true;
}
import org.apache.poi.util.LittleEndianOutput;
import java.util.Arrays;
+import java.util.Locale;
/**
* The HEADERFOOTER record stores information added in Office Excel 2007 for headers/footers.
StringBuffer sb = new StringBuffer();
sb.append("[").append("HEADERFOOTER").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase() + ")\n");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("HEADERFOOTER").append("]\n");
return sb.toString();
}
-}
\ No newline at end of file
+}
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.util.Locale;
import org.apache.poi.hssf.dev.BiffViewer;
import org.apache.poi.hssf.record.crypto.Biff8DecryptingStream;
@SuppressWarnings("serial")
public static final class LeftoverDataException extends RuntimeException {
public LeftoverDataException(int sid, int remainingByteCount) {
- super("Initialisation of record 0x" + Integer.toHexString(sid).toUpperCase()
+ super("Initialisation of record 0x" + Integer.toHexString(sid).toUpperCase(Locale.ROOT)
+ "(" + getRecordName(sid) + ") left " + remainingByteCount
+ " bytes remaining still to be read.");
}
package org.apache.poi.hssf.record;
+import java.util.Locale;
+
import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput;
// unknown sids in the range 0x0004-0x0013 are probably 'sub-records' of ObjectRecord
// those sids are in a different number space.
// TODO - put unknown OBJ sub-records in a different class
- System.out.println("Unknown record 0x" + Integer.toHexString(_sid).toUpperCase());
+ System.out.println("Unknown record 0x" +
+ Integer.toHexString(_sid).toUpperCase(Locale.ROOT));
}
}
StringBuffer sb = new StringBuffer();
sb.append("[").append(biffName).append("] (0x");
- sb.append(Integer.toHexString(_sid).toUpperCase() + ")\n");
+ sb.append(Integer.toHexString(_sid).toUpperCase(Locale.ROOT) + ")\n");
if (_rawData.length > 0) {
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
}
case 0x1007: return "CHARTLINEFORMAT";
}
if (isObservedButUnknown(sid)) {
- return "UNKNOWN-" + Integer.toHexString(sid).toUpperCase();
+ return "UNKNOWN-" + Integer.toHexString(sid).toUpperCase(Locale.ROOT);
}
return null;
package org.apache.poi.hssf.record;
+import java.util.Locale;
+
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput;
-
/**
* The UserSViewBegin record specifies settings for a custom view associated with the sheet.
* This record also marks the start of custom view records, which save custom view settings.
StringBuffer sb = new StringBuffer();
sb.append("[").append("USERSVIEWBEGIN").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase() + ")\n");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("USERSVIEWBEGIN").append("]\n");
return sb.toString();
return cloneViaReserialise();
}
-}
\ No newline at end of file
+}
package org.apache.poi.hssf.record;
+import java.util.Locale;
+
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndianOutput;
StringBuffer sb = new StringBuffer();
sb.append("[").append("USERSVIEWEND").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase() + ")\n");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("USERSVIEWEND").append("]\n");
return sb.toString();
package org.apache.poi.hssf.record.cf;
+import java.util.Locale;
+
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
{
buffer.append(" .underline type is not modified\n");
}
- buffer.append(" .color index = ").append("0x"+Integer.toHexString(getFontColorIndex()).toUpperCase()).append("\n");
+ buffer.append(" .color index = ").append("0x"+Integer.toHexString(getFontColorIndex()).toUpperCase(Locale.ROOT)).append("\n");
buffer.append(" [/Font Formatting]\n");
return buffer.toString();
limitations under the License.
==================================================================== */
-
-/*
- * HSSFDataFormat.java
- *
- * Created on December 18, 2001, 12:42 PM
- */
package org.apache.poi.hssf.usermodel;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Vector;
import org.apache.poi.hssf.model.InternalWorkbook;
public short getFormat(String pFormat) {
// Normalise the format string
String format;
- if (pFormat.toUpperCase().equals("TEXT")) {
+ if (pFormat.toUpperCase(Locale.ROOT).equals("TEXT")) {
format = "@";
} else {
format = pFormat;
import java.security.Security;\r
import java.security.spec.AlgorithmParameterSpec;\r
import java.util.Arrays;\r
+import java.util.Locale;\r
\r
import javax.crypto.Cipher;\r
import javax.crypto.Mac;\r
*/\r
public static String xorHashPassword(String password) {\r
int hashedPassword = createXorVerifier2(password);\r
- return String.format("%1$08X", hashedPassword);\r
+ return String.format(Locale.ROOT, "%1$08X", hashedPassword);\r
}\r
\r
/**\r
public static String xorHashPasswordReversed(String password) {\r
int hashedPassword = createXorVerifier2(password);\r
\r
- return String.format("%1$02X%2$02X%3$02X%4$02X"\r
+ return String.format(Locale.ROOT, "%1$02X%2$02X%3$02X%4$02X"\r
, ( hashedPassword >>> 0 ) & 0xFF\r
, ( hashedPassword >>> 8 ) & 0xFF\r
, ( hashedPassword >>> 16 ) & 0xFF\r
import javax.swing.*;
import java.awt.*;
+import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
for (HSSFColor color : colors.values()) {
Class<? extends HSSFColor> type = color.getClass();
String name = type.getSimpleName();
- if (name.equals(name.toUpperCase())) {
+ if (name.equals(name.toUpperCase(Locale.ROOT))) {
short[] rgb = color.getTriplet();
Color c = new Color(rgb[0], rgb[1], rgb[2]);
NAMED_COLORS.put(name, c);
package org.apache.poi.ss.format;
import java.util.Formatter;
+import java.util.Locale;
/**
* A formatter for the default "General" cell format.
}
}
} else if (value instanceof Boolean) {
- toAppendTo.append(value.toString().toUpperCase());
+ toAppendTo.append(value.toString().toUpperCase(Locale.ROOT));
} else {
toAppendTo.append(value.toString());
}
package org.apache.poi.ss.formula.ptg;
+import java.util.Locale;
+
import org.apache.poi.ss.formula.function.FunctionMetadata;
import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
-
/**
* This class provides the base functionality for Excel sheet functions
* There are two kinds of function Ptgs - tFunc and tFuncVar
* <code>false</code> if the name should be assumed to be an external function.
*/
public static final boolean isBuiltInFunctionName(String name) {
- short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase());
+ short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase(Locale.ROOT));
return ix >= 0;
}
==================================================================== */
package org.apache.poi.ss.usermodel;
+import java.util.Locale;
+
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Color;
}
sb.append(cs);
}
- return sb.toString().toUpperCase();
+ return sb.toString().toUpperCase(Locale.ROOT);
}
/**
package org.apache.poi.ss.util;
+import java.util.Locale;
+
import static org.apache.poi.ss.util.IEEEDouble.*;
/**
* for formatting double values in error messages
*/
private static String toHex(double a) {
- return "0x" + Long.toHexString(Double.doubleToLongBits(a)).toUpperCase();
+ return "0x" + Long.toHexString(Double.doubleToLongBits(a)).toUpperCase(Locale.ROOT);
}
}
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.text.AttributedString;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.ss.usermodel.Cell;
sval = String.valueOf(cell.getNumericCellValue());
}
} else if (cellType == Cell.CELL_TYPE_BOOLEAN) {
- sval = String.valueOf(cell.getBooleanCellValue()).toUpperCase();
+ sval = String.valueOf(cell.getBooleanCellValue()).toUpperCase(Locale.ROOT);
}
if(sval != null) {
String txt = sval + defaultChar;
// live within any merged regions
return null;
}
-}
\ No newline at end of file
+}