Skip to content

Commit 05f00f6

Browse files
committed
Fix ZIP file path resolution for IntelliJ execution
- Added findZipFile() method to try multiple possible ZIP file locations - Works when run from different working directories (maven, IntelliJ, etc.) - JsonCompatibilitySummary tool now works correctly in all environments
1 parent a3a5c63 commit 05f00f6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

json-compatibility-suite/src/main/java/jdk/sandbox/compatibility/JsonCompatibilitySummary.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@
2626
public class JsonCompatibilitySummary {
2727

2828
private static final Logger LOGGER = Logger.getLogger(JsonCompatibilitySummary.class.getName());
29-
private static final Path ZIP_FILE = Paths.get("src/test/resources/json-test-suite-data.zip");
29+
private static final Path ZIP_FILE = findZipFile();
3030
private static final Path TARGET_TEST_DIR = Paths.get("target/test-data/json-test-suite/test_parsing");
3131

32+
private static Path findZipFile() {
33+
// Try different possible locations for the ZIP file
34+
Path[] candidates = {
35+
Paths.get("src/test/resources/json-test-suite-data.zip"),
36+
Paths.get("json-compatibility-suite/src/test/resources/json-test-suite-data.zip"),
37+
Paths.get("../json-compatibility-suite/src/test/resources/json-test-suite-data.zip")
38+
};
39+
40+
for (Path candidate : candidates) {
41+
if (Files.exists(candidate)) {
42+
return candidate;
43+
}
44+
}
45+
46+
// If none found, return the first candidate and let it fail with a clear message
47+
return candidates[0];
48+
}
49+
3250
public static void main(String[] args) throws Exception {
3351
boolean jsonOutput = args.length > 0 && "--json".equals(args[0]);
3452
JsonCompatibilitySummary summary = new JsonCompatibilitySummary();

0 commit comments

Comments
 (0)