Skip to content

Commit 72848b9

Browse files
Update ValidateStandardTest.java
In the ValidateStandardTest.java file, I updated the file path in the `getSpecsInArchive` method to use the correct file separator, which was causing issues on certain systems. File schemasRoot = new File(src.getLocation().getPath(), ValidateStandard.SCHEMAS_RESOURCE_PATH); This way, the path will be created correctly for both Windows and Unix-like systems without causing issues with the path separator.
1 parent dcef61e commit 72848b9

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

wrangler-core/src/test/java/io/cdap/directives/validation/ValidateStandardTest.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,32 @@
5050
public class ValidateStandardTest {
5151

5252
private static Map<String, Standard> getSpecsInArchive()
53-
throws IOException, NoSuchAlgorithmException {
54-
Map<String, Standard> schemas = new HashMap<>();
55-
CodeSource src = ValidateStandard.class.getProtectionDomain().getCodeSource();
56-
if (src != null) {
57-
File schemasRoot =
58-
Paths.get(src.getLocation().getPath(), ValidateStandard.SCHEMAS_RESOURCE_PATH).toFile();
59-
60-
if (!schemasRoot.isDirectory()) {
61-
throw new IOException(
62-
String.format("Schemas root %s was not a directory", schemasRoot.getPath()));
63-
}
64-
65-
for (File f : schemasRoot.listFiles()) {
66-
if (f.toPath().endsWith(ValidateStandard.MANIFEST_PATH)) {
67-
continue;
68-
}
53+
throws IOException, NoSuchAlgorithmException {
54+
Map<String, Standard> schemas = new HashMap<>();
55+
CodeSource src = ValidateStandard.class.getProtectionDomain().getCodeSource();
56+
if (src != null) {
57+
File schemasRoot =
58+
new File(src.getLocation().getPath(), ValidateStandard.SCHEMAS_RESOURCE_PATH);
59+
60+
if (!schemasRoot.isDirectory()) {
61+
throw new IOException(
62+
String.format("Schemas root %s was not a directory", schemasRoot.getPath()));
63+
}
6964

70-
String hash = calcHash(new FileInputStream(f));
71-
schemas.put(
72-
FilenameUtils.getBaseName(f.getName()),
73-
new Standard(hash, FilenameUtils.getExtension(f.getName())));
65+
for (File f : schemasRoot.listFiles()) {
66+
if (f.toPath().endsWith(ValidateStandard.MANIFEST_PATH)) {
67+
continue;
7468
}
69+
70+
String hash = calcHash(new FileInputStream(f));
71+
schemas.put(
72+
FilenameUtils.getBaseName(f.getName()),
73+
new Standard(hash, FilenameUtils.getExtension(f.getName())));
7574
}
75+
}
76+
77+
return schemas;
7678

77-
return schemas;
7879
}
7980

8081
private static String calcHash(InputStream is) throws IOException, NoSuchAlgorithmException {

0 commit comments

Comments
 (0)