<changes>
<release version="3.9-beta1" date="2012-??-??">
+ <action dev="poi-developers" type="fix">52628 - Replace System.err info messages with a POILogger</action>
<action dev="poi-developers" type="fix">54137 - improved performance of DataFormatter with Fractions</action>
<action dev="poi-developers" type="fix">54099 - Ensure that CTHMerge and CTTcBorders go to poi-ooxml-schemas jar</action>
<action dev="poi-developers" type="fix">54111 - Fixed extracting text from table cells in HSLF</action>
logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length);
} catch(org.apache.poi.hpsf.WritingNotSupportedException wnse) {
- System.err.println("Couldn't write property set with name " + name + " as not supported by HPSF yet");
+ logger.log( POILogger.ERROR, "Couldn't write property set with name " + name + " as not supported by HPSF yet");
}
}
package org.apache.poi.hpsf;
-import java.io.PrintStream;
-import java.io.PrintWriter;
/**
* <p>This exception is the superclass of all other unchecked
*/
public class HPSFRuntimeException extends RuntimeException
{
-
- /** <p>The underlying reason for this exception - may be
+ private static final long serialVersionUID = -7804271670232727159L;
+ /** <p>The underlying reason for this exception - may be
* <code>null</code>.</p> */
private Throwable reason;
- /**
- * @see Throwable#printStackTrace()
- */
- public void printStackTrace()
- {
- printStackTrace(System.err);
- }
-
-
-
- /**
- * @see Throwable#printStackTrace(java.io.PrintStream)
- */
- public void printStackTrace(final PrintStream p)
- {
- final Throwable reason = getReason();
- super.printStackTrace(p);
- if (reason != null)
- {
- p.println("Caused by:");
- reason.printStackTrace(p);
- }
- }
-
-
-
- /**
- * @see Throwable#printStackTrace(java.io.PrintWriter)
- */
- public void printStackTrace(final PrintWriter p)
- {
- final Throwable reason = getReason();
- super.printStackTrace(p);
- if (reason != null)
- {
- p.println("Caused by:");
- reason.printStackTrace(p);
- }
- }
+// /**
+// * @see Throwable#printStackTrace()
+// */
+// public void printStackTrace()
+// {
+// printStackTrace(System.err);
+// }
+
+
+
+// /**
+// * @see Throwable#printStackTrace(java.io.PrintStream)
+// */
+// public void printStackTrace(final PrintStream p)
+// {
+// final Throwable reason = getReason();
+// super.printStackTrace(p);
+// if (reason != null)
+// {
+// p.println("Caused by:");
+// reason.printStackTrace(p);
+// }
+// }
+
+
+
+// /**
+// * @see Throwable#printStackTrace(java.io.PrintWriter)
+// */
+// public void printStackTrace(final PrintWriter p)
+// {
+// final Throwable reason = getReason();
+// super.printStackTrace(p);
+// if (reason != null)
+// {
+// p.println("Caused by:");
+// reason.printStackTrace(p);
+// }
+// }
}
import java.util.LinkedList;
import java.util.List;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
/**
* <p>Supports reading and writing of variant data.</p>
*
*/
public class VariantSupport extends Variant
{
-
+ private static POILogger logger = POILogFactory.getLogger(VariantSupport.class);
private static boolean logUnsupportedTypes = false;
/**
* <p>Keeps a list of the variant types an "unsupported" message has already
* been issued for.</p>
*/
- protected static List unsupportedMessage;
+ protected static List<Long> unsupportedMessage;
/**
* <p>Writes a warning to <code>System.err</code> that a variant type is
if (isLogUnsupportedTypes())
{
if (unsupportedMessage == null)
- unsupportedMessage = new LinkedList();
+ unsupportedMessage = new LinkedList<Long>();
Long vt = Long.valueOf(ex.getVariantType());
if (!unsupportedMessage.contains(vt))
{
- System.err.println(ex.getMessage());
+ logger.log( POILogger.ERROR, ex.getMessage());
unsupportedMessage.add(vt);
}
}
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* A proxy HSSFListener that keeps track of the document formatting records, and
* ids.
*/
public class FormatTrackingHSSFListener implements HSSFListener {
+ private static POILogger logger = POILogFactory.getLogger(FormatTrackingHSSFListener.class);
private final HSSFListener _childListener;
private final HSSFDataFormatter _formatter;
private final NumberFormat _defaultFormat;
if (formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
FormatRecord tfr = _customFormatRecords.get(Integer.valueOf(formatIndex));
if (tfr == null) {
- System.err.println("Requested format at index " + formatIndex
+ logger.log( POILogger.ERROR, "Requested format at index " + formatIndex
+ ", but it wasn't found");
} else {
format = tfr.getFormatString();
public int getFormatIndex(CellValueRecordInterface cell) {
ExtendedFormatRecord xfr = _xfRecords.get(cell.getXFIndex());
if (xfr == null) {
- System.err.println("Cell " + cell.getRow() + "," + cell.getColumn()
+ logger.log( POILogger.ERROR, "Cell " + cell.getRow() + "," + cell.getColumn()
+ " uses XF with index " + cell.getXFIndex() + ", but we don't have that");
return -1;
}
import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianInputStream;
import org.apache.poi.util.LittleEndianOutput;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.apache.poi.util.StringUtil;
/**
* @author Daniel Noll
*/
public final class EmbeddedObjectRefSubRecord extends SubRecord {
+ private static POILogger logger = POILogFactory.getLogger(EmbeddedObjectRefSubRecord.class);
public static final short sid = 0x0009;
private static final byte[] EMPTY_BYTE_ARRAY = { };
int nUnexpectedPadding = remaining - dataLenAfterFormula;
if (nUnexpectedPadding > 0) {
- System.err.println("Discarding " + nUnexpectedPadding + " unexpected padding bytes ");
+ logger.log( POILogger.ERROR, "Discarding " + nUnexpectedPadding + " unexpected padding bytes ");
readRawData(in, nUnexpectedPadding);
remaining-=nUnexpectedPadding;
}
import org.apache.poi.hssf.record.common.SharedFeature;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.LittleEndianOutput;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Title: Feat (Feature) Record
* up with a {@link FeatHdrRecord}.
*/
public final class FeatRecord extends StandardRecord {
+ private static POILogger logger = POILogFactory.getLogger(FeatRecord.class);
public final static short sid = 0x0868;
private FtrHeader futureHeader;
sharedFeature = new FeatSmartTag(in);
break;
default:
- System.err.println("Unknown Shared Feature " + isf_sharedFeatureType + " found!");
+ logger.log( POILogger.ERROR, "Unknown Shared Feature " + isf_sharedFeatureType + " found!");
}
}
*/
public final class HyperlinkRecord extends StandardRecord {
public final static short sid = 0x01B8;
- private POILogger logger = POILogFactory.getLogger(getClass());
+ private static POILogger logger = POILogFactory.getLogger(HyperlinkRecord.class);
static final class GUID {
/*
if (false) { // Quite a few examples in the unit tests which don't have the exact expected tail
for (int i = 0; i < expectedTail.length; i++) {
if (expectedTail[i] != result[i]) {
- System.err.println("Mismatch in tail byte [" + i + "]"
+ logger.log( POILogger.ERROR, "Mismatch in tail byte [" + i + "]"
+ "expected " + (expectedTail[i] & 0xFF) + " but got " + (result[i] & 0xFF));
}
}
import org.apache.poi.hssf.record.common.UnicodeString;
import org.apache.poi.util.IntMapper;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Handles the task of deserializing a SST string. The two main entry points are
*/
class SSTDeserializer
{
-
+ private static POILogger logger = POILogFactory.getLogger(SSTDeserializer.class);
private IntMapper<UnicodeString> strings;
public SSTDeserializer( IntMapper<UnicodeString> strings )
// Extract exactly the count of strings from the SST record.
UnicodeString str;
if(in.available() == 0 && ! in.hasNextRecord()) {
- System.err.println("Ran out of data before creating all the strings! String at index " + i + "");
+ logger.log( POILogger.ERROR, "Ran out of data before creating all the strings! String at index " + i + "");
str = new UnicodeString("");
} else {
str = new UnicodeString(in);
int extraDataLength = runData - (numRuns*6);
if(extraDataLength < 0) {
- System.err.println("Warning - ExtRst overran by " + (0-extraDataLength) + " bytes");
+ _logger.log( POILogger.WARN, "Warning - ExtRst overran by " + (0-extraDataLength) + " bytes");
extraDataLength = 0;
}
extraData = new byte[extraDataLength];
import org.apache.poi.ss.formula.FormulaRenderingWorkbook;
import org.apache.poi.ss.formula.FormulaType;
import org.apache.poi.ss.formula.udf.UDFFinder;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Internal POI use only
* @author Josh Micich
*/
public final class HSSFEvaluationWorkbook implements FormulaRenderingWorkbook, EvaluationWorkbook, FormulaParsingWorkbook {
-
+ private static POILogger logger = POILogFactory.getLogger(HSSFEvaluationWorkbook.class);
private final HSSFWorkbook _uBook;
private final InternalWorkbook _iBook;
// Note - as of Bugzilla 48036 (svn r828244, r828247) POI is capable of evaluating
// IntesectionPtg. However it is still not capable of parsing it.
// So FormulaEvalTestData.xls now contains a few formulas that produce errors here.
- System.err.println(e.getMessage());
+ logger.log( POILogger.ERROR, e.getMessage());
}
}
FormulaRecordAggregate fra = (FormulaRecordAggregate) cell.getCellValueRecord();
import org.apache.poi.hssf.record.ObjRecord;
import org.apache.poi.ss.usermodel.Picture;
import org.apache.poi.ss.util.ImageUtils;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.apache.poi.hssf.model.InternalWorkbook;
/**
* @author Yegor Kozlov (yegor at apache.org)
*/
public class HSSFPicture extends HSSFSimpleShape implements Picture {
+ private static POILogger logger = POILogFactory.getLogger(HSSFPicture.class);
+
public static final int PICTURE_TYPE_EMF = HSSFWorkbook.PICTURE_TYPE_EMF; // Windows Enhanced Metafile
public static final int PICTURE_TYPE_WMF = HSSFWorkbook.PICTURE_TYPE_WMF; // Windows Metafile
public static final int PICTURE_TYPE_PICT = HSSFWorkbook.PICTURE_TYPE_PICT; // Macintosh PICT
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, true, data.getBytes("UTF-16LE"));
setPropertyValue(prop);
} catch (UnsupportedEncodingException e) {
- System.out.println("Unsupported encoding: UTF-16LE");
+ logger.log( POILogger.ERROR, "Unsupported encoding: UTF-16LE");
}
}
import org.apache.poi.ddf.*;
import org.apache.poi.hssf.record.*;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* @author Glen Stampoultzis (glens at superlinksoftware.com)
*/
public class HSSFPolygon extends HSSFSimpleShape {
-
+ private static POILogger logger = POILogFactory.getLogger(HSSFPolygon.class);
public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 0x1E;
public HSSFPolygon(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord _textObjectRecord) {
*/
public void setPoints(int[] xPoints, int[] yPoints) {
if (xPoints.length != yPoints.length){
- System.out.println("xPoint.length must be equal to yPoints.length");
+ logger.log( POILogger.ERROR, "xPoint.length must be equal to yPoints.length");
return;
}
if (xPoints.length == 0){
- System.out.println("HSSFPolygon must have at least one point");
+ logger.log( POILogger.ERROR, "HSSFPolygon must have at least one point");
}
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0] );
verticesProp.setNumberOfElementsInArray(xPoints.length+1);
public static void copyNodeRecursively( Entry entry, DirectoryEntry target )
throws IOException
{
- // System.err.println("copyNodeRecursively called with "+entry.getName()+
+ // logger.log( POILogger.ERROR, "copyNodeRecursively called with "+entry.getName()+
// ","+target.getName());
DirectoryEntry newTarget = null;
if ( entry.isDirectoryEntry() )
package org.apache.poi.ss.formula.constant;
import org.apache.poi.ss.usermodel.ErrorConstants;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Represents a constant error code value as encoded in a constant values array. <p/>
*
* @author Josh Micich
*/
public class ErrorConstant {
+ private static POILogger logger = POILogFactory.getLogger(ErrorConstant.class);
// convenient access to name space
private static final ErrorConstants EC = null;
case ErrorConstants.ERROR_NUM: return NUM;
case ErrorConstants.ERROR_NA: return NA;
}
- System.err.println("Warning - unexpected error code (" + errorCode + ")");
+ logger.log( POILogger.WARN, "Warning - unexpected error code (" + errorCode + ")");
return new ErrorConstant(errorCode);
}
public String toString() {
import java.util.Locale;\r
import java.util.Map;\r
\r
+import org.apache.poi.util.POILogFactory;\r
+import org.apache.poi.util.POILogger;\r
+\r
/**\r
* Convert java DateFormat patterns into Excel custom number formats.\r
* For example, to format a date in excel using the "dd MMMM, yyyy" pattern and Japanese\r
*\r
*/\r
public class DateFormatConverter {\r
+ private static POILogger logger = POILogFactory.getLogger(DateFormatConverter.class);\r
\r
public static class DateFormatTokenizer {\r
String format;\r
result = localePrefixes.get( localeString.substring( 0, 2 ) );\r
if( result == null ) {\r
Locale parentLocale = new Locale(localeString.substring( 0, 2 ));\r
- System.out.println( "Unable to find prefix for " + locale + "(" + locale.getDisplayName() + ") or " \r
+ logger.log( POILogger.ERROR, "Unable to find prefix for " + locale + "(" + locale.getDisplayName() + ") or " \r
+ localeString.substring( 0, 2 ) + "(" + parentLocale.getDisplayName() + ")" );\r
return "";\r
}\r
"/org/apache/poi/hdgf/chunks_parse_cmds.tbl";
/** For logging problems we spot with the file */
- private POILogger logger = POILogFactory.getLogger(ChunkFactory.class);
+ private static POILogger logger = POILogFactory.getLogger(ChunkFactory.class);
public ChunkFactory(int version) throws IOException {
this.version = version;
data, endOfDataPos);
endOfDataPos += 8;
} else {
- System.err.println("Header claims a length to " + endOfDataPos + " there's then no space for the trailer in the data (" + data.length + ")");
+ logger.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()) {
separator = new ChunkSeparator(
data, endOfDataPos);
} else {
- System.err.println("Header claims a length to " + endOfDataPos + " there's then no space for the separator in the data (" + data.length + ")");
+ logger.log(POILogger.ERROR, "Header claims a length to " + endOfDataPos + " there's then no space for the separator in the data (" + data.length + ")");
}
}
import org.apache.poi.hdgf.chunks.ChunkFactory;
import org.apache.poi.hdgf.chunks.ChunkHeader;
import org.apache.poi.hdgf.pointers.Pointer;
+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 ChunkFactory chunkFactory;
/** All the Chunks we contain */
private Chunk[] chunks;
pos += chunk.getOnDiskSize();
} else {
- System.err.println("Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
+ logger.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)
{
- System.err.println("Failed to create chunk at " + pos + ", ignoring rest of data." + e);
+ logger.log(POILogger.ERROR, "Failed to create chunk at " + pos + ", ignoring rest of data." + e);
}
chunks = chunksA.toArray(new Chunk[chunksA.size()]);
import org.apache.poi.hpsf.Util;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* A pure-MAPI attribute holding a Date, which applies
* to a {@link HMEFMessage} or one of its {@link Attachment}s.
*/
public final class MAPIDateAttribute extends MAPIAttribute {
+ private static POILogger logger = POILogFactory.getLogger(MAPIDateAttribute.class);
private Date data;
/**
return ((MAPIDateAttribute)attr).getDate();
}
- System.err.println("Warning, non date property found: " + attr.toString());
+ logger.log(POILogger.WARN, "Warning, non date property found: " + attr.toString());
return null;
}
}
import org.apache.poi.hmef.HMEFMessage;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.hsmf.datatypes.Types;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
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 static final String CODEPAGE = "CP1252";
private final String data;
return ((MAPIRtfAttribute)attr).getDataString();
}
- System.err.println("Warning, non string property found: " + attr.toString());
+ logger.log(POILogger.WARN, "Warning, non string property found: " + attr.toString());
return null;
}
}
import org.apache.poi.hmef.HMEFMessage;
import org.apache.poi.hpsf.Util;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* A Date attribute which applies to a {@link HMEFMessage}
* or one of its {@link Attachment}s.
*/
public final class TNEFDateAttribute extends TNEFAttribute {
+ private static POILogger logger = POILogFactory.getLogger(TNEFDateAttribute.class);
private Date data;
/**
return ((TNEFDateAttribute)attr).getDate();
}
- System.err.println("Warning, non date property found: " + attr.toString());
+ logger.log(POILogger.WARN, "Warning, non date property found: " + attr.toString());
return null;
}
}
import org.apache.poi.hmef.Attachment;
import org.apache.poi.hmef.HMEFMessage;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
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 String data;
/**
return ((TNEFStringAttribute)attr).getString();
}
- System.err.println("Warning, non string property found: " + attr.toString());
+ logger.log(POILogger.WARN, "Warning, non string property found: " + attr.toString());
return null;
}
}
import org.apache.poi.ddf.*;
import org.apache.poi.hslf.record.*;
import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import java.util.ArrayList;
import java.util.Iterator;
*/
public abstract class Sheet {
+ private static POILogger logger = POILogFactory.getLogger(Sheet.class);
+
/**
* The <code>SlideShow</code> we belong to
*/
} else if (records[i + 1].getRecordType() == 4010l) {
// TextSpecInfoAtom - Safe to ignore
} else {
- System.err.println("Found a TextHeaderAtom not followed by a TextBytesAtom or TextCharsAtom: Followed by " + records[i + 1].getRecordType());
+ logger.log(POILogger.ERROR, "Found a TextHeaderAtom not followed by a TextBytesAtom or TextCharsAtom: Followed by " + records[i + 1].getRecordType());
}
if (trun != null) {
import java.io.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.apache.poi.util.StringUtil;
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
public class CurrentUserAtom
{
+ private static POILogger logger = POILogFactory.getLogger(CurrentUserAtom.class);
+
/** Standard Atom header */
public static final byte[] atomHeader = new byte[] { 0, 0, -10, 15 };
/** The PowerPoint magic number for a non-encrypted file */
if(_contents.length >= 4) {
// PPT95 has 4 byte size, then data
int size = LittleEndian.getInt(_contents);
- System.err.println(size);
+ //System.err.println(size);
if(size + 4 == _contents.length) {
throw new OldPowerPointFormatException("Based on the Current User stream, you seem to have supplied a PowerPoint95 file, which isn't supported");
}
long usernameLen = LittleEndian.getUShort(_contents,20);
if(usernameLen > 512) {
// Handle the case of it being garbage
- System.err.println("Warning - invalid username length " + usernameLen + " found, treating as if there was no username set");
+ logger.log(POILogger.WARN, "Warning - invalid username length " + usernameLen + " found, treating as if there was no username set");
usernameLen = 0;
}
public abstract class Record
{
// For logging
- protected POILogger logger = POILogFactory.getLogger(this.getClass());
+ protected static POILogger logger = POILogFactory.getLogger(Record.class);
/**
* Is this record type an Atom record (only has data),
// Handle case of a corrupt last record, whose claimed length
// would take us passed the end of the file
if(start + len > b.length) {
- System.err.println("Warning: Skipping record of type " + type + " at position " + start + " which claims to be longer than the file! (" + len + " vs " + (b.length-start) + ")");
+ 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) + ")");
return null;
}
import java.util.List;
import org.apache.poi.hsmf.MAPIMessage;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Collection of convenence chunks for standard parts of the MSG file attachment.
*/
public class AttachmentChunks implements ChunkGroup {
+ private static POILogger logger = POILogFactory.getLogger(AttachmentChunks.class);
public static final String PREFIX = "__attach_version1.0_#";
public ByteChunk attachData;
} else if(chunk instanceof DirectoryChunk) {
attachmentDirectory = (DirectoryChunk)chunk;
} else {
- System.err.println("Unexpected data chunk of type " + chunk);
+ logger.log(POILogger.ERROR, "Unexpected data chunk of type " + chunk);
}
}
else if(chunk.getChunkId() == ATTACH_DISPOSITION.id) {
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* A Chunk that holds the details given back by the
*/
public class MessageSubmissionChunk extends Chunk {
+ private static POILogger logger = POILogFactory.getLogger(MessageSubmissionChunk.class);
private String rawId;
private Calendar date;
date.set(Calendar.SECOND, Integer.parseInt(m.group(6)));
date.set(Calendar.MILLISECOND, 0);
} else {
- System.err.println("Warning - unable to make sense of date " + dateS);
+ logger.log(POILogger.WARN, "Warning - unable to make sense of date " + dateS);
}
}
}
import java.util.Comparator;
import java.util.List;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
/**
* Collection of convenience chunks for the
* several of these.
*/
public final class RecipientChunks implements ChunkGroup {
+ private static POILogger logger = POILogFactory.getLogger(RecipientChunks.class);
+
public static final String PREFIX = "__recip_version1.0_#";
public static final MAPIProperty RECIPIENT_NAME = MAPIProperty.DISPLAY_NAME;
try {
recipientNumber = Integer.parseInt(number, 16);
} catch(NumberFormatException e) {
- System.err.println("Invalid recipient number in name " + name);
+ logger.log(POILogger.ERROR, "Invalid recipient number in name " + name);
}
}
}
import org.apache.poi.poifs.filesystem.DocumentNode;
import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
/**
* Processes a POIFS of a .msg file into groups of Chunks, such as
* data and so on.
*/
public final class POIFSChunkParser {
+ private static POILogger logger = POILogFactory.getLogger(POIFSChunkParser.class);
+
public static ChunkGroup[] parse(POIFSFileSystem fs) throws IOException {
return parse(fs.getRoot());
}
chunk.readValue(inp);
grouping.record(chunk);
} catch(IOException e) {
- System.err.println("Error reading from part " + entry.getName() + " - " + e.toString());
+ logger.log(POILogger.ERROR, "Error reading from part " + entry.getName() + " - " + e.toString());
}
} else {
grouping.record(chunk);
{
if ( format != 0 )
- System.err.println( "NYI: toListItemNumberLabel(): " + format );
+ logger.log( POILogger.INFO, "NYI: toListItemNumberLabel(): " + format );
return String.valueOf( number );
}