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 d9596e3f80
commit 8d81b4fd06
24 changed files with 26 additions and 31 deletions

View File

@ -41,7 +41,7 @@ import org.apache.poi.util.POILogger;
* ids.
*/
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 HSSFDataFormatter _formatter;
private final NumberFormat _defaultFormat;

View File

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

View File

@ -38,7 +38,7 @@ import org.w3c.dom.Document;
* @see 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.

View File

@ -48,7 +48,7 @@ import org.w3c.dom.Element;
* @author Julien Chable
*/
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.

View File

@ -45,7 +45,7 @@ import org.apache.poi.util.SuppressForbidden;
* and {@link #setMinInflateRatio(double)}.
*/
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 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
*/
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 SAXHelper() {}
@ -94,6 +94,7 @@ public final class SAXHelper {
// throttle the log somewhat as it can spam the log otherwise
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);
lastLog = System.currentTimeMillis();
}
}
}

View File

@ -72,7 +72,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument
@Beta
public class XMLSlideShow extends POIXMLDocument
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 List<XSLFSlide> _slides;

View File

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

View File

@ -55,7 +55,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@Beta
public class XSLFGroupShape extends XSLFShape
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 CTGroupShapeProperties _grpSpPr;

View File

@ -71,7 +71,7 @@ public class XSSFImportFromXML {
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) {
_map = map;

View File

@ -34,7 +34,7 @@ import org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator;
* lookup cells within the current Window.
*/
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;

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
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;
/** 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>
*/
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;
/**

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.StringUtil;
* to a {@link HMEFMessage} or one of its {@link Attachment}s.
*/
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 final String data;

View File

@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger;
* or one of its {@link Attachment}s.
*/
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;
/**

View File

@ -31,7 +31,7 @@ import org.apache.poi.util.StringUtil;
* or one of its {@link Attachment}s.
*/
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;
/**

View File

@ -43,7 +43,7 @@ import org.apache.poi.util.StringUtil;
*/
public class CurrentUserAtom
{
private static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class);
private final static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class);
/** Standard Atom header */
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.
*/
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 {
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 int headerSize;

View File

@ -144,7 +144,7 @@ public final class FIBFieldHandler
public static final int STTBLISTNAMES = 91;
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;

View File

@ -34,7 +34,7 @@ import org.apache.poi.util.POILogger;
@Internal
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

View File

@ -37,7 +37,7 @@ import org.apache.poi.util.POILogger;
*/
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

View File

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

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
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_FSIDEBYSIDE = 0x2404;