keeps / commons-ip

Commons IP is project that provide a command-line tool and Java Library to validate and manipulate E-ARK Information Packages, so to create or process E-ARK SIP and AIP and also validate them against official specifications.
http://keeps.github.io/commons-ip/
GNU Lesser General Public License v3.0
11 stars 14 forks source link

Validation of representation without descriptive metadata files generates NullPointerException #204

Closed ThomasEdvardsen closed 11 months ago

ThomasEdvardsen commented 1 year ago

Using cli-2.4.0 i get a NullPointerException when trying to validate a representation without descriptive metadata files and no dmdSec in representation METS.

java -jar commons-ip2-cli-2.4.0.jar validate -i aips/e-ark/no-nb_eksternlyd_AV1000037403_01_full   
Exception in thread "main" java.lang.NullPointerException: Cannot read the array length because "<local4>" is null
    at org.roda_project.commons_ip2.validator.common.FolderManager.countMetadataFiles(FolderManager.java:111)
    at org.roda_project.commons_ip2.validator.component.descriptiveMetadataComponent.DescriptiveMetadataComponentValidator.validateCSIP17(DescriptiveMetadataComponentValidator.java:300)
    at org.roda_project.commons_ip2.validator.component.descriptiveMetadataComponent.DescriptiveMetadataComponentValidator.validate(DescriptiveMetadataComponentValidator.java:86)
    at org.roda_project.commons_ip2.validator.EARKSIPValidator.validateComponents(EARKSIPValidator.java:183)
    at org.roda_project.commons_ip2.validator.EARKSIPValidator.validateSubMets(EARKSIPValidator.java:208)
    at org.roda_project.commons_ip2.validator.EARKSIPValidator.validate(EARKSIPValidator.java:157)
    at org.roda_project.commons_ip2.validator.CLI.CLIValidator.validate(CLIValidator.java:213)
    at org.roda_project.commons_ip2.validator.CLI.CLIValidator.start(CLIValidator.java:157)
    at org.roda_project.commons_ip2.validator.CLI.Main.main(Main.java:30)

The if (folder != null) check has to be done also for paths containing "descriptive".

hmiguim commented 11 months ago

done at bf1410624159457d2025b948d9bd1c1b3f3f4d81