Skip to content

Commit 9cd4103

Browse files
committed
work around poi-scratchpad issue
1 parent 90560c3 commit 9cd4103

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

poi-integration/src/test/java/org/apache/poi/stress/StressMap.java

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
3333
import org.apache.commons.csv.CSVFormat;
3434
import org.apache.commons.csv.CSVRecord;
3535
import org.apache.commons.io.input.BOMInputStream;
36+
import org.opentest4j.AssertionFailedError;
3637

3738
public class StressMap {
3839
private final MultiValuedMap<String, ExcInfo> exMap = new ArrayListValuedHashMap<>();
@@ -113,32 +114,37 @@ public void readExMap() throws IOException {
113114
records.forEach(record -> {
114115
final String file = record.get("File");
115116
if (file != null && !file.isBlank()) {
116-
ExcInfo info = new ExcInfo();
117-
info.setFile(file);
118-
String tests = record.get("Tests");
119-
if (tests != null && !tests.isBlank()) {
120-
info.setTests(tests);
121-
}
122-
String handler = record.get("Handler");
123-
if (handler != null && !handler.isBlank()) {
124-
info.setHandler(handler);
125-
}
126-
String password = record.get("Password");
127-
if (password != null && !password.isBlank()) {
128-
info.setPassword(password);
129-
}
130-
String exClass = record.get("Exception Class");
131-
if (exClass != null && !exClass.isBlank()) {
132-
info.setExClazz(exClass);
133-
}
134-
String exMessage = record.get("Exception Message");
135-
if (exMessage != null && !exMessage.isBlank()) {
136-
info.setExMessage(exMessage);
137-
}
138-
final boolean ignore =
139-
SCRATCH_IGNORE && SCRATCH_HANDLER.matcher(info.getHandler()).find();
140-
if (!ignore) {
141-
exMap.put(file, info);
117+
try {
118+
ExcInfo info = new ExcInfo();
119+
info.setFile(file);
120+
String tests = record.get("Tests");
121+
if (tests != null && !tests.isBlank()) {
122+
info.setTests(tests);
123+
}
124+
String handler = record.get("Handler");
125+
if (handler != null && !handler.isBlank()) {
126+
info.setHandler(handler);
127+
}
128+
String password = record.get("Password");
129+
if (password != null && !password.isBlank()) {
130+
info.setPassword(password);
131+
}
132+
String exClass = record.get("Exception Class");
133+
if (exClass != null && !exClass.isBlank()) {
134+
info.setExClazz(exClass);
135+
}
136+
String exMessage = record.get("Exception Message");
137+
if (exMessage != null && !exMessage.isBlank()) {
138+
info.setExMessage(exMessage);
139+
}
140+
final boolean ignore =
141+
SCRATCH_IGNORE && SCRATCH_HANDLER.matcher(info.getHandler()).find();
142+
if (!ignore) {
143+
exMap.put(file, info);
144+
}
145+
} catch (AssertionFailedError assertionFailedError) {
146+
// can happen when testing with poi-scratchpad
147+
// see ExcInfo#setExClazz
142148
}
143149
}
144150
});

0 commit comments

Comments
 (0)