diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-01-17 17:31:22 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-01-17 17:31:22 +0000 |
commit | 3778a3e9e24470499ebf0310a50848bdee266488 (patch) | |
tree | b368867c2860cb3a3d173370575fd853c28c240f /src/scratchpad | |
parent | 8d0e84f2573db52a201e842fad51ed067d65cfb6 (diff) | |
download | poi-3778a3e9e24470499ebf0310a50848bdee266488.tar.gz poi-3778a3e9e24470499ebf0310a50848bdee266488.zip |
Sonar fixes
constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'
reorder "final static" -> "static final"
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885613 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
82 files changed, 397 insertions, 427 deletions
diff --git a/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java b/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java index 40904fe718..30936c4690 100644 --- a/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java +++ b/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java @@ -58,7 +58,7 @@ import org.apache.poi.util.POILogger; */ @SuppressWarnings("WeakerAccess") public class OLE2ScratchpadExtractorFactory implements ExtractorProvider { - private static final POILogger logger = POILogFactory.getLogger(OLE2ScratchpadExtractorFactory.class); + private static final POILogger LOG = POILogFactory.getLogger(OLE2ScratchpadExtractorFactory.class); @Override public boolean accepts(FileMagic fm) { @@ -169,7 +169,7 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider { .filter(entry -> entry.getName().startsWith("_")) .forEach(dirs::add); } catch(FileNotFoundException e) { - logger.log(POILogger.INFO, "Ignoring FileNotFoundException while extracting Word document", e.getLocalizedMessage()); + LOG.log(POILogger.INFO, "Ignoring FileNotFoundException while extracting Word document", e.getLocalizedMessage()); // ignored here } //} else if(ext instanceof PowerPointExtractor) { diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java index 9c1716b571..ef9d42b412 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java @@ -28,16 +28,19 @@ import org.apache.poi.util.POILogger; * Base of all chunks, which hold data, flags etc */ public final class Chunk { + /** For logging warnings about the structure of the file */ + private static final POILogger LOG = POILogFactory.getLogger(Chunk.class); + /** * The contents of the chunk, excluding the header, * trailer and separator */ - private byte[] contents; - private ChunkHeader header; + private final byte[] contents; + private final ChunkHeader header; /** May be null */ - private ChunkTrailer trailer; + private final ChunkTrailer trailer; /** May be null */ - private ChunkSeparator separator; + private final ChunkSeparator separator; /** The possible different commands we can hold */ private CommandDefinition[] commandDefinitions; /** The command+value pairs we hold */ @@ -47,9 +50,6 @@ public final class Chunk { /** The name of the chunk, as found from the commandDefinitions */ private String name; - /** For logging warnings about the structure of the file */ - private POILogger logger = POILogFactory.getLogger(Chunk.class); - public Chunk(ChunkHeader header, ChunkTrailer trailer, ChunkSeparator separator, byte[] contents) { this.header = header; this.trailer = trailer; @@ -179,7 +179,7 @@ public final class Chunk { // Check we seem to have enough data if(offset >= contents.length) { - logger.log(POILogger.WARN, + LOG.log(POILogger.WARN, "Command offset ", offset, " past end of data at ", contents.length ); continue; @@ -241,12 +241,12 @@ public final class Chunk { break; default: - logger.log(POILogger.INFO, + LOG.log(POILogger.INFO, "Command of type ", type, " not processed!"); } } catch (Exception e) { - logger.log(POILogger.ERROR, "Unexpected error processing command, ignoring and continuing. Command: ", command, e); + LOG.log(POILogger.ERROR, "Unexpected error processing command, ignoring and continuing. Command: ", command, e); } // Add to the array diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java index 101d4545ba..6bf22a02d7 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java @@ -59,7 +59,7 @@ public final class ChunkFactory { "/org/apache/poi/hdgf/chunks_parse_cmds.tbl"; /** For logging problems we spot with the file */ - private static final POILogger logger = POILogFactory.getLogger(ChunkFactory.class); + private static final POILogger LOG = POILogFactory.getLogger(ChunkFactory.class); public ChunkFactory(int version) throws IOException { this.version = version; @@ -139,7 +139,7 @@ public final class ChunkFactory { // Check we have enough data, and tweak the header size // as required if(endOfDataPos > data.length) { - logger.log(POILogger.WARN, + LOG.log(POILogger.WARN, "Header called for ", header.getLength(), " bytes, but that would take us past the end of the data!"); endOfDataPos = data.length; @@ -165,7 +165,7 @@ public final class ChunkFactory { data, endOfDataPos); endOfDataPos += 8; } else { - logger.log(POILogger.ERROR, "Header claims a length to ", endOfDataPos, " there's then no space for the trailer in the data (", data.length, ")"); + LOG.log(POILogger.ERROR, "Header claims a length to ", endOfDataPos, " there's then no space for the trailer in the data (", data.length, ")"); } } if(header.hasSeparator()) { @@ -173,7 +173,7 @@ public final class ChunkFactory { separator = new ChunkSeparator( data, endOfDataPos); } else { - logger.log(POILogger.ERROR, "Header claims a length to ", endOfDataPos, " there's then no space for the separator in the data (", data.length, ")"); + LOG.log(POILogger.ERROR, "Header claims a length to ", endOfDataPos, " there's then no space for the separator in the data (", data.length, ")"); } } diff --git a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java index a8798a8d2f..a82e914edd 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java @@ -35,7 +35,7 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; * of a Visio file */ public final class VSDDumper { - final static String tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; + static final String tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; private final PrintStream ps; private final HDGFDiagram hdgf; diff --git a/src/scratchpad/src/org/apache/poi/hdgf/streams/ChunkStream.java b/src/scratchpad/src/org/apache/poi/hdgf/streams/ChunkStream.java index 143d5ad0a2..dc923c588d 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/streams/ChunkStream.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/streams/ChunkStream.java @@ -27,13 +27,13 @@ import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; public final class ChunkStream extends Stream { - private final static POILogger logger = POILogFactory.getLogger(ChunkStream.class); - - private ChunkFactory chunkFactory; + private static final POILogger LOG = POILogFactory.getLogger(ChunkStream.class); + + private final ChunkFactory chunkFactory; /** All the Chunks we contain */ private Chunk[] chunks; - protected ChunkStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory) { + ChunkStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory) { super(pointer, store); this.chunkFactory = chunkFactory; @@ -66,14 +66,14 @@ 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"); + LOG.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; } } } catch (Exception e) { - logger.log(POILogger.ERROR, "Failed to create chunk at ", pos, ", ignoring rest of data." + e); + LOG.log(POILogger.ERROR, "Failed to create chunk at ", pos, ", ignoring rest of data." + e); } chunks = chunksA.toArray(new Chunk[0]); diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfComment.java b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfComment.java index 2590fd85b9..0d42389055 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfComment.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfComment.java @@ -52,7 +52,7 @@ import org.apache.poi.util.RecordFormatException; */ @Internal public class HemfComment { - private static final POILogger logger = POILogFactory.getLogger(HemfComment.class); + private static final POILogger LOG = POILogFactory.getLogger(HemfComment.class); private static final int MAX_RECORD_LENGTH = HwmfPicture.MAX_RECORD_LENGTH; public enum HemfCommentRecordType { @@ -601,7 +601,7 @@ public class HemfComment { // some emf comments are truncated, so we don't use readFully here int readBytes = leis.read(wmfData); if (readBytes < wmfData.length) { - logger.log(POILogger.INFO, "Emf comment with WMF: expected ", wmfData.length, + LOG.log(POILogger.INFO, "Emf comment with WMF: expected ", wmfData.length, " bytes - received only ", readBytes, " bytes."); } diff --git a/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java b/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java index 7d0fc5c2d3..cd00d453cc 100644 --- a/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java +++ b/src/scratchpad/src/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java @@ -295,62 +295,62 @@ public class HemfPlusPen { /** * If set, a 2x3 transform matrix MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField TRANSFORM = BitFieldFactory.getInstance(0x00000001); + private static final BitField TRANSFORM = BitFieldFactory.getInstance(0x00000001); /** * If set, the style of a starting line cap MUST be specified in the OptionalData field of an * EmfPlusPenData object. */ - private final static BitField START_CAP = BitFieldFactory.getInstance(0x00000002); + private static final BitField START_CAP = BitFieldFactory.getInstance(0x00000002); /** * Indicates whether the style of an ending line cap MUST be specified in the OptionalData field * of an EmfPlusPenData object. */ - private final static BitField END_CAP = BitFieldFactory.getInstance(0x00000004); + private static final BitField END_CAP = BitFieldFactory.getInstance(0x00000004); /** * Indicates whether a line join type MUST be specified in the OptionalData * field of an EmfPlusPenData object. */ - private final static BitField JOIN = BitFieldFactory.getInstance(0x00000008); + private static final BitField JOIN = BitFieldFactory.getInstance(0x00000008); /** * Indicates whether a miter limit MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField MITER_LIMIT = BitFieldFactory.getInstance(0x00000010); + private static final BitField MITER_LIMIT = BitFieldFactory.getInstance(0x00000010); /** * Indicates whether a line style MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField LINE_STYLE = BitFieldFactory.getInstance(0x00000020); + private static final BitField LINE_STYLE = BitFieldFactory.getInstance(0x00000020); /** * Indicates whether a dashed line cap MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField DASHED_LINE_CAP = BitFieldFactory.getInstance(0x00000040); + private static final BitField DASHED_LINE_CAP = BitFieldFactory.getInstance(0x00000040); /** * Indicates whether a dashed line offset MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField DASHED_LINE_OFFSET = BitFieldFactory.getInstance(0x00000080); + private static final BitField DASHED_LINE_OFFSET = BitFieldFactory.getInstance(0x00000080); /** * Indicates whether an EmfPlusDashedLineData object MUST be specified in the * OptionalData field of an EmfPlusPenData object. */ - private final static BitField DASHED_LINE = BitFieldFactory.getInstance(0x00000100); + private static final BitField DASHED_LINE = BitFieldFactory.getInstance(0x00000100); /** * Indicates whether a pen alignment MUST be specified in the OptionalData field of an EmfPlusPenData object. */ - private final static BitField NON_CENTER = BitFieldFactory.getInstance(0x00000200); + private static final BitField NON_CENTER = BitFieldFactory.getInstance(0x00000200); /** * Indicates whether the length and content of a EmfPlusCompoundLineData object are present in the * OptionalData field of an EmfPlusPenData object. */ - private final static BitField COMPOUND_LINE = BitFieldFactory.getInstance(0x00000400); + private static final BitField COMPOUND_LINE = BitFieldFactory.getInstance(0x00000400); /** * Indicates whether an EmfPlusCustomStartCapData object MUST be specified * in the OptionalData field of an EmfPlusPenData object.y */ - private final static BitField CUSTOM_START_CAP = BitFieldFactory.getInstance(0x00000800); + private static final BitField CUSTOM_START_CAP = BitFieldFactory.getInstance(0x00000800); /** * Indicates whether an EmfPlusCustomEndCapData object MUST be specified in * the OptionalData field of an EmfPlusPenData object. */ - private final static BitField CUSTOM_END_CAP = BitFieldFactory.getInstance(0x00001000); + private static final BitField CUSTOM_END_CAP = BitFieldFactory.getInstance(0x00001000); private static final int[] FLAGS_MASKS = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, diff --git a/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIDateAttribute.java b/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIDateAttribute.java index 1d8956c374..e70d7ca480 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIDateAttribute.java +++ b/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIDateAttribute.java @@ -33,25 +33,25 @@ import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; /** - * A pure-MAPI attribute holding a Date, which applies + * A pure-MAPI attribute holding a Date, which applies * to a {@link HMEFMessage} or one of its {@link Attachment}s. - * + * * Timestamps are usually given in UTC. - * + * * @see <a href="https://msdn.microsoft.com/en-us/library/cc433482(v=exchg.80).aspx">[MS-OXOMSG]: Email Object Protocol</a> * @see <a href="https://msdn.microsoft.com/en-us/library/cc433490(v=exchg.80).aspx">[MS-OXPROPS]: Exchange Server Protocols Master Property List</a> */ public final class MAPIDateAttribute extends MAPIAttribute { - private final static POILogger logger = POILogFactory.getLogger(MAPIDateAttribute.class); - private Date data; - + private static final POILogger LOG = POILogFactory.getLogger(MAPIDateAttribute.class); + private final Date data; + /** * Constructs a single new date attribute from the id, type, * and the contents of the stream */ protected MAPIDateAttribute(MAPIProperty property, int type, byte[] data) { super(property, type, data); - + // The value is a 64 bit Windows Filetime this.data = Filetime.filetimeToDate( LittleEndian.getLong(data, 0) @@ -61,14 +61,14 @@ public final class MAPIDateAttribute extends MAPIAttribute { public Date getDate() { return this.data; } - + public String toString() { DateFormatSymbols dfs = DateFormatSymbols.getInstance(Locale.ROOT); DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", dfs); df.setTimeZone(LocaleUtil.TIMEZONE_UTC); return getProperty() + " " + df.format(data); } - + /** * Returns the Date of a Attribute, converting as appropriate */ @@ -79,8 +79,8 @@ public final class MAPIDateAttribute extends MAPIAttribute { if(attr instanceof MAPIDateAttribute) { return ((MAPIDateAttribute)attr).getDate(); } - - logger.log(POILogger.WARN, "Warning, non date property found: ", attr); + + LOG.log(POILogger.WARN, "Warning, non date property found: ", attr); return null; } } diff --git a/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIStringAttribute.java b/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIStringAttribute.java index 952ad14465..d91449e5ca 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIStringAttribute.java +++ b/src/scratchpad/src/org/apache/poi/hmef/attribute/MAPIStringAttribute.java @@ -28,17 +28,17 @@ import org.apache.poi.util.POILogger; import org.apache.poi.util.StringUtil; /** - * A pure-MAPI attribute holding a String, which applies + * A pure-MAPI attribute holding a String, which applies * to a {@link HMEFMessage} or one of its {@link Attachment}s. */ public final class MAPIStringAttribute extends MAPIAttribute { - private final static POILogger logger = POILogFactory.getLogger(MAPIStringAttribute.class); + private static final POILogger LOG = POILogFactory.getLogger(MAPIStringAttribute.class); private static final String CODEPAGE = "CP1252"; private final String data; - + public MAPIStringAttribute(MAPIProperty property, int type, byte[] data) { super(property, type, data); - + String tmpData = null; if(type == Types.ASCII_STRING.getId()) { tmpData = new String(data, Charset.forName(CODEPAGE)); @@ -47,22 +47,22 @@ public final class MAPIStringAttribute extends MAPIAttribute { } else { throw new IllegalArgumentException("Not a string type " + type); } - + // Strip off the null terminator if present if(tmpData.endsWith("\0")) { tmpData = tmpData.substring(0, tmpData.length()-1); } this.data = tmpData; } - + public String getDataString() { return data; } - + public String toString() { return getProperty() + " " + data; } - + /** * Returns the string of a Attribute, converting as appropriate */ @@ -76,8 +76,8 @@ public final class MAPIStringAttribute extends MAPIAttribute { if(attr instanceof MAPIRtfAttribute) { return ((MAPIRtfAttribute)attr).getDataString(); } - - logger.log(POILogger.WARN, "Warning, non string property found: ", attr); + + LOG.log(POILogger.WARN, "Warning, non string property found: ", attr); return null; } } diff --git a/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFDateAttribute.java b/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFDateAttribute.java index 764b308089..e9f4e6e22a 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFDateAttribute.java +++ b/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFDateAttribute.java @@ -39,16 +39,16 @@ import org.apache.poi.util.POILogger; * or one of its {@link Attachment}s. */ public final class TNEFDateAttribute extends TNEFAttribute { - private final static POILogger logger = POILogFactory.getLogger(TNEFDateAttribute.class); - private Date data; - + private static final POILogger LOG = POILogFactory.getLogger(TNEFDateAttribute.class); + private final Date data; + /** * Constructs a single new date attribute from the id, type, * and the contents of the stream */ protected TNEFDateAttribute(int id, int type, InputStream inp) throws IOException { super(id, type, inp); - + byte[] binData = getData(); if(binData.length == 8) { // The value is a 64 bit Windows Filetime @@ -75,15 +75,15 @@ public final class TNEFDateAttribute extends TNEFAttribute { public Date getDate() { return this.data; } - + public String toString() { DateFormatSymbols dfs = DateFormatSymbols.getInstance(Locale.ROOT); DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", dfs); - df.setTimeZone(LocaleUtil.TIMEZONE_UTC); + df.setTimeZone(LocaleUtil.TIMEZONE_UTC); return "Attribute " + getProperty() + ", type=" + getType() + - ", date=" + df.format(data); + ", date=" + df.format(data); } - + /** * Returns the Date of a Attribute, converting as appropriate */ @@ -94,8 +94,8 @@ public final class TNEFDateAttribute extends TNEFAttribute { if(attr instanceof TNEFDateAttribute) { return ((TNEFDateAttribute)attr).getDate(); } - - logger.log(POILogger.WARN, "Warning, non date property found: ", attr); + + LOG.log(POILogger.WARN, "Warning, non date property found: ", attr); return null; } } diff --git a/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFStringAttribute.java b/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFStringAttribute.java index b7cd4690a0..e5e79dfebf 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFStringAttribute.java +++ b/src/scratchpad/src/org/apache/poi/hmef/attribute/TNEFStringAttribute.java @@ -31,16 +31,16 @@ import org.apache.poi.util.StringUtil; * or one of its {@link Attachment}s. */ public final class TNEFStringAttribute extends TNEFAttribute { - private final static POILogger logger = POILogFactory.getLogger(TNEFStringAttribute.class); - private String data; - + private static final POILogger LOG = POILogFactory.getLogger(TNEFStringAttribute.class); + private final String data; + /** * Constructs a single new string attribute from the id, type, * and the contents of the stream */ protected TNEFStringAttribute(int id, int type, InputStream inp) throws IOException { super(id, type, inp); - + String tmpData = null; byte[] data = getData(); if(getType() == TNEFProperty.TYPE_TEXT) { @@ -50,7 +50,7 @@ public final class TNEFStringAttribute extends TNEFAttribute { data, 0, data.length ); } - + // Strip off the null terminator if present if(tmpData.endsWith("\0")) { tmpData = tmpData.substring(0, tmpData.length()-1); @@ -61,12 +61,12 @@ public final class TNEFStringAttribute extends TNEFAttribute { public String getString() { return this.data; } - + public String toString() { return "Attribute " + getProperty() + ", type=" + getType() + - ", data=" + getString(); + ", data=" + getString(); } - + /** * Returns the string of a Attribute, converting as appropriate */ @@ -77,8 +77,8 @@ public final class TNEFStringAttribute extends TNEFAttribute { if(attr instanceof TNEFStringAttribute) { return ((TNEFStringAttribute)attr).getString(); } - - logger.log(POILogger.WARN, "Warning, non string property found: ", attr); + + LOG.log(POILogger.WARN, "Warning, non string property found: ", attr); return null; } } diff --git a/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java b/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java index ab5b5d09e9..4c50e690ca 100644 --- a/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java +++ b/src/scratchpad/src/org/apache/poi/hpbf/model/QuillContents.java @@ -34,12 +34,12 @@ import org.apache.poi.util.POILogger; * Read Quill Contents (/Quill/QuillSub/CONTENTS) from an HPBF (Publisher .pub) document */ public final class QuillContents extends HPBFPart { - private static POILogger logger = POILogFactory.getLogger(QuillContents.class); + private static final POILogger LOG = POILogFactory.getLogger(QuillContents.class); //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 1_000_000; private static final String[] PATH = { "Quill", "QuillSub", "CONTENTS", }; - private QCBit[] bits; + private final QCBit[] bits; public QuillContents(DirectoryNode baseDir) throws IOException { super(baseDir, PATH); @@ -79,7 +79,7 @@ public final class QuillContents extends HPBFPart { bits[i] = QCPLCBit.createQCPLCBit(thingType, bitType, bitData); } catch (ArrayIndexOutOfBoundsException e) { // bug 60685: fall back so that the rest of the document can be read - logger.log(POILogger.WARN, "Unable to read Quill Contents PLC Bit record. Ignoring this record."); + LOG.log(POILogger.WARN, "Unable to read Quill Contents PLC Bit record. Ignoring this record."); bits[i] = new UnknownQCBit(thingType, bitType, bitData); } } else { diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java index d1699779f0..8463080ca3 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java @@ -44,7 +44,7 @@ import org.apache.poi.util.HexDump; * @author Nick Burch */ public final class SlideShowRecordDumper { - final static String tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; + static final String tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; private boolean optVerbose; private boolean optEscher; diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java index 6466748a6a..8851d6c269 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java @@ -34,7 +34,7 @@ import org.apache.poi.util.POILogger; * (but related) properties */ public abstract class BitMaskTextProp extends TextProp { - protected static final POILogger logger = POILogFactory.getLogger(BitMaskTextProp.class); + protected static final POILogger LOG = POILogFactory.getLogger(BitMaskTextProp.class); private String[] subPropNames; private int[] subPropMasks; @@ -148,8 +148,8 @@ 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"); - if (logger.check(POILogger.DEBUG)) { + LOG.log(POILogger.WARN, "Style properties of '", getName(), "' don't match mask - output will be sanitized"); + if (LOG.check(POILogger.DEBUG)) { StringBuilder sb = new StringBuilder("The following style attributes of the '") .append(getName()).append("' property will be ignored:\n"); int i=0; @@ -159,7 +159,7 @@ public abstract class BitMaskTextProp extends TextProp { } i++; } - logger.log(POILogger.DEBUG, sb.toString()); + LOG.log(POILogger.DEBUG, sb.toString()); } } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java index 0ad60d0e7a..927cbe553d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java @@ -41,8 +41,8 @@ import org.apache.poi.util.LittleEndian; */ public class TextPFException9 implements GenericRecord { - private final static AutoNumberingScheme DEFAULT_AUTONUMBER_SCHEME = AutoNumberingScheme.arabicPeriod; - private final static Short DEFAULT_START_NUMBER = 1; + private static final AutoNumberingScheme DEFAULT_AUTONUMBER_SCHEME = AutoNumberingScheme.arabicPeriod; + private static final Short DEFAULT_START_NUMBER = 1; //private final byte mask1; //private final byte mask2; diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfo.java b/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfo.java index 7b8e173ec1..ded20953dd 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfo.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfo.java @@ -58,7 +58,7 @@ public final class AnimationInfo extends RecordContainer { if(_children[0] instanceof AnimationInfoAtom) { animationAtom = (AnimationInfoAtom)_children[0]; } else { - logger.log(POILogger.ERROR, "First child record wasn't a AnimationInfoAtom, was of type ", _children[0].getRecordType()); + LOG.log(POILogger.ERROR, "First child record wasn't a AnimationInfoAtom, was of type ", _children[0].getRecordType()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java index 181a960ef0..9f12084e15 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java @@ -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()); + LOG.log(POILogger.WARN, "Unexpected record with type=", r.getRecordType(), " in Comment2000: ", r.getClass().getName()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java index 01098dfd19..d3793ce15c 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java @@ -46,7 +46,7 @@ import org.apache.poi.util.StringUtil; */ public class CurrentUserAtom { - private final static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class); + private static final POILogger LOG = POILogFactory.getLogger(CurrentUserAtom.class); //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 1_000_000; @@ -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"); + LOG.log(POILogger.WARN, "Warning - invalid username length ", usernameLen, " found, treating as if there was no username set"); usernameLen = 0; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Document.java b/src/scratchpad/src/org/apache/poi/hslf/record/Document.java index 01710d0f71..007c83f9f6 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Document.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Document.java @@ -161,10 +161,10 @@ public final class Document extends PositionDependentRecordContainer // (normally it's 2, or 3 if you have notes) // Complain if it's not if(slwtcount == 0) { - logger.log(POILogger.WARN, "No SlideListWithText's found - there should normally be at least one!"); + LOG.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!"); + LOG.log(POILogger.WARN, "Found ", slwtcount, " SlideListWithTexts - normally there should only be three!"); } // Now grab all the SLWTs diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java index bc0de3d22f..7cb1caa894 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java @@ -105,14 +105,14 @@ public class ExEmbed extends RecordContainer { if(_children[0] instanceof ExEmbedAtom) { embedAtom = (ExEmbedAtom)_children[0]; } else { - logger.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type ", _children[0].getRecordType()); + LOG.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type ", _children[0].getRecordType()); } // Second child should be the ExOleObjAtom if (_children[1] instanceof ExOleObjAtom) { oleObjAtom = (ExOleObjAtom)_children[1]; } else { - logger.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type ", _children[1].getRecordType()); + LOG.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type ", _children[1].getRecordType()); } for (int i = 2; i < _children.length; i++) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java index c0cdd557c6..eeb260cf1a 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java @@ -118,7 +118,7 @@ public class ExHyperlink extends RecordContainer { if(_children[0] instanceof ExHyperlinkAtom) { linkAtom = (ExHyperlinkAtom)_children[0]; } else { - logger.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type ", _children[0].getRecordType()); + LOG.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type ", _children[0].getRecordType()); } for (int i = 1; i < _children.length; i++) { @@ -126,7 +126,7 @@ public class ExHyperlink extends RecordContainer { if ( linkDetailsA == null) linkDetailsA = (CString)_children[i]; else linkDetailsB = (CString)_children[i]; } else { - logger.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type ", _children[1].getRecordType()); + LOG.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type ", _children[1].getRecordType()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java index 58fb5c1c0f..e1f9375184 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java @@ -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()); + LOG.log(POILogger.ERROR, "First child record wasn't a ExVideoContainer, was of type ", _children[0].getRecordType()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java index 430b774b1b..3787a99860 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java @@ -60,12 +60,12 @@ public final class ExVideoContainer extends RecordContainer { if(_children[0] instanceof ExMediaAtom) { mediaAtom = (ExMediaAtom)_children[0]; } else { - logger.log(POILogger.ERROR, "First child record wasn't a ExMediaAtom, was of type ", _children[0].getRecordType()); + LOG.log(POILogger.ERROR, "First child record wasn't a ExMediaAtom, was of type ", _children[0].getRecordType()); } if(_children[1] instanceof CString) { pathAtom = (CString)_children[1]; } else { - logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type ", _children[1].getRecordType()); + LOG.log(POILogger.ERROR, "Second child record wasn't a CString, was of type ", _children[1].getRecordType()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java b/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java index c8e47ab13b..c3e17e89db 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java @@ -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()); + LOG.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was ", r.getClass().getSimpleName()); } } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java b/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java index 022eb116d2..ff4eaf478f 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java @@ -89,11 +89,11 @@ public final class HeadersFootersContainer extends RecordContainer { csFooter = cs; break; default: - logger.log(POILogger.WARN, "Unexpected CString.Options in HeadersFootersContainer: ", opts); + LOG.log(POILogger.WARN, "Unexpected CString.Options in HeadersFootersContainer: ", opts); break; } } else { - logger.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: ", child); + LOG.log(POILogger.WARN, "Unexpected record in HeadersFootersContainer: ", child); } } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java b/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java index 76b84c554a..53cf4639ed 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java @@ -61,7 +61,7 @@ public class InteractiveInfo extends RecordContainer { private void findInterestingChildren() { // First child should be the InteractiveInfoAtom if (_children == null || _children.length == 0 || !(_children[0] instanceof InteractiveInfoAtom)) { - logger.log(POILogger.WARN, "First child record wasn't a InteractiveInfoAtom - leaving this atom in an invalid state..."); + LOG.log(POILogger.WARN, "First child record wasn't a InteractiveInfoAtom - leaving this atom in an invalid state..."); return; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java index 8da3d439b6..82cc9e13ac 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java @@ -85,7 +85,7 @@ public final class MasterTextPropAtom extends RecordAtom { try { read(); } catch (Exception e){ - logger.log(POILogger.ERROR, "Failed to parse MasterTextPropAtom", e); + LOG.log(POILogger.ERROR, "Failed to parse MasterTextPropAtom", e); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java b/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java index dddfaec55f..bb55a91eef 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java @@ -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); + LOG.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()); + LOG.log(POILogger.WARN, "Record length=", escherBytes, " but getRecordSize() returned ", r.getRecordSize(), "; record: ", r.getClass()); size = escherBytes; } startPos += size; diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java b/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java index 0084d9020b..2b3f5eef9b 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java @@ -176,8 +176,8 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom if (newPos == null) { Integer id = me.getKey(); - logger.log(POILogger.WARN, "Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos); - logger.log(POILogger.WARN, "Not updating the position of it, you probably won't be able to find it any more (if you ever could!)"); + LOG.log(POILogger.WARN, "Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos); + LOG.log(POILogger.WARN, "Not updating the position of it, you probably won't be able to find it any more (if you ever could!)"); } else { me.setValue(newPos); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Record.java b/src/scratchpad/src/org/apache/poi/hslf/record/Record.java index cf6b738ddb..dba30ed230 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Record.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Record.java @@ -42,7 +42,7 @@ import org.apache.poi.util.POILogger; public abstract class Record implements GenericRecord { // For logging - protected static final POILogger logger = POILogFactory.getLogger(Record.class); + protected static final POILogger LOG = POILogFactory.getLogger(Record.class); /** * Is this record type an Atom record (only has data), @@ -183,7 +183,7 @@ public abstract class Record implements GenericRecord // Handle case of a corrupt last record, whose claimed length // would take us passed the end of the file if(start + len > b.length ) { - logger.log(POILogger.WARN, "Warning: Skipping record of type " + type + " at position " + start + " which claims to be longer than the file! (" + len + " vs " + (b.length-start) + ")"); + LOG.log(POILogger.WARN, "Warning: Skipping record of type " + type + " at position " + start + " which claims to be longer than the file! (" + len + " vs " + (b.length-start) + ")"); return null; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java b/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java index df9c245d6d..41c97a934d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java @@ -68,14 +68,14 @@ public final class Sound extends RecordContainer { if(_children[0] instanceof CString) { _name = (CString)_children[0]; } else { - logger.log(POILogger.ERROR, "First child record wasn't a CString, was of type ", _children[0].getRecordType()); + LOG.log(POILogger.ERROR, "First child record wasn't a CString, was of type ", _children[0].getRecordType()); } // Second child should be the ExOleObjAtom if (_children[1] instanceof CString) { _type = (CString)_children[1]; } else { - logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type ", _children[1].getRecordType()); + LOG.log(POILogger.ERROR, "Second child record wasn't a CString, was of type ", _children[1].getRecordType()); } for (int i = 2; i < _children.length; i++) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java index 5ed2fe45b5..fe9e11fcbe 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java @@ -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)); + LOG.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)); + LOG.log(POILogger.WARN, "Problem reading character style runs: textHandled = ", textHandled, ", text.size+1 = ", (size+1)); } // Handle anything left over @@ -296,7 +296,7 @@ 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, + LOG.log(POILogger.WARN, "Style length of ", readLength, " at ", handledSoFar, " larger than stated size of ", overallSize, ", truncating"); return overallSize + 1 - handledSoFar; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java index 2ffb80a949..9ca6644789 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java @@ -98,7 +98,7 @@ public final class TextRulerAtom extends RecordAtom { // Get the record data. read(leis); } catch (IOException e){ - logger.log(POILogger.ERROR, "Failed to parse TextRulerAtom: ", e.getMessage()); + LOG.log(POILogger.ERROR, "Failed to parse TextRulerAtom: ", e.getMessage()); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java index 70f15e0213..f5806790a5 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFNotes.java @@ -36,14 +36,14 @@ import org.apache.poi.util.POILogger; */ public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape,HSLFTextParagraph> { - protected static final POILogger logger = POILogFactory.getLogger(HSLFNotes.class); - - private List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<>(); + private static final POILogger LOG = POILogFactory.getLogger(HSLFNotes.class); + + private final List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<>(); /** * Constructs a Notes Sheet from the given Notes record. * Initialises TextRuns, to provide easier access to the text - * + * * @param notes the Notes record to read from */ public HSLFNotes(org.apache.poi.hslf.record.Notes notes) { @@ -55,9 +55,9 @@ public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape,HSLFTe for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) { if (!_paragraphs.contains(l)) _paragraphs.add(l); } - + if (_paragraphs.isEmpty()) { - logger.log(POILogger.WARN, "No text records found for notes sheet"); + LOG.log(POILogger.WARN, "No text records found for notes sheet"); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java index 15273ddb05..67896494de 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShapeFactory.java @@ -45,12 +45,10 @@ import org.apache.poi.util.POILogger; /** * Create a <code>Shape</code> object depending on its type - * - * @author Yegor Kozlov */ public final class HSLFShapeFactory { // For logging - protected static final POILogger logger = POILogFactory.getLogger(HSLFShapeFactory.class); + private static final POILogger LOG = POILogFactory.getLogger(HSLFShapeFactory.class); /** * Create a new shape from the data provided. @@ -79,15 +77,15 @@ public final class HSLFShapeFactory { } } } - + HSLFGroupShape group; if (isTable) { group = new HSLFTable(spContainer, parent); - + } else { group = new HSLFGroupShape(spContainer, parent); } - + return group; } @@ -114,7 +112,7 @@ public final class HSLFShapeFactory { if (parent instanceof HSLFTable) { EscherTextboxRecord etr = spContainer.getChildById(EscherTextboxRecord.RECORD_ID); if (etr == null) { - logger.log(POILogger.WARN, "invalid ppt - add EscherTextboxRecord to cell"); + LOG.log(POILogger.WARN, "invalid ppt - add EscherTextboxRecord to cell"); etr = new EscherTextboxRecord(); etr.setRecordId(EscherTextboxRecord.RECORD_ID); etr.setOptions((short)15); @@ -141,24 +139,24 @@ public final class HSLFShapeFactory { break; } } - + ExObjRefAtom oes = getClientDataRecord(spContainer, RecordTypes.ExObjRefAtom.typeID); return (oes != null) ? new HSLFObjectShape(spContainer, parent) : new HSLFPictureShape(spContainer, parent); } - + private static HSLFShape createNonPrimitive(EscherContainerRecord spContainer, ShapeContainer<HSLFShape,HSLFTextParagraph> parent) { AbstractEscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID); EscherProperty prop = HSLFShape.getEscherProperty(opt, EscherPropertyTypes.GEOMETRY__VERTICES); if(prop != null) { return new HSLFFreeformShape(spContainer, parent); } - - logger.log(POILogger.INFO, "Creating AutoShape for a NotPrimitive shape"); + + LOG.log(POILogger.INFO, "Creating AutoShape for a NotPrimitive shape"); return new HSLFAutoShape(spContainer, parent); } - + @SuppressWarnings("unchecked") protected static <T extends Record> T getClientDataRecord(EscherContainerRecord spContainer, int recordType) { HSLFEscherClientDataRecord cldata = spContainer.getChildById(EscherClientDataRecord.RECORD_ID); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java index fff3764bb4..922bbfc3f0 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java @@ -60,7 +60,7 @@ import org.apache.poi.util.Units; public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<HSLFShape,HSLFTextParagraph> { private static final POILogger LOG = POILogFactory.getLogger(HSLFSimpleShape.class); - public final static double DEFAULT_LINE_WIDTH = 0.75; + public static final double DEFAULT_LINE_WIDTH = 0.75; protected static final EscherPropertyTypes[] ADJUST_VALUES = { EscherPropertyTypes.GEOMETRY__ADJUSTVALUE, diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java index 9e8d255798..6052a49800 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java @@ -73,14 +73,17 @@ import org.apache.poi.util.Units; */ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFShape,HSLFTextParagraph>, Closeable, GenericRecord { - //arbitrarily selected; may need to increase - private static final int MAX_RECORD_LENGTH = 10_000_000; - /** Powerpoint document entry/stream name */ - public static final String POWERPOINT_DOCUMENT = "PowerPoint Document"; + public static final String POWERPOINT_DOCUMENT = "PowerPoint Document"; public static final String PP97_DOCUMENT = "PP97_DUALSTORAGE"; public static final String PP95_DOCUMENT = "PP40"; + // For logging + private static final POILogger LOG = POILogFactory.getLogger(HSLFSlideShow.class); + + //arbitrarily selected; may need to increase + private static final int MAX_RECORD_LENGTH = 10_000_000; + enum LoadSavePhase { INIT, LOADED } @@ -106,9 +109,6 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh private final List<HSLFNotes> _notes = new ArrayList<>(); private FontCollection _fonts; - // For logging - private static final POILogger logger = POILogFactory.getLogger(HSLFSlideShow.class); - /** * Constructs a Powerpoint document from the underlying @@ -290,7 +290,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh if (coreRecordId != null) { return _mostRecentCoreRecords[coreRecordId]; } - logger.log(POILogger.ERROR, + LOG.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID ", refID); return null; } @@ -382,13 +382,13 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh // we need to add null-records, otherwise the index references to other existing don't work anymore if (r == null) { - logger.log(POILogger.WARN, loggerLoc+", but that record didn't exist - record ignored."); + LOG.log(POILogger.WARN, loggerLoc+", but that record didn't exist - record ignored."); continue; } // Ensure it really is a notes record if (!(r instanceof Notes)) { - logger.log(POILogger.ERROR, loggerLoc, ", but that was actually a ", r); + LOG.log(POILogger.ERROR, loggerLoc, ", but that was actually a ", r); continue; } @@ -420,7 +420,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh // Ensure it really is a slide record if (!(r instanceof Slide)) { - logger.log(POILogger.ERROR, "A Slide SlideAtomSet at ", idx, + LOG.log(POILogger.ERROR, "A Slide SlideAtomSet at ", idx, " said its record was at refID ", spa.getRefID(), ", but that was actually a ", r); @@ -439,7 +439,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh if (notesPos != null && 0 <= notesPos && notesPos < _notes.size()) { notes = _notes.get(notesPos); } else { - logger.log(POILogger.ERROR, "Notes not found for noteId=", noteId); + LOG.log(POILogger.ERROR, "Notes not found for noteId=", noteId); } } @@ -759,7 +759,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh // Add in to the list of Slides _slides.add(slide); - logger.log(POILogger.INFO, "Added slide ", _slides.size(), " with ref ", sp.getRefID(), + LOG.log(POILogger.INFO, "Added slide ", _slides.size(), " with ref ", sp.getRefID(), " and identifier ", sp.getSlideIdentifier()); // Add the core records for this new Slide to the record tree @@ -1145,7 +1145,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh int slideOffset = slideRecord.getLastOnDiskOffset(); slideRecord.setLastOnDiskOffset(slideOffset); ptr.addSlideLookup(psrId, slideOffset); - logger.log(POILogger.INFO, "New slide/object ended up at ", slideOffset); + LOG.log(POILogger.INFO, "New slide/object ended up at ", slideOffset); return psrId; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java index c5a43fff87..aa5671e06e 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java @@ -68,7 +68,7 @@ import org.apache.poi.util.POILogger; * "reader". It is only a very basic class for now */ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { - private static final POILogger logger = POILogFactory.getLogger(HSLFSlideShowImpl.class); + private static final POILogger LOG = POILogFactory.getLogger(HSLFSlideShowImpl.class); static final int UNSET_OFFSET = -1; @@ -303,7 +303,7 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { int type = LittleEndian.getUShort(docstream, usrOffset + 2); int len = LittleEndian.getInt(docstream, usrOffset + 4); if (ver_inst == 0 && type == 4085 && (len == 0x1C || len == 0x20)) { - logger.log(POILogger.WARN, "Repairing invalid user edit atom"); + LOG.log(POILogger.WARN, "Repairing invalid user edit atom"); usr.setLastUserEditAtomOffset(usrOffset); } else { throw new CorruptPowerPointFileException("Powerpoint document contains invalid user edit atom"); @@ -329,7 +329,7 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { try { currentUser = new CurrentUserAtom(getDirectory()); } catch (IOException ie) { - logger.log(POILogger.ERROR, "Error finding Current User Atom", ie); + LOG.log(POILogger.ERROR, "Error finding Current User Atom", ie); currentUser = new CurrentUserAtom(); } } @@ -393,14 +393,14 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { // If they type (including the bonus 0xF018) is 0, skip it PictureType pt = PictureType.forNativeID(type - 0xF018); if (pt == null) { - logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length ", imgsize, ".\nYour document will probably become corrupted if you save it!"); - logger.log(POILogger.ERROR, "position: ", pos); + LOG.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length ", imgsize, ".\nYour document will probably become corrupted if you save it!"); + LOG.log(POILogger.ERROR, "position: ", pos); } else { //The pictstream can be truncated halfway through a picture. //This is not a problem if the pictstream contains extra pictures //that are not used in any slide -- BUG-60305 if (pos + imgsize > pictstream.length) { - logger.log(POILogger.WARN, "\"Pictures\" stream may have ended early. In some circumstances, this is not a problem; " + + LOG.log(POILogger.WARN, "\"Pictures\" stream may have ended early. In some circumstances, this is not a problem; " + "in others, this could indicate a corrupt file"); break; } @@ -417,7 +417,7 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { pict.setIndex(_pictures.size() + 1); // index is 1-based _pictures.add(pict); } catch (IllegalArgumentException e) { - logger.log(POILogger.ERROR, "Problem reading picture: ", e, "\nYour document will probably become corrupted if you save it!"); + LOG.log(POILogger.ERROR, "Problem reading picture: ", e, "\nYour document will probably become corrupted if you save it!"); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java index 6a763101f6..867f573fcb 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java @@ -82,7 +82,7 @@ import org.apache.poi.util.Units; */ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFTextParagraph,HSLFTextRun> { - protected static final POILogger logger = POILogFactory.getLogger(HSLFTextParagraph.class); + private static final POILogger LOG = POILogFactory.getLogger(HSLFTextParagraph.class); /** * How to align the text @@ -322,7 +322,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText } if (startIdx[0] >= records.length) { - logger.log(POILogger.INFO, "header atom wasn't found - container might contain only an OutlineTextRefAtom"); + LOG.log(POILogger.INFO, "header atom wasn't found - container might contain only an OutlineTextRefAtom"); return new org.apache.poi.hslf.record.Record[0]; } @@ -884,7 +884,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText } else { master = sheet.getMasterSheet(); if (master == null) { - logger.log(POILogger.WARN, "MasterSheet is not available"); + LOG.log(POILogger.WARN, "MasterSheet is not available"); return null; } } @@ -984,7 +984,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText } if (style == null) { - logger.log(POILogger.INFO, "styles atom doesn't exist. Creating dummy record for later saving."); + LOG.log(POILogger.INFO, "styles atom doesn't exist. Creating dummy record for later saving."); style = new StyleTextPropAtom((textLen < 0) ? 1 : textLen); } else { if (textLen >= 0) { @@ -1395,7 +1395,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText } } if (rv == null || rv.isEmpty()) { - logger.log(POILogger.WARN, "text run not found for OutlineTextRefAtom.TextIndex=" + idx); + LOG.log(POILogger.WARN, "text run not found for OutlineTextRefAtom.TextIndex=" + idx); } } else { if (sheet != null) { @@ -1481,7 +1481,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText if (tbytes == null && tchars == null) { tbytes = new TextBytesAtom(); // don't add record yet - set it in storeText - logger.log(POILogger.INFO, "bytes nor chars atom doesn't exist. Creating dummy record for later saving."); + LOG.log(POILogger.INFO, "bytes nor chars atom doesn't exist. Creating dummy record for later saving."); } String rawText = (tchars != null) ? tchars.getText() : tbytes.getText(); @@ -1510,7 +1510,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText } if (paragraphCollection.isEmpty()) { - logger.log(POILogger.DEBUG, "No text records found."); + LOG.log(POILogger.DEBUG, "No text records found."); } return paragraphCollection; diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java index 144fa33950..c17f60c1e0 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java @@ -46,7 +46,7 @@ import org.apache.poi.util.POILogger; */ @SuppressWarnings({"WeakerAccess", "Duplicates", "unused"}) public final class HSLFTextRun implements TextRun { - private static final POILogger logger = POILogFactory.getLogger(HSLFTextRun.class); + private static final POILogger LOG = POILogFactory.getLogger(HSLFTextRun.class); /** The TextRun we belong to */ private HSLFTextParagraph parentParagraph; @@ -147,13 +147,13 @@ public final class HSLFTextRun implements TextRun { final int txtype = parentParagraph.getRunType(); final HSLFSheet sheet = parentParagraph.getSheet(); if (sheet == null) { - logger.log(POILogger.ERROR, "Sheet is not available"); + LOG.log(POILogger.ERROR, "Sheet is not available"); return null; } final HSLFMasterSheet master = sheet.getMasterSheet(); if (master == null) { - logger.log(POILogger.WARN, "MasterSheet is not available"); + LOG.log(POILogger.WARN, "MasterSheet is not available"); return null; } diff --git a/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java b/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java index 58273e9caa..469bd9b6d1 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java @@ -56,10 +56,10 @@ import org.apache.poi.util.POILogger; /** * Reads an Outlook MSG File in and provides hooks into its data structure. - * + * * If you want to develop with HSMF, you might find it worth getting * some of the Microsoft public documentation, such as: - * + * * [MS-OXCMSG]: Message and Attachment Object Protocol Specification */ public class MAPIMessage extends POIReadOnlyDocument { @@ -79,8 +79,8 @@ public class MAPIMessage extends POIReadOnlyDocument { } /** For logging problems we spot with the file */ - private POILogger logger = POILogFactory.getLogger(MAPIMessage.class); - + private static final POILogger LOG = POILogFactory.getLogger(MAPIMessage.class); + private Chunks mainChunks; private NameIdChunks nameIdChunks; private RecipientChunks[] recipientChunks; @@ -99,7 +99,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Constructor for reading MSG Files from the file system. - * + * * @param filename Name of the file to read * @exception IOException on errors reading, or invalid data */ @@ -108,7 +108,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } /** * Constructor for reading MSG Files from the file system. - * + * * @param file The file to read from * @exception IOException on errors reading, or invalid data */ @@ -118,10 +118,10 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Constructor for reading MSG Files from an input stream. - * + * * <p>Note - this will buffer the whole message into memory * in order to process. For lower memory use, use {@link #MAPIMessage(File)} - * + * * @param in The InputStream to buffer then read from * @exception IOException on errors reading, or invalid data */ @@ -130,7 +130,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } /** * Constructor for reading MSG Files from a POIFS filesystem - * + * * @param fs Open POIFS FileSystem containing the message * @exception IOException on errors reading, or invalid data */ @@ -221,7 +221,7 @@ public class MAPIMessage extends POIReadOnlyDocument { byte[] htmlBodyBinary = htmlBodyBinaryChunk.getValue(); return new String(htmlBodyBinary, encoding); } catch (UnsupportedEncodingException e) { - logger.log(POILogger.WARN, "HTML body binary: Invalid codepage ID ", codepage, " set for the message via ", + LOG.log(POILogger.WARN, "HTML body binary: Invalid codepage ID ", codepage, " set for the message via ", MAPIProperty.INTERNET_CPID, ", ignoring"); } } @@ -246,7 +246,7 @@ public class MAPIMessage extends POIReadOnlyDocument { throw new ChunkNotFoundException(); } } - + try { MAPIRtfAttribute rtf = new MAPIRtfAttribute( MAPIProperty.RTF_COMPRESSED, Types.BINARY.getId(), chunk.getValue() @@ -279,8 +279,8 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Gets the display value of the "TO" line of the outlook message. * If there are multiple recipients, they will be separated - * by semicolons. - * This is not the actual list of addresses/values that will be + * by semicolons. + * This is not the actual list of addresses/values that will be * sent to if you click Reply in the email - those are stored * in {@link RecipientChunks}. * @throws ChunkNotFoundException If the to-chunk does not exist and @@ -293,8 +293,8 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Gets the display value of the "CC" line of the outlook message. * If there are multiple recipients, they will be separated - * by semicolons. - * This is not the actual list of addresses/values that will be + * by semicolons. + * This is not the actual list of addresses/values that will be * sent to if you click Reply in the email - those are stored * in {@link RecipientChunks}. * @throws ChunkNotFoundException If the cc-chunk does not exist and @@ -307,8 +307,8 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Gets the display value of the "BCC" line of the outlook message. * If there are multiple recipients, they will be separated - * by semicolons. - * This is not the actual list of addresses/values that will be + * by semicolons. + * This is not the actual list of addresses/values that will be * sent to if you click Reply in the email - those are stored * in {@link RecipientChunks}. * This will only be present in sent emails, not received ones! @@ -321,7 +321,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Returns all the recipients' email address, separated by - * semicolons. Checks all the likely chunks in search of + * semicolons. Checks all the likely chunks in search of * the addresses. */ public String getRecipientEmailAddress() throws ChunkNotFoundException { @@ -330,7 +330,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Returns an array of all the recipient's email address, normally * in TO then CC then BCC order. - * Checks all the likely chunks in search of the addresses. + * Checks all the likely chunks in search of the addresses. */ public String[] getRecipientEmailAddressList() throws ChunkNotFoundException { if(recipientChunks == null || recipientChunks.length == 0) { @@ -358,7 +358,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Returns all the recipients' names, separated by - * semicolons. Checks all the likely chunks in search of + * semicolons. Checks all the likely chunks in search of * the names. * See also {@link #getDisplayTo()}, {@link #getDisplayCC()} * and {@link #getDisplayBCC()}. @@ -369,7 +369,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Returns an array of all the recipient's names, normally * in TO then CC then BCC order. - * Checks all the likely chunks in search of the names. + * Checks all the likely chunks in search of the names. * See also {@link #getDisplayTo()}, {@link #getDisplayCC()} * and {@link #getDisplayBCC()}. */ @@ -391,7 +391,7 @@ public class MAPIMessage extends POIReadOnlyDocument { return names; } - + /** * Tries to identify the correct encoding for 7-bit (non-unicode) * strings in the file. @@ -400,7 +400,7 @@ public class MAPIMessage extends POIReadOnlyDocument { * strings, but don't always store the encoding anywhere * helpful in the file.</p> * <p>This method checks for codepage properties, and failing that - * looks at the headers for the message, and uses these to + * looks at the headers for the message, and uses these to * guess the correct encoding for your file.</p> * <p>Bug #49441 has more on why this is needed</p> */ @@ -418,7 +418,7 @@ public class MAPIMessage extends POIReadOnlyDocument { String encoding = CodePageUtil.codepageToEncoding(codepage, true); generalcodepage = encoding; } catch (UnsupportedEncodingException e) { - logger.log(POILogger.WARN, "Invalid codepage ID ", codepage, " set for the message via ", + LOG.log(POILogger.WARN, "Invalid codepage ID ", codepage, " set for the message via ", MAPIProperty.MESSAGE_CODEPAGE, ", ignoring"); } } @@ -436,7 +436,7 @@ public class MAPIMessage extends POIReadOnlyDocument { generalcodepage = encoding; } } catch (UnsupportedEncodingException e) { - logger.log(POILogger.WARN, "Invalid codepage ID ", codepage, "from locale ID", lcid, " set for the message via ", + LOG.log(POILogger.WARN, "Invalid codepage ID ", codepage, "from locale ID", lcid, " set for the message via ", MAPIProperty.MESSAGE_LOCALE_ID, ", ignoring"); } } @@ -476,7 +476,7 @@ public class MAPIMessage extends POIReadOnlyDocument { bodycodepage = encoding; } } catch (UnsupportedEncodingException e) { - logger.log(POILogger.WARN, "Invalid codepage ID ", codepage, " set for the message via ", + LOG.log(POILogger.WARN, "Invalid codepage ID ", codepage, " set for the message via ", MAPIProperty.INTERNET_CPID, ", ignoring"); } } @@ -534,7 +534,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } } } - + /** * Does this file contain any strings that * are stored as 7 bit rather than unicode? @@ -547,7 +547,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } } } - + if (nameIdChunks!=null) { for(Chunk c : nameIdChunks.getChunks()) { if(c instanceof StringChunk) { @@ -557,7 +557,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } } } - + for(RecipientChunks rc : recipientChunks) { for(Chunk c : rc.getAll()) { if(c instanceof StringChunk) { @@ -569,7 +569,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } return false; } - + /** * Returns all the headers, one entry per line */ @@ -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, "'. ", + LOG.log(POILogger.WARN, "I don't recognize message class '", mc, "'. ", "Please open an issue on POI's bugzilla"); return MESSAGE_CLASS.UNKNOWN; } @@ -642,7 +642,7 @@ public class MAPIMessage extends POIReadOnlyDocument { } } } - + if(returnNullOnMissingChunk) return null; throw new ChunkNotFoundException(); @@ -681,7 +681,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** - * Will you get a null on a missing chunk, or a + * Will you get a null on a missing chunk, or a * {@link ChunkNotFoundException} (default is the * exception). */ @@ -692,7 +692,7 @@ public class MAPIMessage extends POIReadOnlyDocument { /** * Sets whether on asking for a missing chunk, * you get back null or a {@link ChunkNotFoundException} - * (default is the exception). + * (default is the exception). */ public void setReturnNullOnMissingChunk(boolean returnNullOnMissingChunk) { this.returnNullOnMissingChunk = returnNullOnMissingChunk; diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java index 56aa9bb93c..8800437bbd 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java @@ -68,7 +68,7 @@ public abstract class PropertiesChunk extends Chunk { public static final int PROPERTIES_FLAG_WRITEABLE = 4; /** For logging problems we spot with the file */ - private POILogger logger = POILogFactory.getLogger(PropertiesChunk.class); + private static final POILogger LOG = POILogFactory.getLogger(PropertiesChunk.class); /** * Holds properties, indexed by type. If a property is multi-valued, or @@ -176,7 +176,7 @@ public abstract class PropertiesChunk extends Chunk { if (chunk != null) { cVal.setValue(chunk); } else { - logger.log(POILogger.WARN, "No chunk found matching Property " + cVal); + LOG.log(POILogger.WARN, "No chunk found matching Property " + cVal); } } } @@ -200,7 +200,7 @@ public abstract class PropertiesChunk extends Chunk { prop = MAPIProperty.createCustom(id, type, "Unknown " + id); } if (type == null) { - logger.log(POILogger.WARN, "Invalid type found, expected ", + LOG.log(POILogger.WARN, "Invalid type found, expected ", prop.usualType, " but got ", typeID, " for property ", prop); going = false; @@ -220,11 +220,11 @@ public abstract class PropertiesChunk extends Chunk { // We don't know what this property normally is, but it // has come // through with a valid type, so use that - logger.log(POILogger.INFO, "Property definition for ", prop, + LOG.log(POILogger.INFO, "Property definition for ", prop, " is missing a type definition, found a value with type ", type); } else { // Oh dear, something has gone wrong... - logger.log(POILogger.WARN, "Type mismatch, expected ", + LOG.log(POILogger.WARN, "Type mismatch, expected ", prop.usualType, " but got ", type, " for property ", prop); going = false; break; @@ -285,7 +285,7 @@ public abstract class PropertiesChunk extends Chunk { } if (properties.get(prop) != null) { - logger.log(POILogger.WARN, + LOG.log(POILogger.WARN, "Duplicate values found for " + prop); } properties.put(prop, propVal); @@ -298,7 +298,7 @@ public abstract class PropertiesChunk extends Chunk { /** * Writes this chunk in the specified {@code DirectoryEntry}. - * + * * @param directory * The directory. * @throws IOException @@ -316,11 +316,11 @@ public abstract class PropertiesChunk extends Chunk { // write the property values writeNodeData(directory, values); } - + /** * Write the nodes for variable-length data. Those properties are returned by * {@link #writeProperties(java.io.OutputStream)}. - * + * * @param directory * The directory. * @param values @@ -338,7 +338,7 @@ public abstract class PropertiesChunk extends Chunk { /** * Writes the header of the properties. - * + * * @param out * The {@code OutputStream}. * @return The variable-length properties that need to be written in another diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java index 1cfb415b66..08b5c4ec22 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java @@ -60,8 +60,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter private static final float DPI = 72; - private static final POILogger logger = POILogFactory - .getLogger( ExcelToFoConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( ExcelToFoConverter.class ); private static final float PAPER_A4_HEIGHT_INCHES = 29.4f / CM_PER_INCH; @@ -233,7 +232,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter value = ErrorEval.getText( cell.getErrorCellValue() ); break; default: - logger.log( + LOG.log( POILogger.WARN, "Unexpected cell cachedFormulaResultType (" + cell.getCachedFormulaResultType() + ")" ); @@ -254,7 +253,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter value = ErrorEval.getText( cell.getErrorCellValue() ); break; default: - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Unexpected cell type (" + cell.getCellType() + ")" ); return true; } diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java index 1384cc67f0..ea6bf7665d 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java @@ -58,8 +58,7 @@ import org.w3c.dom.Text; */ @Beta public class ExcelToHtmlConverter extends AbstractExcelConverter { - private static final POILogger logger = POILogFactory - .getLogger( ExcelToHtmlConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( ExcelToHtmlConverter.class ); /** * Java main() interface to interact with {@link ExcelToHtmlConverter} @@ -323,7 +322,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter { value = ErrorEval.getText( cell.getErrorCellValue() ); break; default: - logger.log( + LOG.log( POILogger.WARN, "Unexpected cell cachedFormulaResultType (" + cell.getCachedFormulaResultType() + ")" ); @@ -344,7 +343,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter { value = ErrorEval.getText( cell.getErrorCellValue() ); break; default: - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Unexpected cell type (" + cell.getCellType() + ")" ); return true; } diff --git a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfBitmapDib.java b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfBitmapDib.java index 85c2d4efe9..7af8322f01 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfBitmapDib.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfBitmapDib.java @@ -52,7 +52,7 @@ import org.apache.poi.util.RecordFormatException; */ public class HwmfBitmapDib implements GenericRecord { - private static final POILogger logger = POILogFactory.getLogger(HwmfBitmapDib.class); + private static final POILogger LOG = POILogFactory.getLogger(HwmfBitmapDib.class); private static final int BMP_HEADER_SIZE = 14; private static final int MAX_RECORD_LENGTH = HwmfPicture.MAX_RECORD_LENGTH; @@ -479,7 +479,7 @@ public class HwmfBitmapDib implements GenericRecord { try { bi = ImageIO.read(getBMPStream()); } catch (IOException|RuntimeException e) { - logger.log(POILogger.ERROR, "invalid bitmap data - returning placeholder image"); + LOG.log(POILogger.ERROR, "invalid bitmap data - returning placeholder image"); return getPlaceholder(); } diff --git a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java index 910c9ac88b..c806befd00 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/record/HwmfText.java @@ -48,7 +48,7 @@ import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; public class HwmfText { - private static final POILogger logger = POILogFactory.getLogger(HwmfText.class); + private static final POILogger LOG = POILogFactory.getLogger(HwmfText.class); private static final int MAX_RECORD_LENGTH = 1_000_000; /** @@ -430,13 +430,13 @@ public class HwmfText { size += rawTextBytes.length; if (size >= remainingRecordSize) { - logger.log(POILogger.INFO, "META_EXTTEXTOUT doesn't contain character tracking info"); + LOG.log(POILogger.INFO, "META_EXTTEXTOUT doesn't contain character tracking info"); return size; } int dxLen = Math.min(stringLength, (remainingRecordSize-size)/LittleEndianConsts.SHORT_SIZE); if (dxLen < stringLength) { - logger.log(POILogger.WARN, "META_EXTTEXTOUT tracking info doesn't cover all characters"); + LOG.log(POILogger.WARN, "META_EXTTEXTOUT tracking info doesn't cover all characters"); } for (int i=0; i<dxLen; i++) { diff --git a/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java b/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java index 3eccdb6800..76096de417 100644 --- a/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java +++ b/src/scratchpad/src/org/apache/poi/hwmf/usermodel/HwmfPicture.java @@ -57,7 +57,7 @@ public class HwmfPicture implements Iterable<HwmfRecord>, GenericRecord { /** Max. record length - processing longer records will throw an exception */ public static final int MAX_RECORD_LENGTH = 50_000_000; - private static final POILogger logger = POILogFactory.getLogger(HwmfPicture.class); + private static final POILogger LOG = POILogFactory.getLogger(HwmfPicture.class); final List<HwmfRecord> records = new ArrayList<>(); final HwmfPlaceableHeader placeableHeader; @@ -85,7 +85,7 @@ public class HwmfPicture implements Iterable<HwmfRecord>, GenericRecord { recordSize = (int)recordSizeLong; recordFunction = leis.readShort(); } catch (Exception e) { - logger.log(POILogger.ERROR, "unexpected eof - wmf file was truncated"); + LOG.log(POILogger.ERROR, "unexpected eof - wmf file was truncated"); break; } // 4 bytes (recordSize) + 2 bytes (recordFunction) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java index a8fb4078a7..dd44d45d70 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java @@ -51,13 +51,12 @@ import org.apache.poi.util.StringUtil; */ public class HWPFOldDocument extends HWPFDocumentCore { - private static final POILogger logger = POILogFactory - .getLogger( HWPFOldDocument.class ); + private static final POILogger LOG = POILogFactory.getLogger( HWPFOldDocument.class ); //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 10_000_000; - private final static Charset DEFAULT_CHARSET = StringUtil.WIN_1252; + private static final Charset DEFAULT_CHARSET = StringUtil.WIN_1252; private OldTextPieceTable tpt; @@ -115,7 +114,7 @@ public class HWPFOldDocument extends HWPFDocumentCore { //if there was a problem with the guessed charset and the length of the //textpiece, back off to win1252. This is effectively what we used to do. tp = buildTextPiece(StringUtil.WIN_1252); - logger.log(POILogger.WARN, "Error with "+guessedCharset +". Backing off to Windows-1252"); + LOG.log(POILogger.WARN, "Error with "+guessedCharset +". Backing off to Windows-1252"); } tpt.add(tp); @@ -206,7 +205,7 @@ public class HWPFOldDocument extends HWPFDocumentCore { return wmfCharset.getCharset(); } } - logger.log(POILogger.WARN, "Couldn't find a defined charset; backing off to cp1252"); + LOG.log(POILogger.WARN, "Couldn't find a defined charset; backing off to cp1252"); //if all else fails return DEFAULT_CHARSET; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java index 28a46b81dd..b6b56c8bca 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java @@ -121,8 +121,7 @@ public abstract class AbstractWordConverter private static final byte FIELD_SEPARATOR_MARK = 20; - private static final POILogger logger = POILogFactory - .getLogger( AbstractWordConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( AbstractWordConverter.class ); private static final Pattern PATTERN_HYPERLINK_EXTERNAL = Pattern .compile( "^[ \\t\\r\\n]*HYPERLINK \"(.*)\".*$" ); @@ -449,7 +448,7 @@ public abstract class AbstractWordConverter { if ( previous > range.getEndOffset() ) { - logger.log( POILogger.WARN, "Latest structure in ", range, + LOG.log( POILogger.WARN, "Latest structure in ", range, " ended at #", previous, " after range boundaries [", range.getStartOffset(), "; ", range.getEndOffset(), ")" ); @@ -674,7 +673,7 @@ public abstract class AbstractWordConverter debug.append( range.getCharacterRun( i ) ); debug.append( "\n" ); } - logger.log( POILogger.WARN, debug ); + LOG.log( POILogger.WARN, debug ); Range deadFieldValueSubrage = new Range( range.getCharacterRun( separatorMark ).getStartOffset() + 1, range.getCharacterRun( @@ -706,7 +705,7 @@ public abstract class AbstractWordConverter } catch ( Exception exc ) { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Unable to process document summary information: ", exc, exc ); } @@ -747,7 +746,7 @@ public abstract class AbstractWordConverter .getOfficeDrawingAt( characterRun.getStartOffset() ); if ( officeDrawing == null ) { - logger.log( POILogger.WARN, "Characters #", characterRun, + LOG.log( POILogger.WARN, "Characters #", characterRun, " references missing drawn object" ); return; } @@ -812,7 +811,7 @@ public abstract class AbstractWordConverter { if ( !field.hasSeparator() ) { - logger.log( POILogger.WARN, parentRange, " contains ", field, + LOG.log( POILogger.WARN, parentRange, " contains ", field, " with 'Embedded Object' but without separator mark" ); return; } @@ -898,7 +897,7 @@ public abstract class AbstractWordConverter } } - logger.log( POILogger.WARN, parentRange, " contains ", field, + LOG.log( POILogger.WARN, parentRange, " contains ", field, " with unsupported type or format" ); processCharacters( wordDocument, currentTableLevel, field.secondSubrange( parentRange ), currentBlock ); @@ -1011,7 +1010,7 @@ public abstract class AbstractWordConverter "_" + characterRun.getPicOffset() ); if ( entry == null ) { - logger.log( POILogger.WARN, "Referenced OLE2 object '", + LOG.log( POILogger.WARN, "Referenced OLE2 object '", Integer.valueOf( characterRun.getPicOffset() ), "' not found in ObjectPool" ); return false; @@ -1023,7 +1022,7 @@ public abstract class AbstractWordConverter } catch ( Exception exc ) { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Unable to convert internal OLE2 object '", Integer.valueOf( characterRun.getPicOffset() ), "': ", exc, exc ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java index bfe64868f2..ab89c92e49 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java @@ -51,8 +51,7 @@ public class AbstractWordUtils { static final String EMPTY = ""; - private static final POILogger logger = POILogFactory - .getLogger( AbstractWordUtils.class ); + private static final POILogger LOG = POILogFactory.getLogger( AbstractWordUtils.class ); public static final float TWIPS_PER_INCH = 1440.0f; public static final int TWIPS_PER_PT = 20; @@ -418,7 +417,7 @@ public class AbstractWordUtils case 2057: return "en-uk"; default: - logger.log( POILogger.WARN, "Uknown or unmapped language code: ", languageCode); + LOG.log( POILogger.WARN, "Uknown or unmapped language code: ", languageCode); return EMPTY; } } @@ -427,7 +426,7 @@ public class AbstractWordUtils { if ( format != 0 ) - logger.log( POILogger.INFO, "NYI: toListItemNumberLabel(): ", format ); + LOG.log( POILogger.INFO, "NYI: toListItemNumberLabel(): ", format ); return String.valueOf( number ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java index 5dc984730a..fc822954e4 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java @@ -64,8 +64,7 @@ import org.w3c.dom.Text; public class WordToFoConverter extends AbstractWordConverter { - private static final POILogger logger = POILogFactory - .getLogger( WordToFoConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( WordToFoConverter.class ); /** * Java main() interface to interact with {@link WordToFoConverter} @@ -575,7 +574,7 @@ public class WordToFoConverter extends AbstractWordConverter } else { - logger.log( + LOG.log( POILogger.WARN, "Table without body starting on offset ", table.getStartOffset(), " -- ", @@ -588,7 +587,7 @@ public class WordToFoConverter extends AbstractWordConverter // making sure ID used once if ( usedIds.contains( id ) ) { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Tried to create element with same ID '", id, "'. Skipped" ); return false; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java index d3d4f6e57b..5a96806007 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java @@ -81,7 +81,7 @@ public class WordToHtmlConverter extends AbstractWordConverter } } - private static final POILogger logger = POILogFactory.getLogger( WordToHtmlConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( WordToHtmlConverter.class ); private final Deque<BlockProperies> blocksProperies = new LinkedList<>(); @@ -737,7 +737,7 @@ public class WordToHtmlConverter extends AbstractWordConverter } else { - logger.log( POILogger.WARN, "Table without body starting at [", + LOG.log( POILogger.WARN, "Table without body starting at [", Integer.valueOf( table.getStartOffset() ), "; ", Integer.valueOf( table.getEndOffset() ), ")" ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java index 6d3d01c38b..8ee50e5c35 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java @@ -55,8 +55,7 @@ import org.w3c.dom.Element; @Beta public class WordToTextConverter extends AbstractWordConverter { - private static final POILogger logger = POILogFactory - .getLogger( WordToTextConverter.class ); + private static final POILogger LOG = POILogFactory.getLogger( WordToTextConverter.class ); public static String getText( DirectoryNode root ) throws Exception { @@ -352,7 +351,7 @@ public class WordToTextConverter extends AbstractWordConverter catch ( Exception exc ) { // no extractor in classpath - logger.log( POILogger.WARN, "There is an OLE object entry '", + LOG.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 ); @@ -371,7 +370,7 @@ public class WordToTextConverter extends AbstractWordConverter } catch ( Exception exc ) { - logger.log( POILogger.ERROR, + LOG.log( POILogger.ERROR, "Unable to extract text from OLE entry '", entry.getName(), "': ", exc, exc ); return false; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarksTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarksTables.java index c5c1831172..b5c2f7f694 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarksTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarksTables.java @@ -30,8 +30,7 @@ import org.apache.poi.util.POILogger; @Internal public class BookmarksTables { - private static final POILogger logger = POILogFactory - .getLogger( BookmarksTables.class ); + private static final POILogger LOG = POILogFactory.getLogger( BookmarksTables.class ); private PlexOfCps descriptorsFirst = new PlexOfCps( 4 ); @@ -54,7 +53,7 @@ public class BookmarksTables GenericPropertyNode endNode = descriptorsLim.getProperty( i ); if ( startNode.getStart() == endNode.getStart() ) { - logger.log( POILogger.DEBUG, "Removing bookmark #", + LOG.log( POILogger.DEBUG, "Removing bookmark #", Integer.valueOf( i ), "..." ); remove( i ); i--; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java index 8367aa84fd..9559f560a7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java @@ -49,8 +49,7 @@ import org.apache.poi.util.POILogger; @Internal public class CHPBinTable { - private static final POILogger logger = POILogFactory - .getLogger( CHPBinTable.class ); + private static final POILogger LOG = POILogFactory.getLogger( CHPBinTable.class ); /** List of character properties.*/ protected List<CHPX> _textRuns = new ArrayList<>(); @@ -106,13 +105,13 @@ public class CHPBinTable _textRuns.add( chpx ); } } - logger.log( POILogger.DEBUG, "CHPX FKPs loaded in ", + LOG.log( POILogger.DEBUG, "CHPX FKPs loaded in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( _textRuns.size() ), " elements)" ); if ( _textRuns.isEmpty() ) { - logger.log( POILogger.WARN, "CHPX FKPs are empty" ); + LOG.log( POILogger.WARN, "CHPX FKPs are empty" ); _textRuns.add( new CHPX( 0, 0, new SprmBuffer( 0 ) ) ); } } @@ -136,7 +135,7 @@ public class CHPBinTable if ( igrpprl < 0 || igrpprl >= sprmBuffers.length ) { - logger.log( POILogger.WARN, textPiece + LOG.log( POILogger.WARN, textPiece + "'s PRM references to unknown grpprl" ); continue; } @@ -163,7 +162,7 @@ public class CHPBinTable _textRuns.add( chpx ); } } - logger.log( POILogger.DEBUG, + LOG.log( POILogger.DEBUG, "Merged with CHPX from complex file table in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( _textRuns.size() ), @@ -174,7 +173,7 @@ public class CHPBinTable List<CHPX> oldChpxSortedByStartPos = new ArrayList<>(_textRuns); oldChpxSortedByStartPos.sort(PropertyNode.StartComparator); - logger.log( POILogger.DEBUG, "CHPX sorted by start position in ", + LOG.log( POILogger.DEBUG, "CHPX sorted by start position in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); start = System.currentTimeMillis(); @@ -196,7 +195,7 @@ public class CHPBinTable } }; - logger.log( POILogger.DEBUG, "CHPX's order map created in ", + LOG.log( POILogger.DEBUG, "CHPX's order map created in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); start = System.currentTimeMillis(); @@ -214,7 +213,7 @@ public class CHPBinTable Collections.sort( textRunsBoundariesList ); } - logger.log( POILogger.DEBUG, "Texts CHPX boundaries collected in ", + LOG.log( POILogger.DEBUG, "Texts CHPX boundaries collected in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); start = System.currentTimeMillis(); @@ -254,7 +253,7 @@ public class CHPBinTable if ( chpxs.size() == 0 ) { - logger.log( POILogger.WARN, "Text piece [", + LOG.log( POILogger.WARN, "Text piece [", Integer.valueOf( startInclusive ), "; ", Integer.valueOf(boundary), ") has no CHPX. Creating new one." ); @@ -291,7 +290,7 @@ public class CHPBinTable } this._textRuns = new ArrayList<>(newChpxs); - logger.log( POILogger.DEBUG, "CHPX rebuilded in ", + LOG.log( POILogger.DEBUG, "CHPX rebuilded in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( _textRuns.size() ), " elements)" ); start = System.currentTimeMillis(); @@ -319,7 +318,7 @@ public class CHPBinTable previous = current; } - logger.log( POILogger.DEBUG, "CHPX compacted in ", + LOG.log( POILogger.DEBUG, "CHPX compacted in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( _textRuns.size() ), " elements)" ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java index 5068460f5e..83ca143b05 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java @@ -145,7 +145,7 @@ public final class FIBFieldHandler public static final int STTBLISTNAMES = 91; public static final int STTBFUSSR = 92; - private final static POILogger log = POILogFactory.getLogger(FIBFieldHandler.class); + private static final POILogger log = POILogFactory.getLogger(FIBFieldHandler.class); private static final int FIELD_SIZE = LittleEndianConsts.INT_SIZE * 2; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java index 4fc8001c98..879441bf7b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java @@ -45,25 +45,23 @@ import org.apache.poi.util.POILogger; * </ul> */ @Internal -public final class FileInformationBlock -{ +public final class FileInformationBlock { //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; - public static final POILogger logger = POILogFactory - .getLogger( FileInformationBlock.class ); + private static final POILogger LOG = POILogFactory.getLogger( FileInformationBlock.class ); - private FibBase _fibBase; - private int _csw; - private FibRgW97 _fibRgW; - private int _cslw; - private FibRgLw _fibRgLw; + private final FibBase _fibBase; + private final int _csw; + private final FibRgW97 _fibRgW; + private final int _cslw; + private final FibRgLw _fibRgLw; private int _cbRgFcLcb; private FIBFieldHandler _fieldHandler; private int _cswNew; - private int _nFibNew; - private byte[] _fibRgCswNew; + private final int _nFibNew; + private final byte[] _fibRgCswNew; /** Creates a new instance of FileInformationBlock */ public FileInformationBlock( byte[] mainDocument ) @@ -177,7 +175,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, ")"); + LOG.log(POILogger.WARN, "Invalid file format version number: ", nfib, "(", nfibHex, ")"); } } @@ -188,7 +186,7 @@ public final class FileInformationBlock if ( cbRgFcLcb == expectedCbRgFcLcb ) return; - logger.log( POILogger.WARN, "Since FIB.nFib == ", strNFib, + LOG.log( POILogger.WARN, "Since FIB.nFib == ", strNFib, " value of FIB.cbRgFcLcb MUST be ", strCbRgFcLcb + ", not 0x", Integer.toHexString( cbRgFcLcb ) ); } @@ -213,7 +211,7 @@ public final class FileInformationBlock assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew ); break; default: - logger.log(POILogger.WARN, "Invalid file format version number: ", getNFib()); + LOG.log(POILogger.WARN, "Invalid file format version number: ", getNFib()); } } @@ -224,7 +222,7 @@ public final class FileInformationBlock if ( cswNew == expectedCswNew ) return; - logger.log( POILogger.WARN, "Since FIB.nFib == ", strNFib, + LOG.log( POILogger.WARN, "Since FIB.nFib == ", strNFib, " value of FIB.cswNew MUST be ", strExpectedCswNew + ", not 0x", Integer.toHexString( cswNew ) ); } @@ -237,14 +235,14 @@ public final class FileInformationBlock * UnhandledDataStructure and save them on save. */ HashSet<Integer> knownFieldSet = new HashSet<>(); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STSHF ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.CLX ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.DOP ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.PLCFBTECHPX ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.PLCFBTEPAPX ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.PLCFSED ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.PLFLST ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.PLFLFO ) ); + knownFieldSet.add(FIBFieldHandler.STSHF); + knownFieldSet.add(FIBFieldHandler.CLX); + knownFieldSet.add(FIBFieldHandler.DOP); + knownFieldSet.add(FIBFieldHandler.PLCFBTECHPX); + knownFieldSet.add(FIBFieldHandler.PLCFBTEPAPX); + knownFieldSet.add(FIBFieldHandler.PLCFSED); + knownFieldSet.add(FIBFieldHandler.PLFLST); + knownFieldSet.add(FIBFieldHandler.PLFLFO); // field info for ( FieldsDocumentPart part : FieldsDocumentPart.values() ) @@ -256,18 +254,15 @@ public final class FileInformationBlock knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBFBKMK ) ); // notes - for ( NoteType noteType : NoteType.values() ) - { - knownFieldSet.add( Integer.valueOf( noteType - .getFibDescriptorsFieldIndex() ) ); - knownFieldSet.add( Integer.valueOf( noteType - .getFibTextPositionsFieldIndex() ) ); + for ( NoteType noteType : NoteType.values() ) { + knownFieldSet.add(noteType.getFibDescriptorsFieldIndex()); + knownFieldSet.add(noteType.getFibTextPositionsFieldIndex()); } - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBFFFN ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBFRMARK ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBSAVEDBY ) ); - knownFieldSet.add( Integer.valueOf( FIBFieldHandler.MODIFIED ) ); + knownFieldSet.add( FIBFieldHandler.STTBFFFN ); + knownFieldSet.add( FIBFieldHandler.STTBFRMARK ); + knownFieldSet.add( FIBFieldHandler.STTBSAVEDBY ); + knownFieldSet.add( FIBFieldHandler.MODIFIED ); _fieldHandler = new FIBFieldHandler( mainDocument, 154, _cbRgFcLcb, tableStream, knownFieldSet, true ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java index 767520c96b..b5d28d1f45 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java @@ -38,7 +38,7 @@ import org.apache.poi.util.POILogger; @Internal public final class FontTable { - private final static POILogger _logger = POILogFactory.getLogger(FontTable.class); + private static final POILogger LOG = POILogFactory.getLogger(FontTable.class); private short _stringCount;// how many strings are included in the string table private short _extraDataSz;// size in bytes of the extra data @@ -93,7 +93,7 @@ public final class FontTable { if(chpFtc >= _stringCount) { - _logger.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); + LOG.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); return null; } @@ -104,7 +104,7 @@ public final class FontTable { if(chpFtc >= _stringCount) { - _logger.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); + LOG.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); return null; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java index e77ec7a9a9..36b069d80a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java @@ -43,8 +43,7 @@ public final class ListLevel //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 10_485_760; - private static final POILogger logger = POILogFactory - .getLogger( ListLevel.class ); + private static final POILogger LOG = POILogFactory.getLogger( ListLevel.class ); private byte[] _grpprlChpx; private byte[] _grpprlPapx; @@ -245,7 +244,7 @@ public final class ListLevel { if ( _xst.getCch() != 1 ) { - logger.log( POILogger.WARN, "LVL at offset ", + LOG.log( POILogger.WARN, "LVL at offset ", Integer.valueOf( startOffset ), " has nfc == 0x17 (bullets), but cch != 1 (", Integer.valueOf( _xst.getCch() ), ")" ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java index fae0aef18b..b105fc16e7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java @@ -33,7 +33,7 @@ import org.apache.poi.util.POILogger; @Internal public final class ListTables { - private final static POILogger log = POILogFactory.getLogger(ListTables.class); + private static final POILogger log = POILogFactory.getLogger(ListTables.class); /** * Both PlfLst and the following LVLs diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java b/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java index 6cf8f2c030..27e5de7b1b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java @@ -32,9 +32,9 @@ import org.apache.poi.util.StringUtil; @Internal public final class OldFfn { - private static final POILogger logger = POILogFactory.getLogger(OldFfn.class); + private static final POILogger LOG = POILogFactory.getLogger(OldFfn.class); - private byte _chs;// character set identifier + private final byte _chs;// character set identifier private final String fontName; private final String altFontName; @@ -59,7 +59,7 @@ public final class OldFfn { short fontDescriptionLength = buf[offset]; offset += 1; if (offset + fontDescriptionLength > fontTableEnd) { - logger.log(POILogger.WARN, "Asked to read beyond font table end. Skipping font"); + LOG.log(POILogger.WARN, "Asked to read beyond font table end. Skipping font"); return null; } @@ -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)); + LOG.log(POILogger.WARN, "Couldn't find font for type: ", (chs & 0xff)); } else { charset = wmfCharset.getCharset(); } @@ -88,7 +88,7 @@ public final class OldFfn { } } if (fontNameLength == -1) { - logger.log(POILogger.WARN, "Couldn't find the zero-byte delimited font name length"); + LOG.log(POILogger.WARN, "Couldn't find the zero-byte delimited font name length"); return null; } String fontName = new String(buf, offset, fontNameLength, charset); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java index 0bc44f3943..0e3ec37815 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java @@ -32,7 +32,7 @@ import org.apache.poi.util.POILogger; */ @Internal public final class OldFontTable { - private final static POILogger _logger = POILogFactory.getLogger(OldFontTable.class); + private static final POILogger LOG = POILogFactory.getLogger(OldFontTable.class); // added extra facilitator members // FFN structure containing strings of font names @@ -69,7 +69,7 @@ public final class OldFontTable { public String getMainFont(int chpFtc) { if (chpFtc >= _fontNames.length) { - _logger.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); + LOG.log(POILogger.INFO, "Mismatch in chpFtc with stringCount"); return null; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java index 2c07b2e901..25dae0de7d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java @@ -43,8 +43,7 @@ import org.apache.poi.util.POILogger; @Internal public class PAPBinTable { - private static final POILogger logger = POILogFactory - .getLogger( PAPBinTable.class ); + private static final POILogger LOG = POILogFactory.getLogger( PAPBinTable.class ); protected final ArrayList<PAPX> _paragraphs = new ArrayList<>(); @@ -81,13 +80,13 @@ public class PAPBinTable } } - logger.log( POILogger.DEBUG, "PAPX tables loaded in ", + LOG.log( POILogger.DEBUG, "PAPX tables loaded in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( _paragraphs.size() ), " elements)" ); if ( _paragraphs.isEmpty() ) { - logger.log( POILogger.WARN, "PAPX FKPs are empty" ); + LOG.log( POILogger.WARN, "PAPX FKPs are empty" ); _paragraphs.add( new PAPX( 0, 0, new SprmBuffer( 2 ) ) ); } } @@ -118,7 +117,7 @@ public class PAPBinTable if ( igrpprl < 0 || igrpprl >= sprmBuffers.length ) { - logger.log( POILogger.WARN, textPiece + LOG.log( POILogger.WARN, textPiece + "'s PRM references to unknown grpprl" ); continue; } @@ -147,7 +146,7 @@ public class PAPBinTable } } - logger.log( POILogger.DEBUG, + LOG.log( POILogger.DEBUG, "Merged (?) with PAPX from complex file table in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( paragraphs.size() ), @@ -158,7 +157,7 @@ public class PAPBinTable List<PAPX> oldPapxSortedByEndPos = new ArrayList<>(paragraphs); oldPapxSortedByEndPos.sort(PropertyNode.EndComparator); - logger.log( POILogger.DEBUG, "PAPX sorted by end position in ", + LOG.log( POILogger.DEBUG, "PAPX sorted by end position in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); start = System.currentTimeMillis(); @@ -180,7 +179,7 @@ public class PAPBinTable } }; - logger.log( POILogger.DEBUG, "PAPX's order map created in ", + LOG.log( POILogger.DEBUG, "PAPX's order map created in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); start = System.currentTimeMillis(); @@ -224,7 +223,7 @@ public class PAPBinTable if ( papxs.size() == 0 ) { - logger.log( POILogger.WARN, "Paragraph [", + LOG.log( POILogger.WARN, "Paragraph [", Integer.valueOf( startInclusive ), "; ", Integer.valueOf( endExclusive ), ") has no PAPX. Creating new one." ); @@ -274,7 +273,7 @@ public class PAPBinTable paragraphs.clear(); paragraphs.addAll( newPapxs ); - logger.log( POILogger.DEBUG, "PAPX rebuilded from document text in ", + LOG.log( POILogger.DEBUG, "PAPX rebuilded from document text in ", Long.valueOf( System.currentTimeMillis() - start ), " ms (", Integer.valueOf( paragraphs.size() ), " elements)" ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java index 214654a064..bf904e4738 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PicturesTable.java @@ -52,11 +52,9 @@ import org.apache.poi.util.POILogger; * @author Dmitry Romanov */ @Internal -public final class PicturesTable -{ - private static final POILogger logger = POILogFactory - .getLogger( PicturesTable.class ); - +public final class PicturesTable { + private static final POILogger LOG = POILogFactory.getLogger( PicturesTable.class ); + static final int TYPE_IMAGE = 0x08; static final int TYPE_IMAGE_WORD2000 = 0x00; static final int TYPE_IMAGE_PASTED_FROM_CLIPBOARD = 0xA; @@ -200,7 +198,7 @@ public final class PicturesTable } catch ( Exception exc ) { - logger.log( + LOG.log( POILogger.WARN, "Unable to load picture from BLIB record at offset #", Integer.valueOf( bse.getOffset() ), exc ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java index fb82dbb68e..dbe32463e6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java @@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger; */ public class PlfLfo { - private final static POILogger log = POILogFactory.getLogger( PlfLfo.class ); + private static final POILogger log = POILogFactory.getLogger( PlfLfo.class ); /** * An unsigned integer that specifies the count of elements in both the diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java index 4a7e174b0e..4746799d44 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java @@ -40,7 +40,7 @@ public abstract class PropertyNode<T extends PropertyNode<T>> implements Compara public static final Comparator<PropertyNode<?>> StartComparator = Comparator.comparingInt(PropertyNode::getStart); - private static final POILogger _logger = POILogFactory.getLogger(PropertyNode.class); + private static final POILogger LOG = POILogFactory.getLogger(PropertyNode.class); protected Object _buf; @@ -72,12 +72,12 @@ 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"); + LOG.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, + LOG.log(POILogger.WARN, "A property claimed to end (", _cpEnd, ") before start! Resetting end to start, and hoping for the best"); _cpEnd = _cpStart; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java index eb2292a6e0..4656ec8de1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java @@ -37,7 +37,7 @@ public class SectionTable //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; - private final static POILogger _logger = POILogFactory.getLogger(SectionTable.class); + private static final POILogger LOG = POILogFactory.getLogger(SectionTable.class); private static final int SED_SIZE = 12; protected List<SEPX> _sections = new ArrayList<>(); @@ -100,7 +100,7 @@ public class SectionTable } } if(! matchAt && matchHalf) { - _logger.log(POILogger.WARN, "Your document seemed to be mostly unicode, but the section definition was in bytes! Trying anyway, but things may well go wrong!"); + LOG.log(POILogger.WARN, "Your document seemed to be mostly unicode, but the section definition was in bytes! Trying anyway, but things may well go wrong!"); for(int i=0; i<_sections.size(); i++) { SEPX s = _sections.get(i); GenericPropertyNode node = sedPlex.getProperty(i); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java index d96d66da33..7dcc6e5f4a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java @@ -39,14 +39,14 @@ import org.apache.poi.util.StringUtil; @Internal public final class StyleDescription { - private static final POILogger logger = POILogFactory.getLogger(StyleDescription.class); + private static final POILogger LOG = POILogFactory.getLogger(StyleDescription.class); //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; - private final static int PARAGRAPH_STYLE = 1; - private final static int CHARACTER_STYLE = 2; - // private final static int TABLE_STYLE = 3; - // private final static int NUMBERING_STYLE = 4; + private static final int PARAGRAPH_STYLE = 1; + private static final int CHARACTER_STYLE = 2; + // private static final int TABLE_STYLE = 3; + // private static final int NUMBERING_STYLE = 4; private int _baseLength; private StdfBase _stdfBase; @@ -74,7 +74,7 @@ public final class StyleDescription { } else if (baseLength == 0x000A) { readStdfPost2000 = false; } else { - logger.log(POILogger.WARN, "Style definition has non-standard size of ", baseLength); + LOG.log(POILogger.WARN, "Style definition has non-standard size of ", baseLength); } _stdfBase = new StdfBase(std, offset); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java index 6bb1f3b53a..ac37396657 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java @@ -49,12 +49,12 @@ public final class StyleSheet { // private static final int TAP_TYPE = 5; @Deprecated - private final static ParagraphProperties NIL_PAP = new ParagraphProperties(); + private static final ParagraphProperties NIL_PAP = new ParagraphProperties(); @Deprecated - private final static CharacterProperties NIL_CHP = new CharacterProperties(); + private static final CharacterProperties NIL_CHP = new CharacterProperties(); - private final static byte[] NIL_CHPX = new byte[]{}; - private final static byte[] NIL_PAPX = new byte[]{0, 0}; + private static final byte[] NIL_CHPX = new byte[]{}; + private static final byte[] NIL_PAPX = new byte[]{0, 0}; /** * Size of the STSHI structure diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java index 2da35b30ba..e40be66f31 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java @@ -40,8 +40,7 @@ import org.apache.poi.util.POILogger; */ @Internal public class TextPieceTable implements CharIndexTranslator { - private static final POILogger logger = POILogFactory - .getLogger(TextPieceTable.class); + private static final POILogger LOG = POILogFactory.getLogger(TextPieceTable.class); //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000_000; @@ -287,7 +286,7 @@ public class TextPieceTable implements CharIndexTranslator { int toAppendLength = toAppend.length(); if (toAppendLength != textPiece.getEnd() - textPiece.getStart()) { - logger.log( + LOG.log( POILogger.WARN, "Text piece has boundaries [", textPiece.getStart(), @@ -301,7 +300,7 @@ public class TextPieceTable implements CharIndexTranslator { + toAppendLength, toAppend); } - logger.log(POILogger.DEBUG, "Document text were rebuilded in ", + LOG.log(POILogger.DEBUG, "Document text were rebuilded in ", System.currentTimeMillis() - start, " ms (", docText.length(), " chars)"); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java index ff15f3e28f..33557615f6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java @@ -51,11 +51,11 @@ public abstract class FFDataBaseAbstractType protected short field_2_bits; /**/private static final BitField iType = new BitField(0x0003); /** Specifies that the form field is a textbox. */ - /* */public final static byte ITYPE_TEXT = 0; + /* */public static final byte ITYPE_TEXT = 0; /** Specifies that the form field is a checkbox. */ - /* */public final static byte ITYPE_CHCK = 1; + /* */public static final byte ITYPE_CHCK = 1; /** Specifies that the form field is a dropdown list box. */ - /* */public final static byte ITYPE_DROP = 2; + /* */public static final byte ITYPE_DROP = 2; /**/private static final BitField iRes = new BitField(0x007C); /**/private static final BitField fOwnHelp = new BitField(0x0080); /**/private static final BitField fOwnStat = new BitField(0x0100); @@ -63,17 +63,17 @@ public abstract class FFDataBaseAbstractType /**/private static final BitField iSize = new BitField(0x0400); /**/private static final BitField iTypeTxt = new BitField(0x3800); /** Specifies that the textbox value is regular text. */ - /* */public final static byte ITYPETXT_REG = 0; + /* */public static final byte ITYPETXT_REG = 0; /** Specifies that the textbox value is a number. */ - /* */public final static byte ITYPETXT_NUM = 0; + /* */public static final byte ITYPETXT_NUM = 0; /** Specifies that the textbox value is a date or time. */ - /* */public final static byte ITYPETXT_DATE = 0; + /* */public static final byte ITYPETXT_DATE = 0; /** Specifies that the textbox value is the current date. */ - /* */public final static byte ITYPETXT_CURDATE = 0; + /* */public static final byte ITYPETXT_CURDATE = 0; /** Specifies that the textbox value is the current time. */ - /* */public final static byte ITYPETXT_CURTIME = 0; + /* */public static final byte ITYPETXT_CURTIME = 0; /** Specifies that the textbox value is calculated from an expression. The expression is given by FFData.xstzTextDef. */ - /* */protected final static byte ITYPETXT_CALC = 0; + /* */protected static final byte ITYPETXT_CALC = 0; /**/private static final BitField fRecalc = new BitField(0x4000); /**/private static final BitField fHasListBox = new BitField(0x8000); protected int field_3_cch; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java index 74c6e035c7..27ad6e8041 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java @@ -34,8 +34,7 @@ import org.apache.poi.util.POILogger; @Internal public final class CharacterSprmUncompressor extends SprmUncompressor { - private static final POILogger logger = POILogFactory - .getLogger( CharacterSprmUncompressor.class ); + private static final POILogger LOG = POILogFactory.getLogger( CharacterSprmUncompressor.class ); public CharacterSprmUncompressor() { @@ -78,7 +77,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor } catch ( Exception exc ) { - logger.log( POILogger.ERROR, "Unable to apply all style ", + LOG.log( POILogger.ERROR, "Unable to apply all style ", style, " CHP SPRMs to CHP: ", exc, exc ); } } @@ -92,7 +91,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor } catch ( Exception exc ) { - logger.log( POILogger.ERROR, + LOG.log( POILogger.ERROR, "Unable to process all direct CHP SPRMs: ", exc, exc ); } return newProperties; @@ -112,7 +111,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor { if ( warnAboutNonChpSprms ) { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Non-CHP SPRM returned by SprmIterator: ", sprm ); } continue; @@ -141,7 +140,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor } catch ( Exception exc ) { - logger.log( POILogger.ERROR, + LOG.log( POILogger.ERROR, "Unable to extract istd from direct CHP SPRM: ", exc, exc ); } return style; @@ -175,9 +174,9 @@ public final class CharacterSprmUncompressor extends SprmUncompressor // sprmCPicLocation -- 0x6A03 /* * [MS-DOC] - * + * * Page 104 of 622 - * + * * A signed 32-bit integer that specifies either the position in the * Data Stream of a picture or binary data or the name of an OLE * object storage. @@ -566,9 +565,9 @@ public final class CharacterSprmUncompressor extends SprmUncompressor /* * Microsoft Office Word 97-2007 Binary File Format (.doc) * Specification - * + * * Page 78 of 210 - * + * * sprmCPropRMark (opcode 0xCA57) is interpreted by moving the first * parameter byte to chp.fPropRMark, the next two bytes to * chp.ibstPropRMark, and the remaining four bytes to @@ -601,7 +600,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor // sprmCFtcBi break; case 0x5f: - // sprmCLidBi + // sprmCLidBi break; case 0x60: // sprmCIcoBi @@ -614,9 +613,9 @@ public final class CharacterSprmUncompressor extends SprmUncompressor /* * Microsoft Office Word 97-2007 Binary File Format (.doc) * Specification - * + * * Page 78 of 210 - * + * * sprmCDispFldRMark (opcode 0xCA62) is interpreted by moving the * first parameter byte to chp.fDispFldRMark, the next two bytes to * chp.ibstDispFldRMark, the next four bytes to @@ -645,7 +644,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor // sprmCShd80 /* * "A Shd80 structure that specifies the background shading for the text. By default, text is not shaded." - * + * * Word (.doc) Binary File Format. Copyright (c) 2011 Microsoft * Corporation. Release: Tuesday, March 15, 2011 */ @@ -698,7 +697,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor // sprmCFNoProof -- 0x875 /* * "A ToggleOperand value that specifies whether the text is excluded from the proofing analysis. By default, text is not excluded from the proofing analysis." - * + * * Word (.doc) Binary File Format. Copyright (c) 2012 Microsoft * Corporation. Released: October 8, 2012 */ @@ -706,7 +705,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor oldCHP.isFNoProof())); break; default: - logger.log( POILogger.DEBUG, "Unknown CHP sprm ignored: ", sprm ); + LOG.log( POILogger.DEBUG, "Unknown CHP sprm ignored: ", sprm ); break; } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java index 12e84c3799..fc3915d600 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java @@ -40,11 +40,9 @@ import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @Internal -public final class ParagraphSprmUncompressor - extends SprmUncompressor -{ - private static final POILogger logger = POILogFactory - .getLogger( ParagraphSprmUncompressor.class ); +public final class ParagraphSprmUncompressor extends SprmUncompressor { + + private static final POILogger LOG = POILogFactory.getLogger( ParagraphSprmUncompressor.class ); public ParagraphSprmUncompressor() { @@ -71,7 +69,7 @@ public final class ParagraphSprmUncompressor } catch ( Exception exc ) { - logger.log( + LOG.log( POILogger.ERROR, "Unable to apply SPRM operation '", sprm.getOperation(), "': ", exc ); } @@ -413,7 +411,7 @@ public final class ParagraphSprmUncompressor newPAP.setRsid( sprm.getOperand() ); break; default: - logger.log( POILogger.DEBUG, "Unknown PAP sprm ignored: ", sprm ); + LOG.log( POILogger.DEBUG, "Unknown PAP sprm ignored: ", sprm ); break; } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java index 98c8886f94..fe2480fdc4 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianConsts; @Internal public final class SectionSprmCompressor { - private final static SectionProperties DEFAULT_SEP = new SectionProperties(); + private static final SectionProperties DEFAULT_SEP = new SectionProperties(); public SectionSprmCompressor() { } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java index ce48874af0..a51f7c779f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java @@ -28,9 +28,9 @@ import org.apache.poi.util.POILogger; @Internal -public final class SectionSprmUncompressor extends SprmUncompressor -{ - private static final POILogger logger = POILogFactory.getLogger(SectionSprmUncompressor.class); +public final class SectionSprmUncompressor extends SprmUncompressor { + + private static final POILogger LOG = POILogFactory.getLogger(SectionSprmUncompressor.class); public SectionSprmUncompressor() { @@ -241,7 +241,7 @@ public final class SectionSprmUncompressor extends SprmUncompressor newSEP.setNfcEdnRef(sprm.getOperand()); break; default: - logger.log(POILogger.INFO, "Unsupported Sprm operation: ", operation, " (", HexDump.byteToHex(operation), ")"); + LOG.log(POILogger.INFO, "Unsupported Sprm operation: ", operation, " (", HexDump.byteToHex(operation), ")"); break; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java index 3fc26d0712..705de1f1c9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java @@ -41,8 +41,8 @@ public final class SprmOperation private static final BitField BITFIELD_TYPE = BitFieldFactory .getInstance( 0x1c00 ); - final static private short SPRM_LONG_PARAGRAPH = (short) 0xc615; - final static private short SPRM_LONG_TABLE = (short) 0xd608; + static final private short SPRM_LONG_PARAGRAPH = (short) 0xc615; + static final private short SPRM_LONG_TABLE = (short) 0xd608; public static final int TYPE_PAP = 1; public static final int TYPE_CHP = 2; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java index 4bad5bb8cd..0332ae37ae 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java @@ -26,10 +26,9 @@ import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @Internal -public final class TableSprmUncompressor - extends SprmUncompressor -{ - private static final POILogger logger = POILogFactory.getLogger( TableSprmUncompressor.class ); +public final class TableSprmUncompressor extends SprmUncompressor { + + private static final POILogger LOG = POILogFactory.getLogger( TableSprmUncompressor.class ); public TableSprmUncompressor() { @@ -49,7 +48,7 @@ public final class TableSprmUncompressor } else { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Some table rows didn't specify number of columns in SPRMs" ); tableProperties = new TableProperties( (short) 1 ); } @@ -70,7 +69,7 @@ public final class TableSprmUncompressor } catch ( ArrayIndexOutOfBoundsException ex ) { - logger.log( POILogger.ERROR, "Unable to apply ", sprm, + LOG.log( POILogger.ERROR, "Unable to apply ", sprm, ": ", ex, ex ); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java index 352d7d42e8..73517238a0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java @@ -53,7 +53,7 @@ import org.apache.poi.util.POILogger; */ public class Range { - private static final POILogger logger = POILogFactory.getLogger( Range.class ); + private static final POILogger LOG = POILogFactory.getLogger( Range.class ); /** * @deprecated POI 3.8 beta 5 @@ -824,7 +824,7 @@ public class Range { initAll(); if ( tableEndInclusive >= this._parEnd ) { - logger.log( POILogger.WARN, "The table's bounds ", "[", + LOG.log( POILogger.WARN, "The table's bounds ", "[", this._parStart, "; ", tableEndInclusive, ")", " fall outside of this Range paragraphs numbers [", this._parStart, "; ", this._parEnd, ")" ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java index 005b360735..30e1d26a21 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java @@ -27,16 +27,15 @@ import org.apache.poi.util.POILogger; public final class TableRow extends Range { - private static final POILogger logger = POILogFactory - .getLogger( TableRow.class ); + private static final POILogger LOG = POILogFactory.getLogger( TableRow.class ); - private final static short SPRM_DXAGAPHALF = (short) 0x9602; - private final static short SPRM_DYAROWHEIGHT = (short) 0x9407; - private final static short SPRM_FCANTSPLIT = 0x3403; - private final static short SPRM_FTABLEHEADER = 0x3404; - private final static short SPRM_TJC = 0x5400; + private static final short SPRM_DXAGAPHALF = (short) 0x9602; + private static final short SPRM_DYAROWHEIGHT = (short) 0x9407; + private static final short SPRM_FCANTSPLIT = 0x3403; + private static final short SPRM_FTABLEHEADER = 0x3404; + private static final short SPRM_TJC = 0x5400; - private final static char TABLE_CELL_MARK = '\u0007'; + private static final char TABLE_CELL_MARK = '\u0007'; private TableCell[] _cells; private boolean _cellsFound; @@ -188,7 +187,7 @@ public final class TableRow extends Range if ( cells.size() != expectedCellsCount ) { - logger.log( POILogger.WARN, + LOG.log( POILogger.WARN, "Number of found table cells (", cells.size(), ") for table row [", getStartOffset(), "c; ", getEndOffset(), "c] not equals to stored property value ", diff --git a/src/scratchpad/src/org/apache/poi/hwpf/util/LittleEndianCP950Reader.java b/src/scratchpad/src/org/apache/poi/hwpf/util/LittleEndianCP950Reader.java index 195629bb04..3df94849c7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/util/LittleEndianCP950Reader.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/util/LittleEndianCP950Reader.java @@ -43,14 +43,14 @@ public class LittleEndianCP950Reader extends Reader { //https://en.wikipedia.org/wiki/Code_page_950 //see private use area - private final static char range1Low = '\u8140'; - private final static char range1High = '\u8DFE'; - private final static char range2Low = '\u8E40'; - private final static char range2High = '\uA0FE'; - private final static char range3Low = '\uC6A1'; - private final static char range3High = '\uC8FE'; - private final static char range4Low = '\uFA40'; - private final static char range4High = '\uFEFE'; + private static final char range1Low = '\u8140'; + private static final char range1High = '\u8DFE'; + private static final char range2Low = '\u8E40'; + private static final char range2High = '\uA0FE'; + private static final char range3Low = '\uC6A1'; + private static final char range3High = '\uC8FE'; + private static final char range4Low = '\uFA40'; + private static final char range4High = '\uFEFE'; private final byte[] data; private final int startOffset; diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFTestDataSamples.java b/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFTestDataSamples.java index ea5a499111..b4efb828d3 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFTestDataSamples.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFTestDataSamples.java @@ -30,8 +30,7 @@ import org.apache.poi.util.POILogger; public class HWPFTestDataSamples { - private static final POILogger logger = POILogFactory - .getLogger( HWPFTestDataSamples.class ); + private static final POILogger LOG = POILogFactory.getLogger( HWPFTestDataSamples.class ); public static HWPFDocument openSampleFile(String sampleFileName) { try { @@ -66,7 +65,7 @@ public class HWPFTestDataSamples { final long endUnzip = System.currentTimeMillis(); byte[] byteArray = baos.toByteArray(); - logger.log(POILogger.DEBUG, "Unzipped in ", + LOG.log(POILogger.DEBUG, "Unzipped in ", Long.valueOf(endUnzip - start), " ms -- ", Long.valueOf(byteArray.length), " byte(s)"); @@ -74,7 +73,7 @@ public class HWPFTestDataSamples { HWPFDocument doc = new HWPFDocument(bais); final long endParse = System.currentTimeMillis(); - logger.log(POILogger.DEBUG, "Parsed in ", + LOG.log(POILogger.DEBUG, "Parsed in ", Long.valueOf(endParse - start), " ms"); return doc; diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java index f1d1cb578f..c30d80169f 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java @@ -63,9 +63,6 @@ import org.w3c.dom.Document; * against HWPF */ class TestBugs { - - private static final POILogger logger = POILogFactory.getLogger(TestBugs.class); - private static void assertEqualsIgnoreNewline(String expected, String actual) { String newExpected = expected.replaceAll("\r\n", "\n") .replaceAll("\r", "\n").trim(); |