From 5548b2ff907dc1c8a07771d463711ed312b777c9 Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Sun, 20 Jun 2004 10:18:50 +0000 Subject: [PATCH] Conditional check for logging to avoid creating too many temporary objects. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353559 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hssf/model/Sheet.java | 103 +++++++++++------ .../org/apache/poi/hssf/model/Workbook.java | 104 +++++++++++------- .../poi/hssf/usermodel/EscherGraphics.java | 42 ++++--- .../poi/hssf/usermodel/EscherGraphics2d.java | 13 ++- .../poi/hssf/usermodel/HSSFWorkbook.java | 3 +- 5 files changed, 170 insertions(+), 95 deletions(-) diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 7d2e95468d..d57d1300c4 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -135,18 +135,21 @@ public class Sheet implements Model if (rec.getSid() == LabelRecord.sid) { - log.log(POILogger.DEBUG, "Hit label record."); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Hit label record."); retval.containsLabels = true; } else if (rec.getSid() == BOFRecord.sid) { bofEofNestingLevel++; - log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel); } else if (rec.getSid() == EOFRecord.sid) { --bofEofNestingLevel; - log.log(POILogger.DEBUG, "Hit EOF record. Nesting decreased to " + bofEofNestingLevel); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Hit EOF record. Nesting decreased to " + bofEofNestingLevel); if (bofEofNestingLevel == 0) { records.add(rec); retval.eofLoc = k; @@ -285,7 +288,8 @@ public class Sheet implements Model { retval.cells = new ValueRecordsAggregate(); } - log.log(POILogger.DEBUG, "sheet createSheet (existing file) exited"); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "sheet createSheet (existing file) exited"); return retval; } @@ -344,7 +348,8 @@ public class Sheet implements Model public static Sheet createSheet(List records, int sheetnum) { - log.log(POILogger.DEBUG, + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Sheet createSheet (exisiting file) assumed offset 0"); return createSheet(records, sheetnum, 0); } @@ -359,7 +364,8 @@ public class Sheet implements Model public static Sheet createSheet() { - log.log(POILogger.DEBUG, "Sheet createsheet from scratch called"); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Sheet createsheet from scratch called"); Sheet retval = new Sheet(); ArrayList records = new ArrayList(30); @@ -409,7 +415,8 @@ public class Sheet implements Model records.add(retval.protect); records.add(retval.createEOF()); retval.records = records; - log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit"); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit"); return retval; } @@ -553,7 +560,8 @@ public class Sheet implements Model public void convertLabelRecords(Workbook wb) { - log.log(POILogger.DEBUG, "convertLabelRecords called"); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "convertLabelRecords called"); if (containsLabels) { for (int k = 0; k < records.size(); k++) @@ -577,7 +585,8 @@ public class Sheet implements Model } } } - log.log(POILogger.DEBUG, "convertLabelRecords exit"); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "convertLabelRecords exit"); } /** @@ -591,14 +600,17 @@ public class Sheet implements Model { checkCells(); checkRows(); - log.log(POILogger.DEBUG, "Sheet.getNumRecords"); - log.logFormatted(POILogger.DEBUG, "returning % + % + % - 2 = %", new int[] + if (log.check( POILogger.DEBUG )) { - records.size(), cells.getPhysicalNumberOfCells(), - rows.getPhysicalNumberOfRows(), - records.size() + cells.getPhysicalNumberOfCells() - + rows.getPhysicalNumberOfRows() - 2 - }); + log.log(POILogger.DEBUG, "Sheet.getNumRecords"); + log.logFormatted(POILogger.DEBUG, "returning % + % + % - 2 = %", new int[] + { + records.size(), cells.getPhysicalNumberOfCells(), + rows.getPhysicalNumberOfRows(), + records.size() + cells.getPhysicalNumberOfCells() + + rows.getPhysicalNumberOfRows() - 2 + }); + } return records.size() + cells.getPhysicalNumberOfCells() + rows.getPhysicalNumberOfRows() - 2; } @@ -615,17 +627,23 @@ public class Sheet implements Model public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol) { - log.log(POILogger.DEBUG, "Sheet.setDimensions"); - log.log(POILogger.DEBUG, - (new StringBuffer("firstrow")).append(firstrow) - .append("firstcol").append(firstcol).append("lastrow") - .append(lastrow).append("lastcol").append(lastcol) - .toString()); + if (log.check( POILogger.DEBUG )) + { + log.log(POILogger.DEBUG, "Sheet.setDimensions"); + log.log(POILogger.DEBUG, + (new StringBuffer("firstrow")).append(firstrow) + .append("firstcol").append(firstcol).append("lastrow") + .append(lastrow).append("lastcol").append(lastcol) + .toString()); + } dims.setFirstCol(firstcol); dims.setFirstRow(firstrow); dims.setLastCol(lastcol); dims.setLastRow(lastrow); - log.log(log.DEBUG, "Sheet.setDimensions exiting"); + if (log.check( POILogger.DEBUG )) + { + log.log(POILogger.DEBUG, "Sheet.setDimensions exiting"); + } } /** @@ -647,7 +665,8 @@ public class Sheet implements Model public void setLoc(int loc) { valueRecIterator = null; - log.log(log.DEBUG, "sheet.setLoc(): " + loc); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "sheet.setLoc(): " + loc); this.loc = loc; } @@ -658,7 +677,8 @@ public class Sheet implements Model public int getLoc() { - log.log(log.DEBUG, "sheet.getLoc():" + loc); + if (log.check( POILogger.DEBUG )) + log.log(POILogger.DEBUG, "sheet.getLoc():" + loc); return loc; } @@ -697,7 +717,8 @@ public class Sheet implements Model public int serialize(int offset, byte [] data) { - log.log(log.DEBUG, "Sheet.serialize using offsets"); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "Sheet.serialize using offsets"); int pos = offset; boolean haveSerializedIndex = false; @@ -725,7 +746,8 @@ public class Sheet implements Model } } } - log.log(log.DEBUG, "Sheet.serialize returning "); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "Sheet.serialize returning "); return pos-offset; } @@ -774,7 +796,8 @@ public class Sheet implements Model public RowRecord createRow(int row) { - log.log(log.DEBUG, "create row number " + row); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "create row number " + row); RowRecord rowrec = new RowRecord(); //rowrec.setRowNumber(( short ) row); @@ -1020,7 +1043,8 @@ public class Sheet implements Model { checkCells(); setLoc(dimsloc); - log.log(log.DEBUG, "replaceValueRecord "); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "replaceValueRecord "); cells.insertCell(newval); /* @@ -1056,7 +1080,8 @@ public class Sheet implements Model public void addRow(RowRecord row) { checkRows(); - log.log(log.DEBUG, "addRow "); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "addRow "); DimensionsRecord d = ( DimensionsRecord ) records.get(getDimsLoc()); if (row.getRowNumber() > d.getLastRow()) @@ -1110,7 +1135,8 @@ public class Sheet implements Model * } * } */ - log.log(log.DEBUG, "exit addRow"); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "exit addRow"); } /** @@ -1171,7 +1197,8 @@ public class Sheet implements Model public CellValueRecordInterface getNextValueRecord() { - log.log(log.DEBUG, "getNextValue loc= " + loc); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "getNextValue loc= " + loc); if (valueRecIterator == null) { valueRecIterator = cells.getIterator(); @@ -1258,7 +1285,8 @@ public class Sheet implements Model public RowRecord getNextRow() { - log.log(log.DEBUG, "getNextRow loc= " + loc); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "getNextRow loc= " + loc); if (rowRecIterator == null) { rowRecIterator = rows.getIterator(); @@ -1304,7 +1332,8 @@ public class Sheet implements Model //public RowRecord getRow(short rownum) public RowRecord getRow(int rownum) { - log.log(log.DEBUG, "getNextRow loc= " + loc); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "getNextRow loc= " + loc); if (rows == null) { return null; } @@ -2072,7 +2101,8 @@ public class Sheet implements Model public int getDimsLoc() { - log.log(log.DEBUG, "getDimsLoc dimsloc= " + dimsloc); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "getDimsLoc dimsloc= " + dimsloc); return dimsloc; } @@ -2525,7 +2555,8 @@ public class Sheet implements Model protected Record createProtect() { - log.log(log.DEBUG, "create protect record with protection disabled"); + if (log.check( POILogger.DEBUG )) + log.log(log.DEBUG, "create protect record with protection disabled"); ProtectRecord retval = new ProtectRecord(); retval.setProtect(false); diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index 0264420f0f..c3a9437fc7 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -121,8 +121,9 @@ public class Workbook implements Model { * @return Workbook object */ public static Workbook createWorkbook(List recs) { - log.log(DEBUG, "Workbook (readfile) created with reclen=", - new Integer(recs.size())); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "Workbook (readfile) created with reclen=", + new Integer(recs.size())); Workbook retval = new Workbook(); ArrayList records = new ArrayList(recs.size() / 3); @@ -131,85 +132,100 @@ public class Workbook implements Model { if (rec.getSid() == EOFRecord.sid) { records.add(rec); - log.log(DEBUG, "found workbook eof record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found workbook eof record at " + k); break; } switch (rec.getSid()) { case BoundSheetRecord.sid : - log.log(DEBUG, "found boundsheet record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found boundsheet record at " + k); retval.boundsheets.add(rec); retval.records.setBspos( k ); break; case SSTRecord.sid : - log.log(DEBUG, "found sst record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found sst record at " + k); retval.sst = ( SSTRecord ) rec; break; case FontRecord.sid : - log.log(DEBUG, "found font record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found font record at " + k); retval.records.setFontpos( k ); retval.numfonts++; break; case ExtendedFormatRecord.sid : - log.log(DEBUG, "found XF record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found XF record at " + k); retval.records.setXfpos( k ); retval.numxfs++; break; case TabIdRecord.sid : - log.log(DEBUG, "found tabid record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found tabid record at " + k); retval.records.setTabpos( k ); break; case ProtectRecord.sid : - log.log(DEBUG, "found protect record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found protect record at " + k); retval.records.setProtpos( k ); break; case BackupRecord.sid : - log.log(DEBUG, "found backup record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found backup record at " + k); retval.records.setBackuppos( k ); break; case ExternSheetRecord.sid : - log.log(DEBUG, "found extern sheet record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found extern sheet record at " + k); retval.externSheet = ( ExternSheetRecord ) rec; break; case NameRecord.sid : - log.log(DEBUG, "found name record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found name record at " + k); retval.names.add(rec); -// retval.records.namepos = k; + // retval.records.namepos = k; break; case SupBookRecord.sid : - log.log(DEBUG, "found SupBook record at " + k); -// retval.records.supbookpos = k; + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found SupBook record at " + k); + // retval.records.supbookpos = k; + break; + case FormatRecord.sid : + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found format record at " + k); + retval.formats.add(rec); + retval.maxformatid = retval.maxformatid >= ((FormatRecord)rec).getIndexCode() ? retval.maxformatid : ((FormatRecord)rec).getIndexCode(); break; - case FormatRecord.sid : - log.log(DEBUG, "found format record at " + k); - retval.formats.add(rec); - retval.maxformatid = retval.maxformatid >= ((FormatRecord)rec).getIndexCode() ? retval.maxformatid : ((FormatRecord)rec).getIndexCode(); - break; case DateWindow1904Record.sid : - log.log(DEBUG, "found datewindow1904 record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found datewindow1904 record at " + k); retval.uses1904datewindowing = ((DateWindow1904Record)rec).getWindowing() == 1; break; case PaletteRecord.sid: - log.log(DEBUG, "found palette record at " + k); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "found palette record at " + k); retval.records.setPalettepos( k ); default : } records.add(rec); } //What if we dont have any ranges and supbooks -// if (retval.records.supbookpos == 0) { -// retval.records.supbookpos = retval.records.bspos + 1; -// retval.records.namepos = retval.records.supbookpos + 1; -// } + // if (retval.records.supbookpos == 0) { + // retval.records.supbookpos = retval.records.bspos + 1; + // retval.records.namepos = retval.records.supbookpos + 1; + // } retval.records.setRecords(records); - log.log(DEBUG, "exit create workbook from existing file function"); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "exit create workbook from existing file function"); return retval; } @@ -219,7 +235,8 @@ public class Workbook implements Model { */ public static Workbook createWorkbook() { - log.log( DEBUG, "creating new workbook from scratch" ); + if (log.check( POILogger.DEBUG )) + log.log( DEBUG, "creating new workbook from scratch" ); Workbook retval = new Workbook(); ArrayList records = new ArrayList( 30 ); ArrayList formats = new ArrayList( 8 ); @@ -295,7 +312,8 @@ public class Workbook implements Model { records.add( retval.createEOF() ); retval.records.setRecords(records); - log.log( DEBUG, "exit create new workbook from scratch" ); + if (log.check( POILogger.DEBUG )) + log.log( DEBUG, "exit create new workbook from scratch" ); return retval; } @@ -402,8 +420,9 @@ public class Workbook implements Model { */ public void setSheetBof(int sheetnum, int pos) { - log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetnum), - " at pos=", new Integer(pos)); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetnum), + " at pos=", new Integer(pos)); checkSheets(sheetnum); (( BoundSheetRecord ) boundsheets.get(sheetnum)) .setPositionOfBof(pos); @@ -534,7 +553,8 @@ public class Workbook implements Model { */ public int getNumSheets() { - log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size())); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size())); return boundsheets.size(); } @@ -545,7 +565,8 @@ public class Workbook implements Model { */ public int getNumExFormats() { - log.log(DEBUG, "getXF=", new Integer(numxfs)); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "getXF=", new Integer(numxfs)); return numxfs; } @@ -592,7 +613,8 @@ public class Workbook implements Model { */ public int addSSTString(String string, boolean use16bits) { - log.log(DEBUG, "insert to sst string='", string, "' and use16bits= ", + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "insert to sst string='", string, "' and use16bits= ", new Boolean(use16bits)); if (sst == null) { insertSST(); @@ -625,8 +647,9 @@ public class Workbook implements Model { } String retval = sst.getString(str); - log.log(DEBUG, "Returning SST for index=", new Integer(str), - " String= ", retval); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "Returning SST for index=", new Integer(str), + " String= ", retval); return retval; } @@ -638,7 +661,8 @@ public class Workbook implements Model { */ public void insertSST() { - log.log(DEBUG, "creating new SST via insertSST!"); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "creating new SST via insertSST!"); sst = ( SSTRecord ) createSST(); records.add(records.size() - 1, createExtendedSST()); records.add(records.size() - 2, sst); @@ -691,7 +715,8 @@ public class Workbook implements Model { public int serialize( int offset, byte[] data ) { - log.log( DEBUG, "Serializing Workbook with offsets" ); + if (log.check( POILogger.DEBUG )) + log.log( DEBUG, "Serializing Workbook with offsets" ); int pos = 0; @@ -716,7 +741,8 @@ public class Workbook implements Model { pos += record.serialize( pos + offset, data ); // rec.length; } } - log.log( DEBUG, "Exiting serialize workbook" ); + if (log.check( POILogger.DEBUG )) + log.log( DEBUG, "Exiting serialize workbook" ); return pos; } diff --git a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java index d19347b30b..da8f6a8be8 100644 --- a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java +++ b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java @@ -133,12 +133,14 @@ public class EscherGraphics public void clipRect(int x, int y, int width, int height) { - logger.log(POILogger.WARN,"clipRect not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"clipRect not supported"); } public void copyArea(int x, int y, int width, int height, int dx, int dy) { - logger.log(POILogger.WARN,"copyArea not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"copyArea not supported"); } public Graphics create() @@ -155,7 +157,8 @@ public class EscherGraphics public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { - logger.log(POILogger.WARN,"drawArc not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawArc not supported"); } public boolean drawImage(Image img, @@ -164,7 +167,8 @@ public class EscherGraphics Color bgcolor, ImageObserver observer) { - logger.log(POILogger.WARN,"drawImage not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawImage not supported"); return true; } @@ -174,7 +178,8 @@ public class EscherGraphics int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - logger.log(POILogger.WARN,"drawImage not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawImage not supported"); return true; } @@ -241,18 +246,21 @@ public class EscherGraphics public void drawPolyline(int xPoints[], int yPoints[], int nPoints) { - logger.log(POILogger.WARN,"drawPolyline not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawPolyline not supported"); } public void drawRect(int x, int y, int width, int height) { - logger.log(POILogger.WARN,"drawRect not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawRect not supported"); } public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { - logger.log(POILogger.WARN,"drawRoundRect not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawRoundRect not supported"); } public void drawString(String str, int x, int y) @@ -318,13 +326,15 @@ public class EscherGraphics public void drawString(AttributedCharacterIterator iterator, int x, int y) { - logger.log(POILogger.WARN,"drawString not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawString not supported"); } public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { - logger.log(POILogger.WARN,"fillArc not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"fillArc not supported"); } public void fillOval(int x, int y, int width, int height) @@ -384,7 +394,8 @@ public class EscherGraphics public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { - logger.log(POILogger.WARN,"fillRoundRect not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"fillRoundRect not supported"); } public Shape getClip() @@ -439,17 +450,20 @@ public class EscherGraphics public void setPaintMode() { - logger.log(POILogger.WARN,"setPaintMode not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"setPaintMode not supported"); } public void setXORMode(Color color) { - logger.log(POILogger.WARN,"setXORMode not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"setXORMode not supported"); } public void translate(int x, int y) { - logger.log(POILogger.WARN,"translate not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"translate not supported"); } public Color getBackground() diff --git a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java index b46dc147c5..746c7c773b 100644 --- a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java +++ b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java @@ -142,7 +142,8 @@ public class EscherGraphics2d extends Graphics2D public void draw(Shape shape) { - logger.log(POILogger.WARN,"copyArea not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"copyArea not supported"); } public void drawArc(int x, int y, int width, int height, @@ -159,19 +160,20 @@ public class EscherGraphics2d extends Graphics2D public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgColor, ImageObserver imageobserver) { - logger.log(POILogger.WARN,"drawImage() not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawImage() not supported"); return true; } public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver imageobserver) { - logger.log(POILogger.WARN,"drawImage() not supported"); return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, imageobserver); } public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, Color bgColor, ImageObserver imageobserver) { - logger.log(POILogger.WARN,"drawImage() not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"drawImage() not supported"); return true; } @@ -286,7 +288,8 @@ public class EscherGraphics2d extends Graphics2D public void fill(Shape shape) { - logger.log(POILogger.WARN,"fill(Shape) not supported"); + if (logger.check( POILogger.WARN )) + logger.log(POILogger.WARN,"fill(Shape) not supported"); } public void fillArc(int i, int j, int k, int l, int i1, int j1) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index c1d643e77b..4b93d1b12d 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -754,7 +754,8 @@ public class HSSFWorkbook public byte[] getBytes() { - log.log(DEBUG, "HSSFWorkbook.getBytes()"); + if (log.check( POILogger.DEBUG )) + log.log(DEBUG, "HSSFWorkbook.getBytes()"); int wbsize = workbook.getSize(); // log.debug("REMOVEME: old sizing method "+workbook.serialize().length); -- 2.39.5