Skip to content

Commit

Permalink
Merge pull request #1027 from NASA-PDS/issue_1008
Browse files Browse the repository at this point in the history
Another URL/path fix for Windows
  • Loading branch information
jordanpadams authored Oct 14, 2024
2 parents 5d6304c + 07c92ee commit 4233960
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/gov/nasa/pds/tools/util/PDFUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ public synchronized boolean validateFileStandardConformity(String baseDir, Strin
// directory.
String parent = parentURL.getFile();

// tired of tricks to make it work everywhere so explicitly handling windoze
if (System.getProperty("os.name").toLowerCase().startsWith("window")) {
parent = new File(parentURL.toURI()).getAbsolutePath();
}

// Build the full pathname of the PDF file.
String pdfRef = parent + File.separator + pdfBase;
LOG.debug("validateFileStandardConformity:parent,pdfBase,pdfRef [{}],[{}],[{}]", parent,
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/features/3.6.x.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Scenario Outline: Execute validate command for tests below.
Examples:
| testName | testDir | messageCount | messageText | problemEnum | resourceDir | reportDir | commandArgs | refOutputValue |

# Validate#1008
|"NASA-PDS/validate#1008 PDF on windows" | "github1008" | 1 | "1 errors expected" | "NON_PDFA_FILE" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github1008.json -s json --skip-context-validation -t {resourceDir}/github1008/example.xml" | "report_github1008.json" |

# Validate#816 (reuse validate#681 tests)
|"NASA-PDS/validate#816 Field format FAIL: ASCII table invalid precision" | "github681" | 1 | "1 errors expected" | "FIELD_VALID_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_2.json -s json -t {resourceDir}/github681/ff_char_fail.xml" | "report_github681_2.json" |
|"NASA-PDS/validate#816 Field format WARNING: Precision mismatch" | "github681" | 2 | "2 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_3.json -s json -t {resourceDir}/github681/ff_char_warn.xml {resourceDir}/github681/ff_del_warn.xml" | "report_github681_3.json" |
Expand Down
Binary file added src/test/resources/github1008/example.pdf
Binary file not shown.
108 changes: 108 additions & 0 deletions src/test/resources/github1008/example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>

<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1M00.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>

<Product_Document
xmlns="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_1M00.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:example:document:example</logical_identifier>
<version_id>1.0</version_id>
<title>Example PDF</title>
<information_model_version>1.22.0.0</information_model_version>
<product_class>Product_Document</product_class>
<Citation_Information>
<publication_year>2024</publication_year>
<description>
PDF with example label used only to facilitate PDF/A validation.
</description>
<List_Author>
<Person>
<contributor_type>Producer</contributor_type>
<given_name>Ethan I.</given_name>
<family_name>Schaefer</family_name>
<sequence_number>1</sequence_number>
<Affiliation>
<organization_name>Planetary Data System, Geosciences Node</organization_name>
<sequence_number>1</sequence_number>
</Affiliation>
</Person>
</List_Author>
</Citation_Information>
<Modification_History>
<Modification_Detail>
<modification_date>2024-09-21</modification_date>
<version_id>1.0</version_id>
<description>Initial version</description>
</Modification_Detail>
</Modification_History>
</Identification_Area>

<Context_Area>
<Time_Coordinates>
<start_date_time xsi:nil="true" nilReason="inapplicable"/>
<stop_date_time xsi:nil="true" nilReason="inapplicable"/>
</Time_Coordinates>
<Investigation_Area>
<name>Magellan</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.magellan</lid_reference>
<reference_type>document_to_investigation</reference_type>
<comment>Alias: Venus Radar Mapper</comment>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Magellan</name>
<type>Host</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.mgn</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
<Observing_System_Component>
<name>Radio Science Subsystem</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:mgn.rss</lid_reference>
<reference_type>is_instrument</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Venus</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.venus</lid_reference>
<reference_type>document_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
</Context_Area>

<Document>
<publication_date>2024</publication_date>
<Document_Edition>
<edition_name>PDF Version</edition_name>
<language>English</language>
<files>1</files>
<Document_File>
<file_name>example.pdf</file_name>
<document_standard_id>PDF/A</document_standard_id>
</Document_File>
</Document_Edition>
<List_Author>
<Person>
<contributor_type>Producer</contributor_type>
<given_name>Ethan I.</given_name>
<family_name>Schaefer</family_name>
<sequence_number>1</sequence_number>
<Affiliation>
<organization_name>Planetary Data System, Geosciences Node</organization_name>
<sequence_number>1</sequence_number>
</Affiliation>
</Person>
</List_Author>
</Document>
</Product_Document>

0 comments on commit 4233960

Please sign in to comment.