Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileService:printStackTraceToFile:ERROR when validating a product with overlapping fields #379

Closed
fran-vallejo opened this issue Jul 27, 2021 · 3 comments
Assignees
Labels
B12.0 bug Something isn't working

Comments

@fran-vallejo
Copy link

🐛 Describe the bug

Validating a product that contains a table with overlapping fields results in an error when validate tries to create a stack trace report file.

📜 To Reproduce

Run validate (either version 2.0.7 or 2.1.0-SNAPSHOT) using mix_cal_hk_fpac_report_20181204 as target.

BepiVirtualBox:~/Software$ validate-2.0.7/bin/validate --target /home/fvallejo/Documents/mix_cal_hk_fpac_report_20181204.xml
FileService:printStackTraceToFile:ERROR: This function can only write to file that ends with .txt or .log

🕵️ Expected behavior

Validate runs and reports the product is not valid because it defines overlapping fields.

📚 Version of Software Used

validate 2.0.7 and validate 2.1.0-SNAPSHOT [repo commit 2cba1fd]

🩺 Test Data / Additional context

Product mix_cal_hk_fpac_report_20181204.zip attached. Fields 42 and 43 in this product overlap.

Please note that validate will report missing external references as well as the product contains references to elements not yet in PDS.

🖥 System Info

  • OS: Ubuntu 20.04
  • Java: OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

🦄 Related requirements

⚙️ Engineering Details

@jstone-psi
Copy link

This happens to me, also. I managed to track the problem to TableDataContentValidationRule.java, where the stack trace logger is trying to write to the data file instead of a log file based on the data file name.

@jordanpadams I think this can be fixed by changing

FileService.printStackTraceToFile(dataFile.getPath(),ex);

to

FileService.printStackTraceToFile(dataFile.getPath() + ".log",ex);

in three places in TableDataContentValidationRule.java.

@qchaupds
Copy link
Contributor

qchaupds commented Aug 2, 2021

@jstone-psi @jordanpadams You are right, the call to printStackTraceToFile() should pass in either "null", or appends ".log". The default name will be used if "null" is passed in.
With some changes to our Java code, we have success:

{pds-dev3.jpl.nasa.gov}/home/qchau/sandbox/validate 165 % validate -R pds4.label --skip-context-reference-check -r report_github379_label_invalid.json -s json -t src/test/resources/github379/mix_cal_hk_fpac_report_20181204.xml > & t2

{pds-dev3.jpl.nasa.gov}/home/qchau/sandbox/validate 164 % egrep "message|type|severity" report_github379_label_invalid.json
"messages": [
"severity": "ERROR",
"type": "error.table.field_value_overlap",
"message": "This field overlaps the next field. Current field ends at 348. Next field starts at 347"
"messageTypes": [
"messageType": "error.label.context_ref_not_found",
"messageType": "error.table.field_value_overlap",

Code will be checkin at next opportunity.

@tloubrieu-jpl tloubrieu-jpl added this to the 11.Jesse.Owens milestone Aug 3, 2021
qchaupds pushed a commit that referenced this issue Aug 4, 2021
… optional with new command line parameter --enable-stack-printing

1. Add test resource :src/test/resources/github379
2. Add test resource :src/test/resources/github380 (Directory is required due to quirkiness with behave)
3. Add logic to enable stack printing :src/main/java/gov/nasa/pds/tools/util/FileService.java
4. Add house keeping of stackPrintingFlag variable :src/main/java/gov/nasa/pds/tools/util/FlagsUtil.java
5. Fix bug with printStackTraceToFile(0 function :src/main/java/gov/nasa/pds/tools/validate/rule/pds4/TableDataContentValidationRule.java
6. Add parsing ENABLE_STACK_PRINTING parameter :src/main/java/gov/nasa/pds/validate/ValidateLauncher.java
7. Add ENABLE_STACK_PRINTING parameter :src/main/java/gov/nasa/pds/validate/commandline/options/Flag.java
8. Add ENABLE_STACK_PRINTING option :src/main/java/gov/nasa/pds/validate/commandline/options/FlagOptions.java
9. Add tests for github379 and github380 :src/test/resources/features/validate.feature

Refs:

#379 FileService:printStackTraceToFile:ERROR when validating a product with overlapping fields
#380 stack trace being created during successful validate execution
qchaupds pushed a commit that referenced this issue Aug 12, 2021
1. Add setSeverity() to 0 when --debug-mode is used at command line :src/main/java/gov/nasa/pds/validate/ValidateLauncher.java
2. Modify --enable-stack-printing to --debug-mode :src/main/java/gov/nasa/pds/validate/commandline/options/FlagOptions.java
3. Modify --enable-stack-printing to --debug-mode :src/test/resources/features/validate.feature

Refs:

#379 FileService:printStackTraceToFile:ERROR when validating a product with overlapping fields
#380 stack trace being created during successful validate execution
@jordanpadams
Copy link
Member

closed per #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B12.0 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants