InputSource sheetSource = new InputSource(sheet);
parser.parse(sheetSource);
}
- System.out.println("");
+ System.out.println();
}
}
}
sb.append(HexDump.shortToHex(_d3).substring(PREFIX_LEN));
sb.append("-");
String d4Chars = HexDump.longToHex(getD4());
- sb.append(d4Chars.substring(PREFIX_LEN, PREFIX_LEN+4));
+ sb.append(d4Chars, PREFIX_LEN, PREFIX_LEN+4);
sb.append("-");
sb.append(d4Chars.substring(PREFIX_LEN+4));
return sb.toString();
if (args.length == 0) {
System.err.println("Use:");
System.err.println(" VBAMacroExtractor <office.doc> [output]");
- System.err.println("");
+ System.err.println();
System.err.println("If an output directory is given, macros are written there");
System.err.println("Otherwise they are output to the screen");
System.exit(1);
if (outputDir == null) {
System.out.println(divider);
System.out.println(moduleName);
- System.out.println("");
+ System.out.println();
System.out.println(moduleCode);
} else {
File out = new File(outputDir, moduleName + extension);
String binary = Integer.toBinaryString(number.intValue());
if (binary.length() > DEFAULT_PLACES_VALUE) {
- binary = binary.substring(binary.length() - DEFAULT_PLACES_VALUE, binary.length());
+ binary = binary.substring(binary.length() - DEFAULT_PLACES_VALUE);
}
//If DEC2BIN requires more than places characters, it returns the #NUM! error value.
if (binary.length() > placesNumber) {
return sb.toString();
}
// store everything from end of last match to start of this match
- sb.append(oldStr.substring(startIndex, nextMatch));
+ sb.append(oldStr, startIndex, nextMatch);
sb.append(newStr);
startIndex = nextMatch + searchStr.length();
}
count++;
if (count == instanceNumber) {
StringBuffer sb = new StringBuffer(oldStr.length() + newStr.length());
- sb.append(oldStr.substring(0, nextMatch));
+ sb.append(oldStr, 0, nextMatch);
sb.append(newStr);
sb.append(oldStr.substring(nextMatch + searchStr.length()));
return sb.toString();
* Magenta, Red, White, Yellow, "Color n" (1<=n<=56)
*/
private static final Pattern colorPattern =
- Pattern.compile("(\\[BLACK\\])|(\\[BLUE\\])|(\\[CYAN\\])|(\\[GREEN\\])|" +
- "(\\[MAGENTA\\])|(\\[RED\\])|(\\[WHITE\\])|(\\[YELLOW\\])|" +
- "(\\[COLOR\\s*\\d\\])|(\\[COLOR\\s*[0-5]\\d\\])", Pattern.CASE_INSENSITIVE);
+ Pattern.compile("(\\[BLACK])|(\\[BLUE])|(\\[CYAN])|(\\[GREEN])|" +
+ "(\\[MAGENTA])|(\\[RED])|(\\[WHITE])|(\\[YELLOW])|" +
+ "(\\[COLOR\\s*\\d])|(\\[COLOR\\s*[0-5]\\d])", Pattern.CASE_INSENSITIVE);
/**
* A regex to identify a fraction pattern.
* This requires that replaceAll("\\?", "#") has already been called
*/
- private static final Pattern fractionPattern = Pattern.compile("(?:([#\\d]+)\\s+)?(#+)\\s*\\/\\s*([#\\d]+)");
+ private static final Pattern fractionPattern = Pattern.compile("(?:([#\\d]+)\\s+)?(#+)\\s*/\\s*([#\\d]+)");
/**
* A regex to strip junk out of fraction formats
*/
- private static final Pattern fractionStripper = Pattern.compile("(\"[^\"]*\")|([^ \\?#\\d\\/]+)");
+ private static final Pattern fractionStripper = Pattern.compile("(\"[^\"]*\")|([^ ?#\\d/]+)");
/**
* A regex to detect if an alternate grouping character is used
if (symbol.indexOf('$') > -1) {
symbol = symbol.substring(0, symbol.indexOf('$')) +
'\\' +
- symbol.substring(symbol.indexOf('$'), symbol.length());
+ symbol.substring(symbol.indexOf('$'));
}
formatStr = m.replaceAll(symbol);
m = localePatternGroup.matcher(formatStr);
// "/ppt/slides/slide1.xml" and the targetURI is "slide1.xml" then
// this it should be relativized as "slide1.xml", i.e. the last segment.
retVal.append(segmentsSource[segmentsSource.length - 1]);
- } else {
- retVal.append("");
- }
+ }
} else {
// Matched for so long, but no more
while(m.find()) {
int pos = m.start();
if( pos > idx) {
- buf.append(value.substring(idx, pos));
+ buf.append(value, idx, pos);
}
String code = m.group(1);
if ((j == textEnd) && (i == runEnd)) {
endChar = charEnd;
}
- out.append(tmpText.substring(startChar, endChar + 1));
+ out.append(tmpText, startChar, endChar + 1);
}
}
return out.toString();
if(args.length < 2) {
System.err.println("Use:");
System.err.println(" HMEFContentsExtractor <filename> <output dir>");
- System.err.println("");
- System.err.println("");
+ System.err.println();
+ System.err.println();
System.err.println("Where <filename> is the winmail.dat file to extract,");
System.err.println(" and <output dir> is where to place the extracted files");
System.exit(2);
}
protected void dumpEscherStm(DirectoryNode escherDir) throws IOException {
byte[] data = getData(escherDir, "EscherStm");
- System.out.println("");
+ System.out.println();
System.out.println("EscherStm - " + data.length + " bytes long:");
if(data.length > 0)
dumpEscherStream(data);
}
protected void dumpEscherDelayStm(DirectoryNode escherDir) throws IOException {
byte[] data = getData(escherDir, "EscherDelayStm");
- System.out.println("");
+ System.out.println();
System.out.println("EscherDelayStm - " + data.length + " bytes long:");
if(data.length > 0)
dumpEscherStream(data);
public void dumpEnvelope() throws IOException {
byte[] data = getData(fs.getRoot(), "Envelope");
- System.out.println("");
+ System.out.println();
System.out.println("Envelope - " + data.length + " bytes long:");
}
public void dumpContents() throws IOException {
byte[] data = getData(fs.getRoot(), "Contents");
- System.out.println("");
+ System.out.println();
System.out.println("Contents - " + data.length + " bytes long:");
// 8 bytes, always seems to be
public void dumpCONTENTSraw(DirectoryNode dir) throws IOException {
byte[] data = getData(dir, "CONTENTS");
- System.out.println("");
+ System.out.println();
System.out.println("CONTENTS - " + data.length + " bytes long:");
// Between the start and 0x200 we have
}
if(textStop > 0) {
int len = (textStop - 0x200) / 2;
- System.out.println("");
+ System.out.println();
System.out.println(
StringUtil.getFromUnicodeLE(data, 0x200, len)
);
public void dumpCONTENTSguessed(DirectoryNode dir) throws IOException {
byte[] data = getData(dir, "CONTENTS");
- System.out.println("");
+ System.out.println();
System.out.println("CONTENTS - " + data.length + " bytes long:");
String[] startType = new String[20];
}
// Text
- System.out.println("");
+ System.out.println();
System.out.println("TEXT:");
System.out.println(text);
- System.out.println("");
+ System.out.println();
// All the others
for(int i=0; i<20; i++) {
}
private void dumpBit(QCBit bit, int index) {
- System.out.println("");
+ System.out.println();
System.out.println("Dumping " + bit.getBitType() + " bit at " + index);
System.out.println(" Is a " + bit.getThingType() + ", number is " + bit.getOptA());
System.out.println(" Starts at " + bit.getDataOffset() + " (0x" + Integer.toHexString(bit.getDataOffset()) + ")");
// Process the first argument as a file
InputStream fin = new FileInputStream( args[0] );
- WordExtractor extractor = new WordExtractor( fin );
- try {
- System.out.println( extractor.getText() );
- } finally {
- extractor.close();
+ try (WordExtractor extractor = new WordExtractor(fin)) {
+ System.out.println(extractor.getText());
}
}
}
if ( text.endsWith( "\n\n" ))
{
- out.append( text.substring( 0, text.length() - 1 ));
+ out.append(text, 0, text.length() - 1);
return;
}
out.append( text );
+ "make the fix elsewhere (do not modify this test or the proof spreadsheet to get the test working).");
ps.println("If the changes were wanted, make sure to open the newly generated file in Excel "
+ "and verify it manually. The new proof file should be submitted after it is verified to be correct.");
- ps.println("");
+ ps.println();
ps.println("One other possible (but less likely) cause of a failed test is a problem in the "
+ "comparison logic used here. Perhaps some extra file regions need to be ignored.");
ps.println("The generated file has been saved to '" + generatedFile.getAbsolutePath() + "' for manual inspection.");
ps.println(" (size=" + effDocFile.length() + ", md5=" + getFileMD5(effDocFile) + ")");
ps.println("#");
ps.println("#Columns: (index, name, minParams, maxParams, returnClass, paramClasses, isVolatile, hasFootnote )");
- ps.println("");
+ ps.println();
try {
// can't use ZipHelper here, because its in a different module
ZipFile zf = new ZipFile(effDocFile);