diff options
author | Dominik Stadler <centic@apache.org> | 2022-03-24 04:42:22 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2022-03-24 04:42:22 +0000 |
commit | a59e17590a8077bea775e24776930bd412ef946c (patch) | |
tree | 90e75d4527f15c500acd1f4f4e8fa260cdac7364 /poi-ooxml-lite-agent/src/main/java/org | |
parent | 902d1487f7beba14d3335b55c35a1b04872582cc (diff) | |
download | poi-a59e17590a8077bea775e24776930bd412ef946c.tar.gz poi-a59e17590a8077bea775e24776930bd412ef946c.zip |
OOXMLLiteAgent: Some smaller adjustments
Print unexpected exceptions to stdout instead of silently ignoring them
Don't include classes created via Mockito
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899159 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml-lite-agent/src/main/java/org')
-rw-r--r-- | poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java b/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java index 87f488b814..a1658b17fb 100644 --- a/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java +++ b/poi-ooxml-lite-agent/src/main/java/org/apache/poi/ooxml/lite/OOXMLLiteAgent.java @@ -49,10 +49,10 @@ public class OOXMLLiteAgent { String[] args = (agentArgs == null ? "" : agentArgs).split("\\|", 2); String logBase = args.length >= 1 ? args[0] : "ooxml-lite-report"; - XsbLogger.load(logBase+".xsb"); + XsbLogger.load(logBase + ".xsb"); ClazzLogger log = new ClazzLogger(); - log.load(logBase+".clazz"); + log.load(logBase + ".clazz"); log.setPattern(args.length >= 2 ? args[1] : ".*/schemas/.*"); inst.addTransformer(log); @@ -126,14 +126,16 @@ public class OOXMLLiteAgent { } } - static void write(Path path, String item, Set<Integer> hashes) { - if (!hashes.contains(item.hashCode())) { + if (!hashes.contains(item.hashCode()) && + // exclude classes created via Mockito mocking + !item.contains("$MockitoMock$")) { try { // TODO: check if this is atomic ... as transform() is probably called synchronized, it doesn't matter anyway Files.write(path, (item+"\n").getBytes(StandardCharsets.ISO_8859_1), StandardOpenOption.CREATE, StandardOpenOption.APPEND); hashes.add(item.hashCode()); - } catch (IOException ignored) { + } catch (IOException ex) { + System.out.println("Had unexpected exception: " + ex); } } } |