From 72848b9792de0303438fcbe4922f1320ffee6ba6 Mon Sep 17 00:00:00 2001 From: RudreeshJoshi <168192024+RudreeshJoshi@users.noreply.github.com> Date: Sat, 10 May 2025 15:21:04 +0530 Subject: [PATCH] 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. --- .../validation/ValidateStandardTest.java | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/wrangler-core/src/test/java/io/cdap/directives/validation/ValidateStandardTest.java b/wrangler-core/src/test/java/io/cdap/directives/validation/ValidateStandardTest.java index fac05025e6..d153d3f53e 100644 --- a/wrangler-core/src/test/java/io/cdap/directives/validation/ValidateStandardTest.java +++ b/wrangler-core/src/test/java/io/cdap/directives/validation/ValidateStandardTest.java @@ -50,31 +50,32 @@ public class ValidateStandardTest { private static Map getSpecsInArchive() - throws IOException, NoSuchAlgorithmException { - Map schemas = new HashMap<>(); - CodeSource src = ValidateStandard.class.getProtectionDomain().getCodeSource(); - if (src != null) { - File schemasRoot = - Paths.get(src.getLocation().getPath(), ValidateStandard.SCHEMAS_RESOURCE_PATH).toFile(); - - if (!schemasRoot.isDirectory()) { - throw new IOException( - String.format("Schemas root %s was not a directory", schemasRoot.getPath())); - } - - for (File f : schemasRoot.listFiles()) { - if (f.toPath().endsWith(ValidateStandard.MANIFEST_PATH)) { - continue; - } + throws IOException, NoSuchAlgorithmException { + Map schemas = new HashMap<>(); + CodeSource src = ValidateStandard.class.getProtectionDomain().getCodeSource(); + if (src != null) { + File schemasRoot = + new File(src.getLocation().getPath(), ValidateStandard.SCHEMAS_RESOURCE_PATH); + + if (!schemasRoot.isDirectory()) { + throw new IOException( + String.format("Schemas root %s was not a directory", schemasRoot.getPath())); + } - String hash = calcHash(new FileInputStream(f)); - schemas.put( - FilenameUtils.getBaseName(f.getName()), - new Standard(hash, FilenameUtils.getExtension(f.getName()))); + for (File f : schemasRoot.listFiles()) { + if (f.toPath().endsWith(ValidateStandard.MANIFEST_PATH)) { + continue; } + + String hash = calcHash(new FileInputStream(f)); + schemas.put( + FilenameUtils.getBaseName(f.getName()), + new Standard(hash, FilenameUtils.getExtension(f.getName()))); } + } + + return schemas; - return schemas; } private static String calcHash(InputStream is) throws IOException, NoSuchAlgorithmException {