bug 60526: Make loggers final and make throttled log actually work

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-30 13:09:28 +00:00
parent a977e9eaf2
commit b573615cd0
24 changed files with 26 additions and 31 deletions

View File

@ -41,7 +41,7 @@ import org.apache.poi.util.POILogger;
* ids. * ids.
*/ */
public class FormatTrackingHSSFListener implements HSSFListener { public class FormatTrackingHSSFListener implements HSSFListener {
private static POILogger logger = POILogFactory.getLogger(FormatTrackingHSSFListener.class); private final static POILogger logger = POILogFactory.getLogger(FormatTrackingHSSFListener.class);
private final HSSFListener _childListener; private final HSSFListener _childListener;
private final HSSFDataFormatter _formatter; private final HSSFDataFormatter _formatter;
private final NumberFormat _defaultFormat; private final NumberFormat _defaultFormat;

View File

@ -43,7 +43,7 @@ import org.w3c.dom.NodeList;
public final class PackageRelationshipCollection implements public final class PackageRelationshipCollection implements
Iterable<PackageRelationship> { Iterable<PackageRelationship> {
private static POILogger logger = POILogFactory.getLogger(PackageRelationshipCollection.class); private final static POILogger logger = POILogFactory.getLogger(PackageRelationshipCollection.class);
/** /**
* Package relationships ordered by ID. * Package relationships ordered by ID.

View File

@ -38,7 +38,7 @@ import org.w3c.dom.Document;
* @see ContentTypeManager * @see ContentTypeManager
*/ */
public class ZipContentTypeManager extends ContentTypeManager { public class ZipContentTypeManager extends ContentTypeManager {
private static POILogger logger = POILogFactory.getLogger(ZipContentTypeManager.class); private final static POILogger logger = POILogFactory.getLogger(ZipContentTypeManager.class);
/** /**
* Delegate constructor to the super constructor. * Delegate constructor to the super constructor.

View File

@ -48,7 +48,7 @@ import org.w3c.dom.Element;
* @author Julien Chable * @author Julien Chable
*/ */
public final class ZipPartMarshaller implements PartMarshaller { public final class ZipPartMarshaller implements PartMarshaller {
private static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class); private final static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class);
/** /**
* Save the specified part. * Save the specified part.

View File

@ -45,7 +45,7 @@ import org.apache.poi.util.SuppressForbidden;
* and {@link #setMinInflateRatio(double)}. * and {@link #setMinInflateRatio(double)}.
*/ */
public class ZipSecureFile extends ZipFile { public class ZipSecureFile extends ZipFile {
private static POILogger logger = POILogFactory.getLogger(ZipSecureFile.class); private final static POILogger logger = POILogFactory.getLogger(ZipSecureFile.class);
private static double MIN_INFLATE_RATIO = 0.01d; private static double MIN_INFLATE_RATIO = 0.01d;
private static long MAX_ENTRY_SIZE = 0xFFFFFFFFL; private static long MAX_ENTRY_SIZE = 0xFFFFFFFFL;

View File

@ -36,7 +36,7 @@ import org.xml.sax.XMLReader;
* Provides handy methods for working with SAX parsers and readers * Provides handy methods for working with SAX parsers and readers
*/ */
public final class SAXHelper { public final class SAXHelper {
private static POILogger logger = POILogFactory.getLogger(SAXHelper.class); private static final POILogger logger = POILogFactory.getLogger(SAXHelper.class);
private static long lastLog = 0; private static long lastLog = 0;
private SAXHelper() {} private SAXHelper() {}
@ -94,6 +94,7 @@ public final class SAXHelper {
// throttle the log somewhat as it can spam the log otherwise // throttle the log somewhat as it can spam the log otherwise
if(System.currentTimeMillis() > lastLog + TimeUnit.MINUTES.toMillis(5)) { if(System.currentTimeMillis() > lastLog + TimeUnit.MINUTES.toMillis(5)) {
logger.log(POILogger.WARN, "SAX Security Manager could not be setup [log suppressed for 5 minutes]", e); logger.log(POILogger.WARN, "SAX Security Manager could not be setup [log suppressed for 5 minutes]", e);
lastLog = System.currentTimeMillis();
} }
} }
} }

View File

@ -72,7 +72,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument
@Beta @Beta
public class XMLSlideShow extends POIXMLDocument public class XMLSlideShow extends POIXMLDocument
implements SlideShow<XSLFShape,XSLFTextParagraph> { implements SlideShow<XSLFShape,XSLFTextParagraph> {
private static POILogger _logger = POILogFactory.getLogger(XMLSlideShow.class); private final static POILogger _logger = POILogFactory.getLogger(XMLSlideShow.class);
private CTPresentation _presentation; private CTPresentation _presentation;
private List<XSLFSlide> _slides; private List<XSLFSlide> _slides;

View File

@ -46,7 +46,7 @@ import org.w3c.dom.Node;
@Beta @Beta
@Internal @Internal
public class XSLFColor { public class XSLFColor {
private static POILogger LOGGER = POILogFactory.getLogger(XSLFColor.class); private final static POILogger LOGGER = POILogFactory.getLogger(XSLFColor.class);
private XmlObject _xmlObject; private XmlObject _xmlObject;
private Color _color; private Color _color;

View File

@ -55,7 +55,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@Beta @Beta
public class XSLFGroupShape extends XSLFShape public class XSLFGroupShape extends XSLFShape
implements XSLFShapeContainer, GroupShape<XSLFShape,XSLFTextParagraph> { implements XSLFShapeContainer, GroupShape<XSLFShape,XSLFTextParagraph> {
private static POILogger _logger = POILogFactory.getLogger(XSLFGroupShape.class); private final static POILogger _logger = POILogFactory.getLogger(XSLFGroupShape.class);
private final List<XSLFShape> _shapes; private final List<XSLFShape> _shapes;
private final CTGroupShapeProperties _grpSpPr; private final CTGroupShapeProperties _grpSpPr;

View File

@ -71,7 +71,7 @@ public class XSSFImportFromXML {
private final XSSFMap _map; private final XSSFMap _map;
private static POILogger logger = POILogFactory.getLogger(XSSFImportFromXML.class); private final static POILogger logger = POILogFactory.getLogger(XSSFImportFromXML.class);
public XSSFImportFromXML(XSSFMap map) { public XSSFImportFromXML(XSSFMap map) {
_map = map; _map = map;

View File

@ -34,7 +34,7 @@ import org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator;
* lookup cells within the current Window. * lookup cells within the current Window.
*/ */
public final class SXSSFFormulaEvaluator extends BaseXSSFFormulaEvaluator { public final class SXSSFFormulaEvaluator extends BaseXSSFFormulaEvaluator {
private static POILogger logger = POILogFactory.getLogger(SXSSFFormulaEvaluator.class); private final static POILogger logger = POILogFactory.getLogger(SXSSFFormulaEvaluator.class);
private SXSSFWorkbook wb; private SXSSFWorkbook wb;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogger;
public final class ChunkStream extends Stream { public final class ChunkStream extends Stream {
private static POILogger logger = POILogFactory.getLogger(ChunkStream.class); private final static POILogger logger = POILogFactory.getLogger(ChunkStream.class);
private ChunkFactory chunkFactory; private ChunkFactory chunkFactory;
/** All the Chunks we contain */ /** All the Chunks we contain */

View File

@ -42,7 +42,7 @@ import org.apache.poi.util.POILogger;
* @see <a href="https://msdn.microsoft.com/en-us/library/cc433490(v=exchg.80).aspx">[MS-OXPROPS]: Exchange Server Protocols Master Property List</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 { public final class MAPIDateAttribute extends MAPIAttribute {
private static POILogger logger = POILogFactory.getLogger(MAPIDateAttribute.class); private final static POILogger logger = POILogFactory.getLogger(MAPIDateAttribute.class);
private Date data; private Date data;
/** /**

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.StringUtil;
* to a {@link HMEFMessage} or one of its {@link Attachment}s. * to a {@link HMEFMessage} or one of its {@link Attachment}s.
*/ */
public final class MAPIStringAttribute extends MAPIAttribute { public final class MAPIStringAttribute extends MAPIAttribute {
private static POILogger logger = POILogFactory.getLogger(MAPIStringAttribute.class); private final static POILogger logger = POILogFactory.getLogger(MAPIStringAttribute.class);
private static final String CODEPAGE = "CP1252"; private static final String CODEPAGE = "CP1252";
private final String data; private final String data;

View File

@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger;
* or one of its {@link Attachment}s. * or one of its {@link Attachment}s.
*/ */
public final class TNEFDateAttribute extends TNEFAttribute { public final class TNEFDateAttribute extends TNEFAttribute {
private static POILogger logger = POILogFactory.getLogger(TNEFDateAttribute.class); private final static POILogger logger = POILogFactory.getLogger(TNEFDateAttribute.class);
private Date data; private Date data;
/** /**

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.StringUtil;
* or one of its {@link Attachment}s. * or one of its {@link Attachment}s.
*/ */
public final class TNEFStringAttribute extends TNEFAttribute { public final class TNEFStringAttribute extends TNEFAttribute {
private static POILogger logger = POILogFactory.getLogger(TNEFStringAttribute.class); private final static POILogger logger = POILogFactory.getLogger(TNEFStringAttribute.class);
private String data; private String data;
/** /**

View File

@ -43,7 +43,7 @@ import org.apache.poi.util.StringUtil;
*/ */
public class CurrentUserAtom public class CurrentUserAtom
{ {
private static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class); private final static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class);
/** Standard Atom header */ /** Standard Atom header */
public static final byte[] atomHeader = new byte[] { 0, 0, -10, 15 }; public static final byte[] atomHeader = new byte[] { 0, 0, -10, 15 };

View File

@ -50,7 +50,7 @@ import org.apache.poi.util.POILogger;
* data and so on. * data and so on.
*/ */
public final class POIFSChunkParser { public final class POIFSChunkParser {
private static POILogger logger = POILogFactory.getLogger(POIFSChunkParser.class); private final static POILogger logger = POILogFactory.getLogger(POIFSChunkParser.class);
public static ChunkGroup[] parse(NPOIFSFileSystem fs) throws IOException { public static ChunkGroup[] parse(NPOIFSFileSystem fs) throws IOException {
return parse(fs.getRoot()); return parse(fs.getRoot());

View File

@ -189,7 +189,7 @@ public class HwmfBitmapDib {
} }
} }
private static POILogger logger = POILogFactory.getLogger(HwmfBitmapDib.class); private final static POILogger logger = POILogFactory.getLogger(HwmfBitmapDib.class);
private static final int BMP_HEADER_SIZE = 14; private static final int BMP_HEADER_SIZE = 14;
private int headerSize; private int headerSize;

View File

@ -144,7 +144,7 @@ public final class FIBFieldHandler
public static final int STTBLISTNAMES = 91; public static final int STTBLISTNAMES = 91;
public static final int STTBFUSSR = 92; public static final int STTBFUSSR = 92;
private static POILogger log = POILogFactory.getLogger(FIBFieldHandler.class); private final static POILogger log = POILogFactory.getLogger(FIBFieldHandler.class);
private static final int FIELD_SIZE = LittleEndian.INT_SIZE * 2; private static final int FIELD_SIZE = LittleEndian.INT_SIZE * 2;

View File

@ -34,7 +34,7 @@ import org.apache.poi.util.POILogger;
@Internal @Internal
public final class ListTables public final class ListTables
{ {
private static POILogger log = POILogFactory.getLogger(ListTables.class); private final static POILogger log = POILogFactory.getLogger(ListTables.class);
/** /**
* Both PlfLst and the following LVLs * Both PlfLst and the following LVLs

View File

@ -37,7 +37,7 @@ import org.apache.poi.util.POILogger;
*/ */
public class PlfLfo public class PlfLfo
{ {
private static POILogger log = POILogFactory.getLogger( PlfLfo.class ); private final static POILogger log = POILogFactory.getLogger( PlfLfo.class );
/** /**
* An unsigned integer that specifies the count of elements in both the * An unsigned integer that specifies the count of elements in both the

View File

@ -48,14 +48,11 @@ import org.apache.poi.hwpf.sprm.ParagraphSprmCompressor;
*/ */
public final class HWPFList public final class HWPFList
{ {
//private static POILogger log = POILogFactory.getLogger( HWPFList.class );
private boolean _ignoreLogicalLeftIdentation = false; private boolean _ignoreLogicalLeftIdentation = false;
private LFO _lfo; private LFO _lfo;
private LFOData _lfoData; private LFOData _lfoData;
private ListData _listData; private ListData _listData;
private ListTables _listTables; private ListTables _listTables;
private boolean _registered;
private StyleSheet _styleSheet; private StyleSheet _styleSheet;
/** /**
@ -80,7 +77,6 @@ public final class HWPFList
{ {
_listTables = listTables; _listTables = listTables;
_styleSheet = styleSheet; _styleSheet = styleSheet;
_registered = true;
/* See documentation for sprmPIlfo (0x460B) */ /* See documentation for sprmPIlfo (0x460B) */
if ( ilfo == 0 || ilfo == 0xF801 ) if ( ilfo == 0 || ilfo == 0xF801 )
@ -214,8 +210,7 @@ public final class HWPFList
int styleIndex = _listData.getLevelStyle( level ); int styleIndex = _listData.getLevelStyle( level );
CharacterProperties base = _styleSheet.getCharacterStyle( styleIndex ); CharacterProperties base = _styleSheet.getCharacterStyle( styleIndex );
byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty( chp, byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty( chp, base );
base );
listLevel.setNumberProperties( grpprl ); listLevel.setNumberProperties( grpprl );
} }
@ -233,8 +228,7 @@ public final class HWPFList
int styleIndex = _listData.getLevelStyle( level ); int styleIndex = _listData.getLevelStyle( level );
ParagraphProperties base = _styleSheet.getParagraphStyle( styleIndex ); ParagraphProperties base = _styleSheet.getParagraphStyle( styleIndex );
byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty( pap, byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty( pap, base );
base );
listLevel.setLevelProperties( grpprl ); listLevel.setLevelProperties( grpprl );
} }

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogger;
public class Paragraph extends Range implements Cloneable { public class Paragraph extends Range implements Cloneable {
private static POILogger log = POILogFactory.getLogger( Paragraph.class ); private final static POILogger log = POILogFactory.getLogger( Paragraph.class );
public final static short SPRM_JC = 0x2403; public final static short SPRM_JC = 0x2403;
public final static short SPRM_FSIDEBYSIDE = 0x2404; public final static short SPRM_FSIDEBYSIDE = 0x2404;