Skip to content

Commit 1674f95

Browse files
authored
fix: do not fail on a bad file name in stack trace (#1120)
1 parent 3cc198e commit 1674f95

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

playwright/src/main/java/com/microsoft/playwright/impl/StackTraceCollector.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ private String sourceFile(StackTraceElement frame) {
6969
if (file == null) {
7070
return "";
7171
}
72-
return resolveSourcePath(Paths.get(pkg).resolve(file));
72+
try {
73+
// The file name can contain an arbitrary string which may cause Path implementation
74+
// to throw. See https://github.com/microsoft/playwright-java/issues/1115
75+
return resolveSourcePath(Paths.get(pkg).resolve(file));
76+
} catch (RuntimeException e) {
77+
return "";
78+
}
7379
}
7480

7581
private String resolveSourcePath(Path relativePath) {

0 commit comments

Comments
 (0)