Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,32 @@
public class ValidateStandardTest {

private static Map<String, Standard> getSpecsInArchive()
throws IOException, NoSuchAlgorithmException {
Map<String, Standard> 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<String, Standard> 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;
Comment on lines +53 to +77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation issues, please address.


return schemas;
}

private static String calcHash(InputStream is) throws IOException, NoSuchAlgorithmException {
Expand Down
Loading