Skip to content
Merged
Show file tree
Hide file tree
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 @@ -420,7 +420,7 @@ public static void reportContextReferencesUnreferenced() {
LOG.debug("reportContextReferencesUnreferenced:VALIDATING_REFERENCE_EXISTENCE_FALSE:referenceType,singleLidOrLidvidReference,hashKey {},{},{}",ReferentialIntegrityUtil.getReferenceType(),singleLidOrLidvidReference,hashKey);
LOG.debug("reportContextReferencesUnreferenced:VALIDATING_REFERENCE_EXISTENCE_FALSE:referenceType,singleLidOrLidvidReference,contextReferenceCheck {},{},{}",ReferentialIntegrityUtil.getReferenceType(),singleLidOrLidvidReference,ReferentialIntegrityUtil.contextReferenceCheck);


LOG.debug("reportContextReferencesUnreferenced:SET_CONTAINS_SINGLE_REFERENCE: {},{}",singleLidOrLidvidReference,ReferentialIntegrityUtil.reportedErrorsReferenceSet.contains(singleLidOrLidvidReference));
// Only report the error/warning if it has not been reported before. Also, use the URL of the parent bundle if it is not null.
if (!ReferentialIntegrityUtil.reportedErrorsReferenceSet.contains(singleLidOrLidvidReference)) {
URL urlToReport;
Expand All @@ -431,6 +431,9 @@ public static void reportContextReferencesUnreferenced() {
}

String errorMessage = "This file should reference '" + singleLidOrLidvidReference + "' because its child product with LIDVID " + hashKey + " references it.";
LOG.warn(errorMessage + ":urlToReport: {}",urlToReport); // Print the error to the log so we have it.

// The returned value of getListener() should allow this class to add a new problem.
getListener().addProblem(new ValidationProblem(new ProblemDefinition(
ExceptionType.WARNING,
ProblemType.MISSING_CONTEXT_REFERENCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,19 +449,19 @@ private boolean validateLoadedSchemas(URL label, List<StreamSource> streamSource
container = schemaValidator.validate(source);
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag {},{}",schemaUrl,passFlag);
} catch (Exception e) {
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag SET_TO_ERROR_1 {},{}",schemaUrl,passFlag);
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag SET_TO_error_1 {},{}",schemaUrl,passFlag); // Change to lowercase so as not to confuse the log file
container.addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.ERROR,
ProblemType.SCHEMA_ERROR,
"Error reading schema: " + e.getMessage()),
schemaUrl));
}
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag SET_TO_ERROR_2,container.hasError,container.hasFatal {},{},{},{}",schemaUrl,passFlag,container.hasError(),container.hasFatal());
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag SET_TO_error_2,container.hasError,container.hasFatal {},{},{},{}",schemaUrl,passFlag,container.hasError(),container.hasFatal()); // Change to lowercase so as not to confuse the log file
if (container.getProblems().size() != 0) {
for (ValidationProblem le : container.getProblems()) {
le.setSource(label.toURI().toString());
getListener().addProblem(le);
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag,message SET_TO_ERROR_3 {},{},[{}]",schemaUrl,passFlag,le.getMessage());
LOG.debug("validateAllLoadedSchemas:schemaUrl,passFlag,message SET_TO_error_3 {},{},[{}]",schemaUrl,passFlag,le.getMessage()); // Change to lowercase so as not to confuse the log file
}
if (container.hasError() || container.hasFatal()) {
passFlag = false;
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/gov/nasa/pds/validate/ValidateLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -1694,14 +1694,23 @@ public void printHeader(String title) {

public void record(String location) {
URI uri = null;
LOG.debug("record:location {}",location);
try {
uri = new URI(location);
LOG.debug("record:location,uri {},{}",location,uri);
} catch (URISyntaxException e) {
// Should not happen - ignore.
LOG.error("record:Cannot build URI from location {}. Value of uri is {}",location,uri);
}
if (exceptions.get(location) != null) {
LOG.debug("ValidationMonitor:record:location,exceptions.get(location) {},{}",location,exceptions.get(location));
LOG.debug("ValidationMonitor:record:location,exceptions.get(location).getProblems().size {},{}",location,exceptions.get(location).getProblems().size());
// It is possible there are no problems.
report.record(uri, exceptions.get(location).getProblems());
exceptions.remove(location);
} else {
// This is a message to show in debug mode only. The user doesn't normally need to see it.
LOG.debug("WARN:ValidationMonitor:record:exceptions.get(location) is null for location {}. Cannot report error.",location);
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/gov/nasa/pds/validate/report/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public void printHeader(String title) {
public Status record(URI sourceUri, final ValidationProblem problem) {
List<ValidationProblem> problems = new ArrayList<ValidationProblem>();
problems.add(problem);
LOG.debug("record:RECORDING_PROBLEM:sourceUri {}",sourceUri);
return record(sourceUri, problems);
}

Expand All @@ -241,6 +242,7 @@ public Status record(URI sourceUri, final List<ValidationProblem> problems) {
int numWarnings = 0;
int numInfos = 0;
Status status = Status.PASS;
LOG.debug("record:RECORDING_PROBLEM:sourceUri,problems.size {},{}",sourceUri,problems.size());

// TODO: Handle null problems

Expand Down Expand Up @@ -274,6 +276,18 @@ public Status record(URI sourceUri, final List<ValidationProblem> problems) {
if (numErrors > 0) {
this.numFailed++;
status = Status.FAIL;

LOG.debug("record:sourceUri {}",sourceUri);

// Note: If the value of sourceUri is null, there will be a java.lang.NullPointerException below.
// Therefore, sourceUri must be checked against null-ness before calling toString() function.
if (sourceUri == null) {
LOG.error("record:sourceUri is null. A NullPointerException exception will occur when sourceUri.toString() is called. Cannot continue. Must return with status {}",status);
return status;
} else {
LOG.debug("record:sourceUri.toString {}",sourceUri.toString());
}

if (!Utility.isDir(sourceUri.toString())) {
if (!this.integrityCheckFlag) {
this.numFailedProds++;
Expand Down
Binary file not shown.
106 changes: 106 additions & 0 deletions src/test/resources/github432/val308b/browse-ion-moments/ION_MOM.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/mission/vg1/v1/PDS4_VG1_1D00_1001.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<Product_Browse xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:vg1="http://pds.nasa.gov/pds4/mission/vg1/v1"
xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.xsd
http://pds.nasa.gov/pds4/mission/vg1/v1 https://pds.nasa.gov/pds4/mission/vg1/v1/PDS4_VG1_1D00_1001.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:vg1-pls-sat:browse-ion-moments:ion-mom</logical_identifier>
<version_id>1.0</version_id>
<title>Voyager 1 PLS Saturn Ion Moments Browse - ION MOM</title>
<information_model_version>1.13.0.0</information_model_version>
<product_class>Product_Browse</product_class>
<Citation_Information>
<author_list>DS Planetary Interactions Node</author_list>
<publication_year>2021</publication_year>
<description>This product is a PDF image of the ion moment data
(10-5950 eV) from the Plasma experiment on Voyager 1 from the Saturn
encounter. The plot was generated at PDS-PPI.</description>
</Citation_Information>
<Modification_History>
<Modification_Detail>
<modification_date>2021-04-15</modification_date>
<version_id>1.0</version_id>
<description>Original ION_MOM.PDF from the PDS3 VG1-S-PLS-5-SUMM-IONMOM-96SEC-V1.0 dataset, BROWSE directory, originally released 2002-10-14,
migrated to PDF/A to meet PDS4 standards.</description>
</Modification_Detail>
</Modification_History>
</Identification_Area>
<Context_Area>
<Time_Coordinates>
<start_date_time>1980-11-12T03:00:11.000Z</start_date_time>
<stop_date_time>1980-11-13T08:58:35.000Z</stop_date_time>
</Time_Coordinates>
<Investigation_Area>
<name>Voyager</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.voyager</lid_reference>
<reference_type>browse_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Voyager 1</name>
<type>Spacecraft</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.vg1</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
<Observing_System_Component>
<name>Plasma Science Experiment</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:vg1.pls</lid_reference>
<reference_type>is_instrument</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Saturn</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.saturn</lid_reference>
<reference_type>browse_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Target_Identification>
<name>Titan</name>
<type>Satellite</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:satellite.saturn.titan</lid_reference>
<reference_type>browse_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Mission_Area>
<vg1:Voyager1>
<vg1:mission_phase_name>Saturn Encounter</vg1:mission_phase_name>
</vg1:Voyager1>
</Mission_Area>
</Context_Area>
<Reference_List>
<Internal_Reference>
<lid_reference>urn:nasa:pds:vg1-pls-sat:data-ion-moments-96sec:nonexistentxxx</lid_reference> <!-- val308 should catch this -->
<reference_type>browse_to_data</reference_type>
</Internal_Reference>
</Reference_List>
<File_Area_Browse>
<File>
<file_name>ION_MOM.PDF</file_name>
<creation_date_time>2015-07-14</creation_date_time>
<file_size unit="byte">63322</file_size>
<md5_checksum>556aeb49b7d7b512c9db31aff51b5197</md5_checksum>
</File>
<Encoded_Image>
<name>ION_MOM</name>
<offset unit="byte">0</offset>
<encoding_standard_id>PDF/A</encoding_standard_id>
</Encoded_Image>
</File_Area_Browse>
</Product_Browse>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
P,urn:nasa:pds:vg1-pls-sat:browse-ion-moments:ion-mom::1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/mission/vg1/v1/PDS4_VG1_1D00_1001.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<Product_Collection xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:vg1="http://pds.nasa.gov/pds4/mission/vg1/v1"
xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.xsd
http://pds.nasa.gov/pds4/mission/vg1/v1 https://pds.nasa.gov/pds4/mission/vg1/v1/PDS4_VG1_1D00_1001.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:vg1-pls-sat:browse-ion-moments</logical_identifier>
<version_id>1.0</version_id>
<title>Voyager 1 Plasma Science Experiment (PLS) Saturn Ion Moments Browse Collection</title>
<information_model_version>1.13.0.0</information_model_version>
<product_class>Product_Collection</product_class>
<Citation_Information>
<author_list>PDS Planetary Interactions Node</author_list>
<publication_year>2021</publication_year>
<description>This collection contains the ion moment browse products associated with Voyager 1 Plasma Science Experiment (PLS) Saturn Data Bundle. </description>
</Citation_Information>
<Modification_History>
<Modification_Detail>
<modification_date>2021-04-15</modification_date>
<version_id>1.0</version_id>
<description>Original browse from the PDS3 VG1-S-PLS-5-SUMM-IONMOM-96SEC-V1.0 dataset, originally released 2002-10-14,
migrated to PDS4.</description>
</Modification_Detail>
</Modification_History>
</Identification_Area>
<Context_Area>
<Investigation_Area>
<name>Voyager</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.voyager</lid_reference>
<reference_type>collection_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Voyager 1</name>
<type>Spacecraft</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.vg1</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
<Observing_System_Component>
<name>Plasma Science Experiment</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:vg1.pls</lid_reference>
<reference_type>is_instrument</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Saturn</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.saturn</lid_reference>
<reference_type>collection_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Target_Identification>
<name>Titan</name>
<type>Satellite</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:satellite.saturn.titan</lid_reference>
<reference_type>collection_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Mission_Area>
<vg1:Voyager1>
<vg1:mission_phase_name>Saturn Encounter</vg1:mission_phase_name>
</vg1:Voyager1>
</Mission_Area>
</Context_Area>
<Reference_List>
<Internal_Reference>
<lid_reference>urn:nasa:pds:vg1-pls-sat:data-ion-moments-96sec</lid_reference>
<reference_type>collection_to_data</reference_type>
</Internal_Reference>
</Reference_List>
<Collection>
<collection_type>Browse</collection_type>
<description>Voyager 1 Plasma Science Experiment (PLS) Saturn Ion Moments Browse Collection</description>
</Collection>
<File_Area_Inventory>
<File>
<file_name>collection-browse-ion-moments-1.0.csv</file_name>
<md5_checksum>882edf0b28d094856841595758c085a8</md5_checksum>
</File>
<Inventory>
<offset unit="byte">0</offset>
<parsing_standard_id>PDS DSV 1</parsing_standard_id>
<description>This table lists the products in this collection</description>
<records>1</records>
<record_delimiter>Carriage-Return Line-Feed</record_delimiter>
<field_delimiter>Comma</field_delimiter>
<Record_Delimited>
<fields>2</fields>
<groups>0</groups>
<Field_Delimited>
<name>Member Status</name>
<field_number>1</field_number>
<data_type>ASCII_String</data_type>
<maximum_field_length unit="byte">1</maximum_field_length>
</Field_Delimited>
<Field_Delimited>
<name>LIDVID_LID</name>
<field_number>2</field_number>
<data_type>ASCII_LIDVID_LID</data_type>
<maximum_field_length unit="byte">255</maximum_field_length>
</Field_Delimited>
</Record_Delimited>
<reference_type>inventory_has_member_product</reference_type>
</Inventory>
</File_Area_Inventory>
</Product_Collection>
Loading