Skip to content

Commit

Permalink
Merge branch 'main' into issue_895
Browse files Browse the repository at this point in the history
  • Loading branch information
al-niessner authored Nov 12, 2024
2 parents 8f82c7a + 0e5cf85 commit be4d470
Show file tree
Hide file tree
Showing 18 changed files with 17,026 additions and 18,921 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# Changelog

## [«unknown»](https://github.com/NASA-PDS/validate/tree/«unknown») (2024-10-31)
## [release/3.6.1](https://github.com/NASA-PDS/validate/tree/release/3.6.1) (2024-11-08)

[Full Changelog](https://github.com/NASA-PDS/validate/compare/v3.5.2...«unknown»)
[Full Changelog](https://github.com/NASA-PDS/validate/compare/v3.6.0...release/3.6.1)

**Defects:**

- `validate.bat` no executes correctly on windows [\#1054](https://github.com/NASA-PDS/validate/issues/1054) [[s.critical](https://github.com/NASA-PDS/validate/labels/s.critical)]
- validate incorrectly disallows Encoded\_Native/encoding\_standard\_id = 'SEED 2.4' [\#1028](https://github.com/NASA-PDS/validate/issues/1028) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]

## [v3.6.0](https://github.com/NASA-PDS/validate/tree/v3.6.0) (2024-11-05)

[Full Changelog](https://github.com/NASA-PDS/validate/compare/v3.5.2...v3.6.0)

**Requirements:**

Expand Down
310 changes: 310 additions & 0 deletions docs/requirements/v3.5.2/REQUIREMENTS.md

Large diffs are not rendered by default.

314 changes: 314 additions & 0 deletions docs/requirements/v3.6.0/REQUIREMENTS.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>gov.nasa.pds</groupId>
<artifactId>validate</artifactId>
<version>3.6.0-SNAPSHOT</version>
<version>3.7.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down Expand Up @@ -70,7 +70,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.2</version>

<configuration>
<argLine>-Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR</argLine>
Expand Down Expand Up @@ -305,13 +305,13 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.11.2</version>
<version>5.11.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>gov.nasa.pds</groupId>
<artifactId>pds4-jparser</artifactId>
<version>2.10.0-SNAPSHOT</version>
<version>2.10.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -337,7 +337,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.0</version>
<version>2.18.1</version>
</dependency>
<!-- three (4) artifacts for complete configuration parsing and RI calls -->
<dependency>
Expand All @@ -364,7 +364,7 @@
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3.1</version>
<version>5.4.1</version>
</dependency>
<dependency>
<groupId>org.mp4parser</groupId>
Expand Down
28 changes: 11 additions & 17 deletions src/main/java/gov/nasa/pds/tools/label/LabelValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public LabelValidator() throws ParserConfigurationException, TransformerConfigur
cachedParser = null;
cachedValidatorHandler = null;
cachedSchematron = new ArrayList<>();
userSchemaFiles = null;
userSchematronFiles = null;
userSchemaFiles = new ArrayList<>();
userSchematronFiles = new ArrayList<>();
userSchematronTransformers = new ArrayList<>();
resolver = null;
externalValidators = new ArrayList<>();
Expand Down Expand Up @@ -200,7 +200,7 @@ public LabelValidator() throws ParserConfigurationException, TransformerConfigur
*
*/
public void setSchema(List<URL> schemaFiles) {
this.userSchemaFiles = schemaFiles;
this.userSchemaFiles.addAll(schemaFiles);
LOG.debug("setSchema:schemaFiles.size(),schemaFiles {},{}", schemaFiles.size(), schemaFiles);
}

Expand All @@ -213,7 +213,11 @@ public void setSchematrons(List<String> schematrons) {
userSchematronTransformers = schematrons;
LOG.debug("setSchematrons:schematrons.size(),schematrons {}", schematrons.size());
}

public void clear() {
this.userSchemaFiles.clear();
this.userSchematronFiles.clear();
this.userSchematronTransformers.clear();
}
/**
* Pass in a hash map of schematron URLs to its transformed schematron object. This is used when
* validating a label against it's referenced schematron.
Expand All @@ -230,7 +234,7 @@ public void setLabelSchematrons(Map<String, String> schematronMap) {
* @param schematronFiles A list of schematron URLs.
*/
public void setSchematronFiles(List<URL> schematronFiles) {
userSchematronFiles = schematronFiles;
userSchematronFiles.addAll(schematronFiles);
LOG.debug("setSchematronFiles:schematronFiles.size(),schematronFiles {},{}",
schematronFiles.size(), schematronFiles);
}
Expand Down Expand Up @@ -565,7 +569,7 @@ public synchronized Document parseAndValidate(ProblemHandler handler, URL url)
cachedSchematron = userSchematronTransformers;
LOG.debug("parseAndValidate:0003:url,useLabelSchematron,cachedSchematron.size() {},{},{}",
url, useLabelSchematron, cachedSchematron.size());
} else if (userSchematronFiles != null) {
} else if (!userSchematronFiles.isEmpty()) {
List<String> transformers = new ArrayList<>();
for (URL schematron : userSchematronFiles) {
transformers.add(schematronTransformer.fetch(schematron, handler));
Expand Down Expand Up @@ -699,7 +703,7 @@ private void createParserIfNeeded(ProblemHandler handler) throws SAXNotRecognize
}
LOG.debug("createParserIfNeeded:#00BB6");
// Time to load schema that will be used for validation
if (userSchemaFiles != null) {
if (!userSchemaFiles.isEmpty()) {
LOG.debug("createParserIfNeeded:#00BB7");
// User has specified schema files to use
validatingSchema = schemaFactory
Expand Down Expand Up @@ -1029,16 +1033,6 @@ public void setCachedLSResourceResolver(CachedLSResourceResolver resolver) {
this.cachedLSResolver = resolver;
}

public static void main(String[] args) throws Exception {
LabelValidator lv = new LabelValidator();
lv.setCatalogs(new String[] {args[1]});
ProblemContainer container = new ProblemContainer();
lv.validate(container, new File(args[0]));
for (ValidationProblem problem : container.getProblems()) {
System.out.println(problem.getMessage());
}
}

/**
* Implements a source locator for use when walking a DOM tree during XML Schema validation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum EncodingMimeMapping {
PDF(Arrays.asList("pdf")),
PDFA(Arrays.asList("pdf", "pdfa")),
PNG(Arrays.asList("png")),
SEED(Arrays.asList("mseed","seed")),
TIFF(Arrays.asList("tif", "tiff")),
WAV(Arrays.asList("wav"));
final private List<String> extensions;
Expand All @@ -35,6 +36,7 @@ public static EncodingMimeMapping find (String encoding) throws IllegalArgumentE
if (encoding.equalsIgnoreCase("PDFA")) return PDFA;
if (encoding.equalsIgnoreCase("PDF/A")) return PDFA;
if (encoding.equalsIgnoreCase("PNG")) return PNG;
if (encoding.startsWith("SEED 2.")) return SEED;
if (encoding.equalsIgnoreCase("TIFF")) return TIFF;
if (encoding.equalsIgnoreCase("WAV")) return WAV;
throw new IllegalArgumentException("encoding parameter '" + encoding + "' is not known to this version of validate.");
Expand Down
Loading

0 comments on commit be4d470

Please sign in to comment.