avoid string concats

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2020-12-17 21:42:19 +00:00
parent 0e0d1d56da
commit bd1d31e410
58 changed files with 132 additions and 156 deletions

View File

@ -67,7 +67,7 @@ public class HSLFFileHandler extends SlideShowHandler {
try {
testOneFile(file);
} catch (Throwable e) {
logger.log(POILogger.WARN, "Failed to handle file " + file, e);
logger.log(POILogger.WARN, "Failed to handle file ", file, e);
}
}
}

View File

@ -400,12 +400,12 @@ public final class InternalSheet {
public static InternalSheet createSheet() {
return new InternalSheet();
}
private InternalSheet() {
_mergedCellsTable = new MergedCellsTable();
List<RecordBase> records = new ArrayList<>(32);
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Sheet createsheet from scratch called");
log.log(POILogger.DEBUG, "Sheet createsheet from scratch called");
records.add(createBOF());
@ -452,8 +452,7 @@ public final class InternalSheet {
records.add(EOFRecord.instance);
_records = records;
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit");
log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit");
}
public RowRecordsAggregate getRowsAggregate() {
@ -551,8 +550,7 @@ public final class InternalSheet {
_dimensions.setFirstRow(firstrow);
_dimensions.setLastCol(lastcol);
_dimensions.setLastRow(lastrow);
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Sheet.setDimensions exiting");
log.log(POILogger.DEBUG, "Sheet.setDimensions exiting");
}
public void visitContainedRecords(RecordVisitor rv, int offset) {

View File

@ -78,7 +78,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord {
// Spot corrupt records
if(reserved != 1) {
_logger.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found " + reserved + " - ignoring");
_logger.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found ", reserved, " - ignoring");
// Grab all the remaining data, and ignore it
for(int i=0; i<expectedLength-2; i++) {
in.readByte();
@ -121,7 +121,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord {
int extraDataLength = runData - (numRuns*6);
if(extraDataLength < 0) {
_logger.log( POILogger.WARN, "Warning - ExtRst overran by " + (0-extraDataLength) + " bytes");
_logger.log( POILogger.WARN, "Warning - ExtRst overran by ", (0-extraDataLength), " bytes");
extraDataLength = 0;
}
extraData = IOUtils.safelyAllocate(extraDataLength, MAX_RECORD_LENGTH);

View File

@ -231,9 +231,9 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
}
if (log.check( POILogger.DEBUG )) {
if (cval instanceof Record) {
log.log( DEBUG, "record id = " + Integer.toHexString( ( (org.apache.poi.hssf.record.Record) cval ).getSid() ) );
log.log( DEBUG, "record id = ", Integer.toHexString( ( (org.apache.poi.hssf.record.Record) cval ).getSid() ) );
} else {
log.log( DEBUG, "record = " + cval );
log.log( DEBUG, "record = ", cval );
}
}
hrow.createCellFromRecord( cval );

View File

@ -427,9 +427,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
*/
private void convertLabelRecords(List<org.apache.poi.hssf.record.Record> records, int offset) {
if (log.check(POILogger.DEBUG)) {
log.log(POILogger.DEBUG, "convertLabelRecords called");
}
log.log(POILogger.DEBUG, "convertLabelRecords called");
for (int k = offset; k < records.size(); k++) {
Record rec = records.get(k);
@ -448,9 +446,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
records.add(k, newrec);
}
}
if (log.check(POILogger.DEBUG)) {
log.log(POILogger.DEBUG, "convertLabelRecords exit");
}
log.log(POILogger.DEBUG, "convertLabelRecords exit");
}
/**

View File

@ -93,8 +93,8 @@ public class DrawPictureShape extends DrawSimpleShape {
// the fallback is the BitmapImageRenderer, at least it gracefully handles invalid images
final Supplier<ImageRenderer> getFallback = () -> {
LOG.log(POILogger.WARN, "No suitable image renderer found for content-type '"+
contentType+"' - include poi-scratchpad (for wmf/emf) or poi-ooxml (for svg) jars!");
LOG.log(POILogger.WARN, "No suitable image renderer found for content-type '",
contentType, "' - include poi-scratchpad (for wmf/emf) or poi-ooxml (for svg) jars!");
return fallback;
};

View File

@ -66,7 +66,7 @@ public class ErrorConstant {
default: break;
}
}
logger.log( POILogger.WARN, "Warning - unexpected error code (" + errorCode + ")");
logger.log( POILogger.WARN, "Warning - unexpected error code (", errorCode, ")");
return new ErrorConstant(errorCode);
}

View File

@ -598,7 +598,7 @@ public class DataFormatter {
try {
return new ExcelStyleDateFormatter(formatStr, dateSymbols);
} catch(IllegalArgumentException iae) {
logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
logger.log(POILogger.DEBUG, "Formatting failed for format ", formatStr, ", falling back", iae);
// the pattern could not be parsed correctly,
// so fall back to the default number format
return getDefaultFormat(cellValue);
@ -758,7 +758,7 @@ public class DataFormatter {
try {
return new InternalDecimalFormatWithScale(format, symbols);
} catch(IllegalArgumentException iae) {
logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
logger.log(POILogger.DEBUG, "Formatting failed for format ", formatStr, ", falling back", iae);
// the pattern could not be parsed correctly,
// so fall back to the default number format
return getDefaultFormat(cellValue);

View File

@ -62,7 +62,7 @@ public abstract class POIXMLFactory {
}
}
LOGGER.log(POILogger.DEBUG, "using default POIXMLDocumentPart for " + rel.getRelationshipType());
LOGGER.log(POILogger.DEBUG, "using default POIXMLDocumentPart for ", rel.getRelationshipType());
return new POIXMLDocumentPart(parent, part);
} catch (IOException | XmlException e) {
throw new POIXMLException(e.getMessage(), e);

View File

@ -300,7 +300,7 @@ public final class PackageRelationshipCollection implements
public void parseRelationshipsPart(PackagePart relPart)
throws InvalidFormatException {
try {
logger.log(POILogger.DEBUG, "Parsing relationship: " + relPart.getPartName());
logger.log(POILogger.DEBUG, "Parsing relationship: ", relPart.getPartName());
Document xmlRelationshipsDoc = DocumentHelper.readDocument(relPart.getInputStream());
// Browse default types

View File

@ -311,7 +311,7 @@ public final class ZipPackage extends OPCPackage {
: PackagingURIHelper.createPartName(ZipHelper.getOPCNameFromZipItemName(entryName));
} catch (Exception e) {
// We assume we can continue, even in degraded mode ...
LOG.log(POILogger.WARN,"Entry " + entryName + " is not valid, so this part won't be add to the package.", e);
LOG.log(POILogger.WARN,"Entry ", entryName, " is not valid, so this part won't be add to the package.", e);
}
this.partName = ppn;
@ -437,9 +437,9 @@ public final class ZipPackage extends OPCPackage {
} finally {
// Either the save operation succeed or not, we delete the temporary file
if (!tempFile.delete()) {
LOG.log(POILogger.WARN, "The temporary file: '"
+ targetFile.getAbsolutePath()
+ "' cannot be deleted ! Make sure that no other application use it.");
LOG.log(POILogger.WARN, "The temporary file: '",
targetFile.getAbsolutePath(),
"' cannot be deleted ! Make sure that no other application use it.");
}
}
}
@ -534,7 +534,7 @@ public final class ZipPackage extends OPCPackage {
}
final PackagePartName ppn = part.getPartName();
LOG.log(POILogger.DEBUG,"Save part '" + ZipHelper.getZipItemNameFromOPCName(ppn.getName()) + "'");
LOG.log(POILogger.DEBUG,"Save part '", ZipHelper.getZipItemNameFromOPCName(ppn.getName()), "'");
final PartMarshaller marshaller = partMarshallers.get(part._contentType);
final PartMarshaller pm = (marshaller != null) ? marshaller : defaultPartMarshaller;

View File

@ -350,7 +350,7 @@ public class SignatureConfig {
try {
this.executionTime = fmt.parse(executionTime);
} catch (ParseException e) {
LOG.log(POILogger.WARN, "Illegal execution time: "+executionTime);
LOG.log(POILogger.WARN, "Illegal execution time: ", executionTime);
}
}
}

View File

@ -378,7 +378,7 @@ public class SignatureInfo {
*/
List<XMLObject> objects = new ArrayList<>();
for (SignatureFacet signatureFacet : signatureConfig.getSignatureFacets()) {
LOG.log(POILogger.DEBUG, "invoking signature facet: " + signatureFacet.getClass().getSimpleName());
LOG.log(POILogger.DEBUG, "invoking signature facet: ", signatureFacet.getClass().getSimpleName());
signatureFacet.preSign(this, document, references, objects);
}
@ -415,10 +415,10 @@ public class SignatureInfo {
* Completion of undigested ds:References in the ds:Manifests.
*/
for (XMLObject object : objects) {
LOG.log(POILogger.DEBUG, "object java type: " + object.getClass().getName());
LOG.log(POILogger.DEBUG, "object java type: ", object.getClass().getName());
List<XMLStructure> objectContentList = object.getContent();
for (XMLStructure objectContent : objectContentList) {
LOG.log(POILogger.DEBUG, "object content java type: " + objectContent.getClass().getName());
LOG.log(POILogger.DEBUG, "object content java type: ", objectContent.getClass().getName());
if (!(objectContent instanceof Manifest)) {
continue;
}
@ -593,7 +593,8 @@ public class SignatureInfo {
return (Element)sigValNl.item(0);
}
LOG.log(POILogger.WARN, "Signature element '"+localName+"' was "+(sigValNl.getLength() == 0 ? "not found" : "multiple times"));
LOG.log(POILogger.WARN, "Signature element '", localName, "' was ",
(sigValNl.getLength() == 0 ? "not found" : "multiple times"));
return null;
}
@ -703,7 +704,7 @@ public class SignatureInfo {
try {
return (Provider)Class.forName(className).getDeclaredConstructor().newInstance();
} catch (Exception e) {
LOG.log(POILogger.DEBUG, "XMLDsig-Provider '"+className+"' can't be found - trying next.");
LOG.log(POILogger.DEBUG, "XMLDsig-Provider '", className, "' can't be found - trying next.");
return null;
}
}

View File

@ -178,7 +178,7 @@ public class OOXMLSignatureFacet implements SignatureFacet {
if (relationshipType.endsWith("customXml")
&& !(contentType.equals("inkml+xml") || contentType.equals("text/xml"))) {
LOG.log(POILogger.DEBUG, "skipping customXml with content type: " + contentType);
LOG.log(POILogger.DEBUG, "skipping customXml with content type: ", contentType);
continue;
}
@ -212,7 +212,7 @@ public class OOXMLSignatureFacet implements SignatureFacet {
}
try {
pn = new URI(pn).normalize().getPath().replace('\\', '/');
LOG.log(POILogger.DEBUG, "part name: " + pn);
LOG.log(POILogger.DEBUG, "part name: ", pn);
} catch (URISyntaxException e) {
throw new XMLSignatureException(e);
}
@ -230,7 +230,7 @@ public class OOXMLSignatureFacet implements SignatureFacet {
CTSignatureTime ctTime = sigTime.addNewSignatureTime();
ctTime.setFormat("YYYY-MM-DDThh:mm:ssTZD");
ctTime.setValue(signatureConfig.formatExecutionTime());
LOG.log(POILogger.DEBUG, "execution time: " + ctTime.getValue());
LOG.log(POILogger.DEBUG, "execution time: ", ctTime.getValue());
Element n = (Element)document.importNode(ctTime.getDomNode(),true);
List<XMLStructure> signatureTimeContent = new ArrayList<>();
@ -328,7 +328,7 @@ public class OOXMLSignatureFacet implements SignatureFacet {
}
protected static boolean isSignedRelationship(String relationshipType) {
LOG.log(POILogger.DEBUG, "relationship type: " + relationshipType);
LOG.log(POILogger.DEBUG, "relationship type: ", relationshipType);
String rt = relationshipType.replaceFirst(".*/relationships/", "");
return (signed.contains(rt) || rt.endsWith("customXml"));
}

View File

@ -187,9 +187,9 @@ public class RelationshipTransformService extends TransformService {
*/
public Data transform(Data data, XMLCryptoContext context) throws TransformException {
LOG.log(POILogger.DEBUG, "transform(data,context)");
LOG.log(POILogger.DEBUG, "data java type: " + data.getClass().getName());
LOG.log(POILogger.DEBUG, "data java type: ", data.getClass().getName());
OctetStreamData octetStreamData = (OctetStreamData) data;
LOG.log(POILogger.DEBUG, "URI: " + octetStreamData.getURI());
LOG.log(POILogger.DEBUG, "URI: ", octetStreamData.getURI());
InputStream octetStream = octetStreamData.getOctetStream();
Document doc;

View File

@ -188,11 +188,11 @@ public class TSPTimeStampService implements TimeStampService {
timeStampResponse.validate(request);
if (0 != timeStampResponse.getStatus()) {
LOG.log(POILogger.DEBUG, "status: " + timeStampResponse.getStatus());
LOG.log(POILogger.DEBUG, "status string: " + timeStampResponse.getStatusString());
LOG.log(POILogger.DEBUG, "status: ", timeStampResponse.getStatus());
LOG.log(POILogger.DEBUG, "status string: ", timeStampResponse.getStatusString());
PKIFailureInfo failInfo = timeStampResponse.getFailInfo();
if (null != failInfo) {
LOG.log(POILogger.DEBUG, "fail info int value: " + failInfo.intValue());
LOG.log(POILogger.DEBUG, "fail info int value: ", failInfo.intValue());
if (/*PKIFailureInfo.unacceptedPolicy*/(1 << 8) == failInfo.intValue()) {
LOG.log(POILogger.DEBUG, "unaccepted policy");
}
@ -204,8 +204,8 @@ public class TSPTimeStampService implements TimeStampService {
SignerId signerId = timeStampToken.getSID();
BigInteger signerCertSerialNumber = signerId.getSerialNumber();
X500Name signerCertIssuer = signerId.getIssuer();
LOG.log(POILogger.DEBUG, "signer cert serial number: " + signerCertSerialNumber);
LOG.log(POILogger.DEBUG, "signer cert issuer: " + signerCertIssuer);
LOG.log(POILogger.DEBUG, "signer cert serial number: ", signerCertSerialNumber);
LOG.log(POILogger.DEBUG, "signer cert issuer: ", signerCertIssuer);
// TSP signer certificates retrieval
Collection<X509CertificateHolder> certificates = timeStampToken.getCertificates().getMatches(null);
@ -229,7 +229,7 @@ public class TSPTimeStampService implements TimeStampService {
x509converter.setProvider("BC");
X509CertificateHolder certificate = signerCert;
do {
LOG.log(POILogger.DEBUG, "adding to certificate chain: " + certificate.getSubject());
LOG.log(POILogger.DEBUG, "adding to certificate chain: ", certificate.getSubject());
tspCertificateChain.add(x509converter.getCertificate(certificate));
if (certificate.getSubject().equals(certificate.getIssuer())) {
break;
@ -253,8 +253,8 @@ public class TSPTimeStampService implements TimeStampService {
signatureConfig.getTspValidator().validate(tspCertificateChain, revocationData);
}
LOG.log(POILogger.DEBUG, "time-stamp token time: "
+ timeStampToken.getTimeStampInfo().getGenTime());
LOG.log(POILogger.DEBUG, "time-stamp token time: ",
timeStampToken.getTimeStampInfo().getGenTime());
return timeStampToken.getEncoded();
}

View File

@ -641,7 +641,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
shape = new XSSFShapeGroup(this, (CTGroupShape) obj);
} else if (obj instanceof XmlAnyTypeImpl) {
LOG.log(POILogger.WARN,
"trying to parse AlternateContent, " + "this unlinks the returned Shapes from the underlying xml content, " + "so those shapes can't be used to modify the drawing, " + "i.e. modifications will be ignored!");
"trying to parse AlternateContent, this unlinks the returned Shapes from the underlying xml content, so those shapes can't be used to modify the drawing, i.e. modifications will be ignored!");
// XmlAnyTypeImpl is returned for AlternateContent
// parts, which might contain a CTDrawing

View File

@ -416,7 +416,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
for (CTExternalReference er : this.workbook.getExternalReferences().getExternalReferenceArray()) {
ExternalLinksTable el = elIdMap.get(er.getId());
if(el == null) {
logger.log(POILogger.WARN, "ExternalLinksTable with r:id " + er.getId()+ " was defined, but didn't exist in package, skipping");
logger.log(POILogger.WARN, "ExternalLinksTable with r:id ", er.getId(), " was defined, but didn't exist in package, skipping");
continue;
}
externalLinks.add(el);
@ -437,7 +437,8 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
public void parseSheet(Map<String, XSSFSheet> shIdMap, CTSheet ctSheet) {
XSSFSheet sh = shIdMap.get(ctSheet.getId());
if(sh == null) {
logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping");
logger.log(POILogger.WARN, "Sheet with name ", ctSheet.getName(), " and r:id ",
ctSheet.getId(), " was defined, but didn't exist in package, skipping");
return;
}
sh.sheet = ctSheet;

View File

@ -357,7 +357,7 @@ public class TestSignatureInfo {
assertNotNull(result);
assertEquals("test-file: " + testFile, 1, result.size());
X509Certificate signer = result.get(0);
LOG.log(POILogger.DEBUG, "signer: " + signer.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "signer: ", signer.getSubjectX500Principal());
boolean b = si.verifySignature();
assertTrue("test-file: " + testFile, b);
@ -385,8 +385,8 @@ public class TestSignatureInfo {
assertEquals("test-file: " + testFile, 2, result.size());
X509Certificate signer1 = result.get(0);
X509Certificate signer2 = result.get(1);
LOG.log(POILogger.DEBUG, "signer 1: " + signer1.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "signer 2: " + signer2.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "signer 1: ", signer1.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "signer 2: ", signer2.getSubjectX500Principal());
boolean b = si.verifySignature();
assertTrue("test-file: " + testFile, b);
@ -527,8 +527,8 @@ public class TestSignatureInfo {
} else {
TimeStampServiceValidator tspValidator = (validateChain, revocationData) -> {
for (X509Certificate certificate : validateChain) {
LOG.log(POILogger.DEBUG, "certificate: " + certificate.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "validity: " + certificate.getNotBefore() + " - " + certificate.getNotAfter());
LOG.log(POILogger.DEBUG, "certificate: ", certificate.getSubjectX500Principal());
LOG.log(POILogger.DEBUG, "validity: ", certificate.getNotBefore(), " - ", certificate.getNotAfter());
}
};
signatureConfig.setTspValidator(tspValidator);

View File

@ -94,8 +94,7 @@ public final class TestWorkbookFactory {
else {
// TODO: close() re-writes the sample-file?! Resort to revert() for now to close file handle...
LOGGER.log(POILogger.WARN,
"reverting XSSFWorkbook rather than closing it to avoid close() modifying the file on disk. " +
"Refer to bug 58779.");
"reverting XSSFWorkbook rather than closing it to avoid close() modifying the file on disk. Refer to bug 58779.");
xwb.getPackage().revert();
}
} else {

View File

@ -180,7 +180,7 @@ public final class Chunk {
// Check we seem to have enough data
if(offset >= contents.length) {
logger.log(POILogger.WARN,
"Command offset " + offset + " past end of data at " + contents.length
"Command offset ", offset, " past end of data at ", contents.length
);
continue;
}

View File

@ -140,7 +140,7 @@ public final class ChunkFactory {
// as required
if(endOfDataPos > data.length) {
logger.log(POILogger.WARN,
"Header called for " + header.getLength() +" bytes, but that would take us past the end of the data!");
"Header called for ", header.getLength(), " bytes, but that would take us past the end of the data!");
endOfDataPos = data.length;
header.setLength(data.length - offset - header.getSizeInBytes());

View File

@ -66,7 +66,7 @@ public final class ChunkStream extends Stream {
pos += chunk.getOnDiskSize();
} else {
logger.log(POILogger.WARN, "Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
logger.log(POILogger.WARN, "Needed ", headerSize, " bytes to create the next chunk header, but only found ", (contents.length-pos), " bytes, ignoring rest of data");
pos = contents.length;
}
}

View File

@ -80,7 +80,7 @@ public final class MAPIDateAttribute extends MAPIAttribute {
return ((MAPIDateAttribute)attr).getDate();
}
logger.log(POILogger.WARN, "Warning, non date property found: " + attr);
logger.log(POILogger.WARN, "Warning, non date property found: ", attr);
return null;
}
}

View File

@ -77,7 +77,7 @@ public final class MAPIStringAttribute extends MAPIAttribute {
return ((MAPIRtfAttribute)attr).getDataString();
}
logger.log(POILogger.WARN, "Warning, non string property found: " + attr);
logger.log(POILogger.WARN, "Warning, non string property found: ", attr);
return null;
}
}

View File

@ -95,7 +95,7 @@ public final class TNEFDateAttribute extends TNEFAttribute {
return ((TNEFDateAttribute)attr).getDate();
}
logger.log(POILogger.WARN, "Warning, non date property found: " + attr);
logger.log(POILogger.WARN, "Warning, non date property found: ", attr);
return null;
}
}

View File

@ -78,7 +78,7 @@ public final class TNEFStringAttribute extends TNEFAttribute {
return ((TNEFStringAttribute)attr).getString();
}
logger.log(POILogger.WARN, "Warning, non string property found: " + attr);
logger.log(POILogger.WARN, "Warning, non string property found: ", attr);
return null;
}
}

View File

@ -148,9 +148,10 @@ public abstract class BitMaskTextProp extends TextProp {
setWriteMask(writeMask);
super.setValue(maskValue(val));
if (val != super.getValue()) {
logger.log(POILogger.WARN, "Style properties of '"+getName()+"' don't match mask - output will be sanitized");
logger.log(POILogger.WARN, "Style properties of '", getName(), "' don't match mask - output will be sanitized");
if (logger.check(POILogger.DEBUG)) {
StringBuilder sb = new StringBuilder("The following style attributes of the '"+getName()+"' property will be ignored:\n");
StringBuilder sb = new StringBuilder("The following style attributes of the '")
.append(getName()).append("' property will be ignored:\n");
int i=0;
for (int mask : subPropMasks) {
if (!subPropMatches[i] && (val & mask) != 0) {

View File

@ -129,7 +129,7 @@ public final class Comment2000 extends RecordContainer {
} else if (r instanceof Comment2000Atom){
commentAtom = (Comment2000Atom)r;
} else {
logger.log(POILogger.WARN, "Unexpected record with type="+r.getRecordType()+" in Comment2000: " + r.getClass().getName());
logger.log(POILogger.WARN, "Unexpected record with type=", r.getRecordType(), " in Comment2000: ", r.getClass().getName());
}
}

View File

@ -177,7 +177,7 @@ public class CurrentUserAtom
long usernameLen = LittleEndian.getUShort(_contents,20);
if(usernameLen > 512) {
// Handle the case of it being garbage
logger.log(POILogger.WARN, "Warning - invalid username length " + usernameLen + " found, treating as if there was no username set");
logger.log(POILogger.WARN, "Warning - invalid username length ", usernameLen, " found, treating as if there was no username set");
usernameLen = 0;
}

View File

@ -164,7 +164,7 @@ public final class Document extends PositionDependentRecordContainer
logger.log(POILogger.WARN, "No SlideListWithText's found - there should normally be at least one!");
}
if(slwtcount > 3) {
logger.log(POILogger.WARN, "Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
logger.log(POILogger.WARN, "Found ", slwtcount, " SlideListWithTexts - normally there should only be three!");
}
// Now grab all the SLWTs

View File

@ -72,7 +72,7 @@ public class ExMCIMovie extends RecordContainer { // TODO - instantiable supercl
if (_children[0] instanceof ExVideoContainer) {
exVideo = (ExVideoContainer) _children[0];
} else {
logger.log(POILogger.ERROR, "First child record wasn't a ExVideoContainer, was of type " + _children[0].getRecordType());
logger.log(POILogger.ERROR, "First child record wasn't a ExVideoContainer, was of type ", _children[0].getRecordType());
}
}

View File

@ -62,7 +62,7 @@ public final class FontCollection extends RecordContainer {
HSLFFontInfo fi = addFont(fontHeader);
fi.addFacet(fed);
} else {
logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was " + r.getClass().getSimpleName());
logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was ", r.getClass().getSimpleName());
}
}
}

View File

@ -89,11 +89,11 @@ public final class HeadersFootersContainer extends RecordContainer {
csFooter = cs;
break;
default:
logger.log(POILogger.WARN, "Unexpected CString.Options in HeadersFootersContainer: " + opts);
logger.log(POILogger.WARN, "Unexpected CString.Options in HeadersFootersContainer: ", opts);
break;
}
} else {
logger.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: " + child);
logger.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: ", child);
}
}
}

View File

@ -201,7 +201,7 @@ public final class PPDrawing extends RecordAtom implements Iterable<EscherRecord
// Wind on
int size = r.getRecordSize();
if(size < 8) {
logger.log(POILogger.WARN, "Hit short DDF record at " + startPos + " - " + size);
logger.log(POILogger.WARN, "Hit short DDF record at ", startPos, " - ", size);
}
/*
@ -211,7 +211,7 @@ public final class PPDrawing extends RecordAtom implements Iterable<EscherRecord
* Sometimes it is not so, see an example in bug #44770. Most likely reason is that one of ddf records calculates wrong size.
*/
if(size != escherBytes){
logger.log(POILogger.WARN, "Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
logger.log(POILogger.WARN, "Record length=", escherBytes, " but getRecordSize() returned ", r.getRecordSize(), "; record: ", r.getClass());
size = escherBytes;
}
startPos += size;

View File

@ -251,7 +251,7 @@ public final class StyleTextPropAtom extends RecordAtom {
}
if (rawContents.length > 0 && textHandled != (size+1)){
logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = ", textHandled, ", text.size+1 = ", (size+1));
}
// Now do the character stylings
@ -283,7 +283,7 @@ public final class StyleTextPropAtom extends RecordAtom {
}
}
if (rawContents.length > 0 && textHandled != (size+1)){
logger.log(POILogger.WARN, "Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
logger.log(POILogger.WARN, "Problem reading character style runs: textHandled = ", textHandled, ", text.size+1 = ", (size+1));
}
// Handle anything left over
@ -296,8 +296,8 @@ public final class StyleTextPropAtom extends RecordAtom {
private int checkTextLength(int readLength, int handledSoFar, int overallSize) {
if (readLength + handledSoFar > overallSize + 1) {
logger.log(POILogger.WARN, "Style length of " + readLength + " at " + handledSoFar +
" larger than stated size of " + overallSize + ", truncating");
logger.log(POILogger.WARN, "Style length of ", readLength, " at ", handledSoFar,
" larger than stated size of ", overallSize, ", truncating");
return overallSize + 1 - handledSoFar;
}
return readLength;

View File

@ -263,7 +263,7 @@ public final class HSLFFill {
case FILL_PICTURE:
return getTexturePaint();
default:
LOG.log(POILogger.WARN, "unsuported fill type: " + fillType);
LOG.log(POILogger.WARN, "unsuported fill type: ", fillType);
return null;
}
}

View File

@ -150,7 +150,7 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
numPoints++;
break;
default:
LOG.log(POILogger.WARN, "Ignoring invalid segment type "+type);
LOG.log(POILogger.WARN, "Ignoring invalid segment type ", type);
break;
}

View File

@ -617,7 +617,7 @@ public class MAPIMessage extends POIReadOnlyDocument {
} else if (mc.equalsIgnoreCase("IPM.Post")) {
return MESSAGE_CLASS.POST;
} else {
logger.log(POILogger.WARN, "I don't recognize message class '"+mc+"'. " +
logger.log(POILogger.WARN, "I don't recognize message class '", mc, "'. ",
"Please open an issue on POI's bugzilla");
return MESSAGE_CLASS.UNKNOWN;
}

View File

@ -202,7 +202,7 @@ public class AttachmentChunks implements ChunkGroup {
} else if (chunkId == ATTACH_CONTENT_ID.id) {
attachContentId = (StringChunk) chunk;
} else {
LOG.log(POILogger.WARN, "Currently unsupported attachment chunk property will be ignored. " + chunk.getEntryName());
LOG.log(POILogger.WARN, "Currently unsupported attachment chunk property will be ignored. ", chunk.getEntryName());
}
// And add to the main list

View File

@ -104,8 +104,7 @@ public class MessageSubmissionChunk extends Chunk {
date.clear(Calendar.MILLISECOND);
} else {
LOG.log(POILogger.WARN,
"Warning - unable to make sense of date "
+ dateS);
"Warning - unable to make sense of date ", dateS);
}
}
}

View File

@ -234,7 +234,7 @@ public final class POIFSChunkParser {
return new StringChunk(namePrefix, chunkId, type);
}
// Type of an unsupported type! Skipping...
LOG.log(POILogger.WARN, "UNSUPPORTED PROP TYPE " + entryName);
LOG.log(POILogger.WARN, "UNSUPPORTED PROP TYPE ", entryName);
return null;
}
}
@ -249,7 +249,7 @@ public final class POIFSChunkParser {
try {
multiValueIdx = Long.parseLong(mvidxstr) & 0xFFFFFFFFL;
} catch (NumberFormatException ignore) {
LOG.log(POILogger.WARN, "Can't read multi value idx from entry " + entry.getName());
LOG.log(POILogger.WARN, "Can't read multi value idx from entry ", entry.getName());
}
}
@ -270,7 +270,7 @@ public final class POIFSChunkParser {
chunk = new StringChunk(namePrefix, chunkId, type);
} else {
// Type of an unsupported multivalued type! Skipping...
LOG.log(POILogger.WARN, "Unsupported multivalued prop type for entry " + entry.getName());
LOG.log(POILogger.WARN, "Unsupported multivalued prop type for entry ", entry.getName());
return null;
}
mc.addChunk((int) multiValueIdx, chunk);

View File

@ -450,8 +450,8 @@ public abstract class AbstractWordConverter
if ( previous > range.getEndOffset() )
{
logger.log( POILogger.WARN, "Latest structure in ", range,
" ended at #" + previous, " after range boundaries [",
range.getStartOffset() + "; " + range.getEndOffset(),
" ended at #", previous, " after range boundaries [",
range.getStartOffset(), "; ", range.getEndOffset(),
")" );
return true;
}
@ -747,8 +747,8 @@ public abstract class AbstractWordConverter
.getOfficeDrawingAt( characterRun.getStartOffset() );
if ( officeDrawing == null )
{
logger.log( POILogger.WARN, "Characters #" + characterRun
+ " references missing drawn object" );
logger.log( POILogger.WARN, "Characters #", characterRun,
" references missing drawn object" );
return;
}
@ -812,8 +812,8 @@ public abstract class AbstractWordConverter
{
if ( !field.hasSeparator() )
{
logger.log( POILogger.WARN, parentRange + " contains " + field
+ " with 'Embedded Object' but without separator mark" );
logger.log( POILogger.WARN, parentRange, " contains ", field,
" with 'Embedded Object' but without separator mark" );
return;
}
@ -898,8 +898,8 @@ public abstract class AbstractWordConverter
}
}
logger.log( POILogger.WARN, parentRange + " contains " + field
+ " with unsupported type or format" );
logger.log( POILogger.WARN, parentRange, " contains ", field,
" with unsupported type or format" );
processCharacters( wordDocument, currentTableLevel,
field.secondSubrange( parentRange ), currentBlock );
}

View File

@ -577,9 +577,9 @@ public class WordToFoConverter extends AbstractWordConverter
{
logger.log(
POILogger.WARN,
"Table without body starting on offset "
+ table.getStartOffset() + " -- "
+ table.getEndOffset() );
"Table without body starting on offset ",
table.getStartOffset(), " -- ",
table.getEndOffset() );
}
}

View File

@ -355,7 +355,7 @@ public class WordToTextConverter extends AbstractWordConverter
logger.log( POILogger.WARN, "There is an OLE object entry '",
entry.getName(),
"', but there is no text extractor for this object type ",
"or text extractor factory is not available: ", "" + exc );
"or text extractor factory is not available: ", "", exc );
return false;
}

View File

@ -171,11 +171,9 @@ public final class FIBFieldHandler
{
if (dsOffset + dsSize > tableStream.length)
{
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Unhandled data structure points to outside the buffer. " +
"offset = " + dsOffset + ", length = " + dsSize +
", buffer length = " + tableStream.length);
}
log.log(POILogger.WARN, "Unhandled data structure points to outside the buffer. ",
"offset = ", dsOffset, ", length = ", dsSize,
", buffer length = ", tableStream.length);
}
else
{

View File

@ -177,7 +177,7 @@ public final class FileInformationBlock
/* The Word spec has a much smaller list of "valid" values
* to what the large CommonCrawl corpus contains!
*/
logger.log(POILogger.WARN, "Invalid file format version number: " + nfib + "("+nfibHex+")");
logger.log(POILogger.WARN, "Invalid file format version number: ", nfib, "(", nfibHex, ")");
}
}
@ -213,7 +213,7 @@ public final class FileInformationBlock
assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew );
break;
default:
logger.log(POILogger.WARN, "Invalid file format version number: " + getNFib());
logger.log(POILogger.WARN, "Invalid file format version number: ", getNFib());
}
}

View File

@ -141,18 +141,13 @@ public final class ListTables
{
ListData lst = _listMap.get(lsid);
if (lst == null) {
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "ListData for " +
lsid + " was null.");
}
log.log(POILogger.WARN, "ListData for ", lsid, " was null.");
return null;
}
if(level < lst.numLevels()) {
return lst.getLevels()[level];
}
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
}
log.log(POILogger.WARN, "Requested level ", level, " which was greater than the maximum defined (", lst.numLevels(), ")");
return null;
}

View File

@ -44,12 +44,9 @@ public class NilPICFAndBinData
if ( cbHeader != 0x44 )
{
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "NilPICFAndBinData at offset ", offset,
" cbHeader 0x" + Integer.toHexString(cbHeader)
+ " != 0x44"
);
}
log.log(POILogger.WARN, "NilPICFAndBinData at offset ", offset,
" cbHeader 0x", Integer.toHexString(cbHeader), " != 0x44"
);
}
// skip the 62 ignored bytes

View File

@ -69,7 +69,7 @@ public final class OldFfn {
Charset charset = null;
FontCharset wmfCharset = FontCharset.valueOf(chs & 0xff);
if (wmfCharset == null) {
logger.log(POILogger.WARN, "Couldn't find font for type: " + (chs & 0xff));
logger.log(POILogger.WARN, "Couldn't find font for type: ", (chs & 0xff));
} else {
charset = wmfCharset.getCharset();
}

View File

@ -72,14 +72,13 @@ public abstract class PropertyNode<T extends PropertyNode<T>> implements Compara
_buf = buf;
if (_cpStart < 0) {
_logger.log(POILogger.WARN, "A property claimed to start before zero, at " + _cpStart + "! Resetting it to zero, and hoping for the best");
_logger.log(POILogger.WARN, "A property claimed to start before zero, at ", _cpStart, "! Resetting it to zero, and hoping for the best");
_cpStart = 0;
}
if (_cpEnd < _cpStart) {
_logger.log(POILogger.WARN, "A property claimed to end (" + _cpEnd
+ ") before start! "
+ "Resetting end to start, and hoping for the best");
_logger.log(POILogger.WARN, "A property claimed to end (", _cpEnd,
") before start! Resetting end to start, and hoping for the best");
_cpEnd = _cpStart;
}
}

View File

@ -83,8 +83,8 @@ public class Sttb
{
POILogFactory.getLogger(Sttb.class).log(
POILogger.WARN,
"Non-extended character Pascal strings are not supported right now. "
+ "Creating empty values in the RevisionMarkAuthorTable for now. " +
"Non-extended character Pascal strings are not supported right now. ",
"Creating empty values in the RevisionMarkAuthorTable for now. ",
"Please, contact POI developers for update.");
//set data and extraData to empty values to avoid
//downstream NPE in case someone calls getEntries on RevisionMarkAuthorTable

View File

@ -113,7 +113,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
if ( warnAboutNonChpSprms )
{
logger.log( POILogger.WARN,
"Non-CHP SPRM returned by SprmIterator: " + sprm );
"Non-CHP SPRM returned by SprmIterator: ", sprm );
}
continue;
}
@ -706,7 +706,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
oldCHP.isFNoProof()));
break;
default:
logger.log( POILogger.DEBUG, "Unknown CHP sprm ignored: " + sprm );
logger.log( POILogger.DEBUG, "Unknown CHP sprm ignored: ", sprm );
break;
}
}

View File

@ -413,7 +413,7 @@ public final class ParagraphSprmUncompressor
newPAP.setRsid( sprm.getOperand() );
break;
default:
logger.log( POILogger.DEBUG, "Unknown PAP sprm ignored: " + sprm );
logger.log( POILogger.DEBUG, "Unknown PAP sprm ignored: ", sprm );
break;
}
}

View File

@ -824,10 +824,10 @@ public class Range {
initAll();
if ( tableEndInclusive >= this._parEnd )
{
logger.log( POILogger.WARN, "The table's bounds ", "["
+ this._parStart + "; " + tableEndInclusive + ")",
" fall outside of this Range paragraphs numbers ", "["
+ this._parStart + "; " + this._parEnd + ")" );
logger.log( POILogger.WARN, "The table's bounds ", "[",
this._parStart, "; ", tableEndInclusive, ")",
" fall outside of this Range paragraphs numbers [",
this._parStart, "; ", this._parEnd, ")" );
}
if ( tableEndInclusive < 0 )

View File

@ -189,11 +189,10 @@ public final class TableRow extends Range
if ( cells.size() != expectedCellsCount )
{
logger.log( POILogger.WARN,
"Number of found table cells (" + cells.size()
+ ") for table row [" + getStartOffset() + "c; "
+ getEndOffset()
+ "c] not equals to stored property value "
+ expectedCellsCount );
"Number of found table cells (", cells.size(),
") for table row [", getStartOffset(), "c; ",
getEndOffset(), "c] not equals to stored property value ",
expectedCellsCount );
_tprops.setItcMac( (short) cells.size() );
}

View File

@ -634,8 +634,8 @@ public class TestBugs{
{
PictureType pictureType = picture.suggestPictureType();
logger.log(POILogger.DEBUG,
"Picture at offset " + picture.getStartOffset()
+ " has type " + pictureType);
"Picture at offset ", picture.getStartOffset(),
" has type ", pictureType);
}
}

View File

@ -1445,9 +1445,7 @@ public abstract class BaseTestBugzillaIssues {
// Create a workbook
try (Workbook wb = _testDataProvider.createWorkbook(nrows+1)) {
final Sheet sh = wb.createSheet();
if (logger.check(POILogger.DEBUG)) {
logger.log(POILogger.DEBUG, wb.getClass().getName() + " column autosizing timing...");
}
logger.log(POILogger.DEBUG, wb.getClass().getName(), " column autosizing timing...");
final long t0 = time();
_testDataProvider.trackAllColumnsForAutosizing(sh);
@ -1461,7 +1459,7 @@ public abstract class BaseTestBugzillaIssues {
final double populateSheetTime = delta(t0);
final double populateSheetTimePerCell_ns = (1000000 * populateSheetTime / (nrows * ncols));
if (logger.check(POILogger.DEBUG)) {
logger.log(POILogger.DEBUG, "Populate sheet time: " + populateSheetTime + " ms (" + populateSheetTimePerCell_ns + " ns/cell)");
logger.log(POILogger.DEBUG, "Populate sheet time: ", populateSheetTime, " ms (", populateSheetTimePerCell_ns, " ns/cell)");
logger.log(POILogger.DEBUG, "Autosizing...");
}
@ -1469,24 +1467,19 @@ public abstract class BaseTestBugzillaIssues {
for (int c = 0; c < ncols; c++) {
final long t2 = time();
sh.autoSizeColumn(c);
if (logger.check(POILogger.DEBUG)) {
logger.log(POILogger.DEBUG, "Column " + c + " took " + delta(t2) + " ms");
}
logger.log(POILogger.DEBUG, "Column ", c, " took ", delta(t2), " ms");
}
final double autoSizeColumnsTime = delta(t1);
final double autoSizeColumnsTimePerColumn = autoSizeColumnsTime / ncols;
final double bestFitWidthTimePerCell_ns = 1000000 * autoSizeColumnsTime / (ncols * nrows);
if (logger.check(POILogger.DEBUG)) {
logger.log(POILogger.DEBUG, "Auto sizing columns took a total of " + autoSizeColumnsTime + " ms (" + autoSizeColumnsTimePerColumn + " ms per column)");
logger.log(POILogger.DEBUG, "Best fit width time per cell: " + bestFitWidthTimePerCell_ns + " ns");
logger.log(POILogger.DEBUG, "Auto sizing columns took a total of ", autoSizeColumnsTime, " ms (", autoSizeColumnsTimePerColumn, " ms per column)");
logger.log(POILogger.DEBUG, "Best fit width time per cell: ", bestFitWidthTimePerCell_ns, " ns");
}
final double totalTime_s = (populateSheetTime + autoSizeColumnsTime) / 1000;
if (logger.check(POILogger.DEBUG)) {
logger.log(POILogger.DEBUG, "Total time: " + totalTime_s + " s");
}
logger.log(POILogger.DEBUG, "Total time: ", totalTime_s, " s");
}
//if (bestFitWidthTimePerCell_ns > 50000) {