mirror of
https://github.com/apache/poi.git
synced 2026-02-27 12:30:08 +08:00
Use log instead of assert when parsing emf-files
Assert effectively hides problem in provided input files.
This commit is contained in:
parent
da3d64d9e3
commit
ab196a7441
@ -24,6 +24,8 @@ import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.poi.common.usermodel.GenericRecord;
|
||||
import org.apache.poi.hemf.draw.HemfGraphics;
|
||||
import org.apache.poi.hemf.draw.HemfGraphics.EmfRenderState;
|
||||
@ -38,6 +40,8 @@ import org.apache.poi.util.LittleEndianInputStream;
|
||||
|
||||
@Internal
|
||||
public class HemfPlusHeader implements HemfPlusRecord {
|
||||
private static final Logger log = LogManager.getLogger(HemfPlusHeader.class);
|
||||
|
||||
/**
|
||||
* The GraphicsVersion enumeration defines versions of operating system graphics that are used to
|
||||
* create EMF+ metafiles.
|
||||
@ -89,7 +93,12 @@ public class HemfPlusHeader implements HemfPlusRecord {
|
||||
this.flags = flags;
|
||||
version.init(leis);
|
||||
|
||||
assert(version.getMetafileSignature() == 0xDBC01 && version.getGraphicsVersion() != null);
|
||||
if (version.getMetafileSignature() != 0xDBC01) {
|
||||
log.atWarn().log("Had invalid meta-file signature, expected " + 0xDBC01 + ", had: " + version.getMetafileSignature());
|
||||
}
|
||||
if (version.getGraphicsVersion() == null) {
|
||||
log.atWarn().log("Encountered empty graphics version in emf file");
|
||||
}
|
||||
|
||||
emfPlusFlags = leis.readUInt();
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user