- don't use foreign class in Logger initialization - update log statements to use MessageFormat syntax git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915930 13f79535-47bb-0310-9956-ffa450edef68pull/599/head
if (maxEntrySize < 0) { | if (maxEntrySize < 0) { | ||||
throw new IllegalArgumentException("Max entry size must be greater than or equal to zero"); | throw new IllegalArgumentException("Max entry size must be greater than or equal to zero"); | ||||
} else if (maxEntrySize > DEFAULT_MAX_ENTRY_SIZE) { | } else if (maxEntrySize > DEFAULT_MAX_ENTRY_SIZE) { | ||||
LOG.atWarn().log("setting max entry size greater than 4Gb can be risky; set to " + maxEntrySize + " bytes"); | |||||
LOG.warn("setting max entry size greater than 4Gb can be risky; set to {} bytes", maxEntrySize); | |||||
} | } | ||||
MAX_ENTRY_SIZE = maxEntrySize; | MAX_ENTRY_SIZE = maxEntrySize; | ||||
} | } | ||||
if (maxTextSize < 0) { | if (maxTextSize < 0) { | ||||
throw new IllegalArgumentException("Max text size must be greater than or equal to zero"); | throw new IllegalArgumentException("Max text size must be greater than or equal to zero"); | ||||
}else if (maxTextSize > DEFAULT_MAX_TEXT_SIZE) { | }else if (maxTextSize > DEFAULT_MAX_TEXT_SIZE) { | ||||
LOG.atWarn().log("setting max text size greater than " + DEFAULT_MAX_TEXT_SIZE + " can be risky; set to " + maxTextSize + " chars"); | |||||
LOG.warn("setting max text size greater than {} can be risky; set to {} chars", DEFAULT_MAX_TEXT_SIZE, maxTextSize); | |||||
} | } | ||||
MAX_TEXT_SIZE = maxTextSize; | MAX_TEXT_SIZE = maxTextSize; | ||||
} | } |
if (categoryData != null && values != null) { | if (categoryData != null && values != null) { | ||||
int numOfPoints = category.getPointCount(); | int numOfPoints = category.getPointCount(); | ||||
if (numOfPoints != values.getPointCount()) { | if (numOfPoints != values.getPointCount()) { | ||||
LOGGER.warn("Category and values must have the same point count, but had " + | |||||
numOfPoints + " categories and " + values.getPointCount() + " values."); | |||||
LOGGER.warn("Category and values must have the same point count, but had {}" + | |||||
" categories and {} values.", numOfPoints, values.getPointCount()); | |||||
} | } | ||||
} | } | ||||
this.categoryData = category; | this.categoryData = category; |
private static final String SHEET_WITH_COMMENTS = | private static final String SHEET_WITH_COMMENTS = | ||||
"/xl/worksheets/sheet1.xml"; | "/xl/worksheets/sheet1.xml"; | ||||
private static final Logger LOG = LogManager.getLogger(TestPackageCoreProperties.class); | |||||
private static final Logger LOG = LogManager.getLogger(TestRelationships.class); | |||||
/** | /** | ||||
* Test relationships are correctly loaded. This at the moment fails (as of r499) | * Test relationships are correctly loaded. This at the moment fails (as of r499) |
unused = LittleEndian.getShort(data, offset+14); | unused = LittleEndian.getShort(data, offset+14); | ||||
if (bytesRemaining + 8 != 16) { | if (bytesRemaining + 8 != 16) { | ||||
LOG.warn("Invalid header-data received, should have 8 bytes left, but had: " + bytesRemaining); | |||||
LOG.warn("Invalid header-data received, should have 8 bytes left, but had: {}", bytesRemaining); | |||||
} | } | ||||
return bytesRemaining + 8; | return bytesRemaining + 8; |
ofs += _header.length; | ofs += _header.length; | ||||
if (LittleEndian.getShort(_header, 0) != 0) { | if (LittleEndian.getShort(_header, 0) != 0) { | ||||
LOG.atDebug().log("Invalid data for SSSlideInfoAtom at offset 0: " + LittleEndian.getShort(_header, 0)); | |||||
LOG.debug("Invalid data for SSSlideInfoAtom at offset 0: {}", LittleEndian.getShort(_header, 0)); | |||||
} | } | ||||
if (LittleEndian.getShort(_header, 2) != RecordTypes.SSSlideInfoAtom.typeID) { | if (LittleEndian.getShort(_header, 2) != RecordTypes.SSSlideInfoAtom.typeID) { | ||||
LOG.atDebug().log("Invalid data for SSSlideInfoAtom at offset 2: "+ LittleEndian.getShort(_header, 2)); | |||||
LOG.debug("Invalid data for SSSlideInfoAtom at offset 2: {}", LittleEndian.getShort(_header, 2)); | |||||
} | } | ||||
if (LittleEndian.getShort(_header, 4) != 0x10) { | if (LittleEndian.getShort(_header, 4) != 0x10) { | ||||
LOG.atDebug().log("Invalid data for SSSlideInfoAtom at offset 4: "+ LittleEndian.getShort(_header, 4)); | |||||
LOG.debug("Invalid data for SSSlideInfoAtom at offset 4: {}", LittleEndian.getShort(_header, 4)); | |||||
} | } | ||||
if (LittleEndian.getShort(_header, 6) == 0) { | if (LittleEndian.getShort(_header, 6) == 0) { | ||||
LOG.atDebug().log("Invalid data for SSSlideInfoAtom at offset 6: "+ LittleEndian.getShort(_header, 6)); | |||||
LOG.debug("Invalid data for SSSlideInfoAtom at offset 6: {}", LittleEndian.getShort(_header, 6)); | |||||
} | } | ||||
_slideTime = LittleEndian.getInt(source, ofs); | _slideTime = LittleEndian.getInt(source, ofs); | ||||
if (_slideTime < 0 || _slideTime > 86399000) { | if (_slideTime < 0 || _slideTime > 86399000) { | ||||
LOG.atDebug().log("Invalid data for SSSlideInfoAtom - invalid slideTime: "+ _slideTime); | |||||
LOG.debug("Invalid data for SSSlideInfoAtom - invalid slideTime: {}", _slideTime); | |||||
} | } | ||||
ofs += LittleEndianConsts.INT_SIZE; | ofs += LittleEndianConsts.INT_SIZE; | ||||
_soundIdRef = LittleEndian.getInt(source, ofs); | _soundIdRef = LittleEndian.getInt(source, ofs); |
int pos = offset; | int pos = offset; | ||||
pos += drawingGroupData.fillFields(data, pos, recordFactory); | pos += drawingGroupData.fillFields(data, pos, recordFactory); | ||||
if (drawingGroupData.getRecordId() == EscherRecordTypes.DGG_CONTAINER.typeID) { | if (drawingGroupData.getRecordId() == EscherRecordTypes.DGG_CONTAINER.typeID) { | ||||
LOG.atDebug().log("Invalid record-id for filling Escher records: " + drawingGroupData.getRecordId()); | |||||
LOG.debug("Invalid record-id for filling Escher records: {}", drawingGroupData.getRecordId()); | |||||
} | } | ||||
/* | /* |
@Deprecated | @Deprecated | ||||
private void createPap(int istd, int nesting) { | private void createPap(int istd, int nesting) { | ||||
if (nesting > MAX_PAPX_NESTING) { | if (nesting > MAX_PAPX_NESTING) { | ||||
LOG.warn("Encountered too deep nesting, cannot fully process stylesheet at " + istd + | |||||
" with more than " + MAX_PAPX_NESTING + " nested ParagraphProperties." + | |||||
" Some data could not be parsed."); | |||||
LOG.warn("Encountered too deep nesting, cannot fully process stylesheet at {}" + | |||||
" with more than {} nested ParagraphProperties." + | |||||
" Some data could not be parsed.", istd, MAX_PAPX_NESTING); | |||||
return; | return; | ||||
} | } | ||||
@Deprecated | @Deprecated | ||||
private void createChp(int istd, int nesting) { | private void createChp(int istd, int nesting) { | ||||
if (nesting > MAX_CHPX_NESTING) { | if (nesting > MAX_CHPX_NESTING) { | ||||
LOG.warn("Encountered too deep nesting, cannot fully process stylesheet at " + istd + | |||||
" with more than " + MAX_CHPX_NESTING + " nested CharacterProperties." + | |||||
" Some data could not be parsed."); | |||||
LOG.warn("Encountered too deep nesting, cannot fully process stylesheet at {}" + | |||||
" with more than {} nested CharacterProperties." + | |||||
" Some data could not be parsed.", istd, MAX_CHPX_NESTING); | |||||
return; | return; | ||||
} | } | ||||
import org.junit.jupiter.params.provider.MethodSource; | import org.junit.jupiter.params.provider.MethodSource; | ||||
public class TestWordToTextConverter { | public class TestWordToTextConverter { | ||||
private static final Logger LOG = LogManager.getLogger(WordToTextConverter.class); | |||||
private static final Logger LOG = LogManager.getLogger(TestWordToTextConverter.class); | |||||
private static final List<String> failingFiles = Arrays.asList( | private static final List<String> failingFiles = Arrays.asList( | ||||
// Excel file | // Excel file | ||||
@ParameterizedTest | @ParameterizedTest | ||||
@MethodSource("files") | @MethodSource("files") | ||||
void testAllFiles(File file) throws Exception { | void testAllFiles(File file) throws Exception { | ||||
LOG.info("Testing " + file); | |||||
LOG.info("Testing {}", file); | |||||
try (FileInputStream stream = new FileInputStream(file)) { | try (FileInputStream stream = new FileInputStream(file)) { | ||||
InputStream is = FileMagic.prepareToCheckMagic(stream); | InputStream is = FileMagic.prepareToCheckMagic(stream); | ||||
FileMagic fm = FileMagic.valueOf(is); | FileMagic fm = FileMagic.valueOf(is); | ||||
if (fm != FileMagic.OLE2) { | if (fm != FileMagic.OLE2) { | ||||
LOG.info("Skip non-doc file " + file); | |||||
LOG.info("Skip non-doc file {}", file); | |||||
return; | return; | ||||
} | } |
parts.add(new CellFormatPart(locale, valueDesc)); | parts.add(new CellFormatPart(locale, valueDesc)); | ||||
} catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
LOG.log(Level.WARN, "Invalid format: " + CellFormatter.quote(m.group()), e); | |||||
LOG.warn("Invalid format: {}", CellFormatter.quote(m.group()), e); | |||||
parts.add(null); | parts.add(null); | ||||
} | } | ||||
} | } |
return null; | return null; | ||||
Color c = NAMED_COLORS.get(cdesc); | Color c = NAMED_COLORS.get(cdesc); | ||||
if (c == null) { | if (c == null) { | ||||
LOG.warn("Unknown color: " + quote(cdesc)); | |||||
LOG.warn("Unknown color: {}", quote(cdesc)); | |||||
} | } | ||||
return c; | return c; | ||||
} | } |