mirror of https://github.com/apache/poi.git
performance issue logging calls are expensive because of the objects created when assembling the log messages. Using the check() method of the logging sub-system can prevent object creation
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1583357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60801c5017
commit
e684262ca6
|
@ -85,7 +85,9 @@ public final class EscherContainerRecord extends EscherRecord {
|
||||||
addChildRecord(child);
|
addChildRecord(child);
|
||||||
if (offset >= data.length && bytesRemaining > 0) {
|
if (offset >= data.length && bytesRemaining > 0) {
|
||||||
_remainingLength = bytesRemaining;
|
_remainingLength = bytesRemaining;
|
||||||
log.log(POILogger.WARN, "Not enough Escher data: " + bytesRemaining + " bytes remaining but no space left");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not enough Escher data: " + bytesRemaining + " bytes remaining but no space left");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bytesWritten;
|
return bytesWritten;
|
||||||
|
|
|
@ -287,7 +287,9 @@ public final class EscherMetafileBlip extends EscherBlipRecord {
|
||||||
case RECORD_ID_WMF: return HSSFPictureData.MSOBI_WMF;
|
case RECORD_ID_WMF: return HSSFPictureData.MSOBI_WMF;
|
||||||
case RECORD_ID_PICT: return HSSFPictureData.MSOBI_PICT;
|
case RECORD_ID_PICT: return HSSFPictureData.MSOBI_PICT;
|
||||||
}
|
}
|
||||||
log.log(POILogger.WARN, "Unknown metafile: " + getRecordId());
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Unknown metafile: " + getRecordId());
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,9 @@ public final class InternalSheet {
|
||||||
// Not clear which application wrote these files.
|
// Not clear which application wrote these files.
|
||||||
rra = new RowRecordsAggregate();
|
rra = new RowRecordsAggregate();
|
||||||
} else {
|
} else {
|
||||||
log.log(POILogger.WARN, "DIMENSION record not found even though row/cells present");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "DIMENSION record not found even though row/cells present");
|
||||||
|
}
|
||||||
// Not sure if any tools write files like this, but Excel reads them OK
|
// Not sure if any tools write files like this, but Excel reads them OK
|
||||||
}
|
}
|
||||||
dimsloc = findFirstRecordLocBySid(WindowTwoRecord.sid);
|
dimsloc = findFirstRecordLocBySid(WindowTwoRecord.sid);
|
||||||
|
|
|
@ -359,7 +359,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* this method clears the current <code>Clip</code>.
|
* this method clears the current <code>Clip</code>.
|
||||||
*/
|
*/
|
||||||
public void clip(Shape s){
|
public void clip(Shape s){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,7 +381,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
public Shape getClip(){
|
public Shape getClip(){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +651,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
public boolean drawImage(Image img, int x, int y,
|
public boolean drawImage(Image img, int x, int y,
|
||||||
Color bgcolor,
|
Color bgcolor,
|
||||||
ImageObserver observer){
|
ImageObserver observer){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -694,7 +700,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
int width, int height,
|
int width, int height,
|
||||||
Color bgcolor,
|
Color bgcolor,
|
||||||
ImageObserver observer){
|
ImageObserver observer){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +759,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
int dx1, int dy1, int dx2, int dy2,
|
int dx1, int dy1, int dx2, int dy2,
|
||||||
int sx1, int sy1, int sx2, int sy2,
|
int sx1, int sy1, int sx2, int sy2,
|
||||||
ImageObserver observer){
|
ImageObserver observer){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +823,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
int sx1, int sy1, int sx2, int sy2,
|
int sx1, int sy1, int sx2, int sy2,
|
||||||
Color bgcolor,
|
Color bgcolor,
|
||||||
ImageObserver observer){
|
ImageObserver observer){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +863,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public boolean drawImage(Image img, int x, int y,
|
public boolean drawImage(Image img, int x, int y,
|
||||||
ImageObserver observer) {
|
ImageObserver observer) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,7 +1050,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
public void setClip(Shape clip) {
|
public void setClip(Shape clip) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1334,7 +1350,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see java.awt.AlphaComposite
|
* @see java.awt.AlphaComposite
|
||||||
*/
|
*/
|
||||||
public void setComposite(Composite comp){
|
public void setComposite(Composite comp){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1345,7 +1363,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see #setComposite
|
* @see #setComposite
|
||||||
*/
|
*/
|
||||||
public Composite getComposite(){
|
public Composite getComposite(){
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,7 +1506,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see #setClip
|
* @see #setClip
|
||||||
*/
|
*/
|
||||||
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
|
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1589,7 +1611,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see #setClip(Shape)
|
* @see #setClip(Shape)
|
||||||
*/
|
*/
|
||||||
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
|
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,7 +1656,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
public boolean drawImage(Image img, int x, int y,
|
public boolean drawImage(Image img, int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
ImageObserver observer) {
|
ImageObserver observer) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1679,7 +1705,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @param c1 the XOR alternation color
|
* @param c1 the XOR alternation color
|
||||||
*/
|
*/
|
||||||
public void setXORMode(Color c1) {
|
public void setXORMode(Color c1) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1690,7 +1718,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* overwrite the destination with the current color.
|
* overwrite the destination with the current color.
|
||||||
*/
|
*/
|
||||||
public void setPaintMode() {
|
public void setPaintMode() {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1725,7 +1755,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see #drawRenderedImage
|
* @see #drawRenderedImage
|
||||||
*/
|
*/
|
||||||
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
|
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1750,7 +1782,9 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
|
||||||
* @see #setClip
|
* @see #setClip
|
||||||
*/
|
*/
|
||||||
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
|
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
|
||||||
log.log(POILogger.WARN, "Not implemented");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyStroke(SimpleShape shape) {
|
protected void applyStroke(SimpleShape shape) {
|
||||||
|
|
|
@ -170,9 +170,11 @@ public final class FIBFieldHandler
|
||||||
{
|
{
|
||||||
if (dsOffset + dsSize > tableStream.length)
|
if (dsOffset + dsSize > tableStream.length)
|
||||||
{
|
{
|
||||||
log.log(POILogger.WARN, "Unhandled data structure points to outside the buffer. " +
|
if (log.check(POILogger.WARN)) {
|
||||||
"offset = " + dsOffset + ", length = " + dsSize +
|
log.log(POILogger.WARN, "Unhandled data structure points to outside the buffer. " +
|
||||||
", buffer length = " + tableStream.length);
|
"offset = " + dsOffset + ", length = " + dsSize +
|
||||||
|
", buffer length = " + tableStream.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,9 @@ public final class ListTables
|
||||||
ListLevel lvl = lst.getLevels()[level];
|
ListLevel lvl = lst.getLevels()[level];
|
||||||
return lvl;
|
return lvl;
|
||||||
}
|
}
|
||||||
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
|
if (log.check(POILogger.WARN)) {
|
||||||
|
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,12 @@ public class NilPICFAndBinData
|
||||||
|
|
||||||
if ( cbHeader != 0x44 )
|
if ( cbHeader != 0x44 )
|
||||||
{
|
{
|
||||||
log.log( POILogger.WARN, "NilPICFAndBinData at offset ", offset,
|
if (log.check(POILogger.WARN)) {
|
||||||
" cbHeader 0x" + Integer.toHexString( cbHeader )
|
log.log(POILogger.WARN, "NilPICFAndBinData at offset ", offset,
|
||||||
+ " != 0x44" );
|
" cbHeader 0x" + Integer.toHexString(cbHeader)
|
||||||
|
+ " != 0x44"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip the 62 ignored bytes
|
// skip the 62 ignored bytes
|
||||||
|
|
|
@ -106,9 +106,11 @@ public class PlfLfo
|
||||||
|
|
||||||
if ( ( offset - fcPlfLfo ) != lcbPlfLfo )
|
if ( ( offset - fcPlfLfo ) != lcbPlfLfo )
|
||||||
{
|
{
|
||||||
log.log( POILogger.WARN, "Actual size of PlfLfo is "
|
if (log.check(POILogger.WARN)) {
|
||||||
+ ( offset - fcPlfLfo ) + " bytes, but expected "
|
log.log(POILogger.WARN, "Actual size of PlfLfo is "
|
||||||
+ lcbPlfLfo );
|
+ (offset - fcPlfLfo) + " bytes, but expected "
|
||||||
|
+ lcbPlfLfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,10 @@ public class Xstz
|
||||||
short term = LittleEndian.getShort( data, offset );
|
short term = LittleEndian.getShort( data, offset );
|
||||||
if ( term != 0 )
|
if ( term != 0 )
|
||||||
{
|
{
|
||||||
log.log( POILogger.WARN, "chTerm at the end of Xstz at offset ",
|
if (log.check(POILogger.WARN)) {
|
||||||
offset, " is not 0" );
|
log.log(POILogger.WARN, "chTerm at the end of Xstz at offset ",
|
||||||
|
offset, " is not 0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue