-
Notifications
You must be signed in to change notification settings - Fork 11
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
validate gives a NullPointerException during validation of a directory containing Table_Character products #335
Comments
@msbentley Hi Mark. I can confirm your finding when running with the -t parameter pointing to a directory. The code in question is at line 427 for RuleContext: 423 } This may be tricky to track down since it seems to work for the -t with a specific label and a specific -R rule but not -t to a directory. Will have a closer look at next opportunity. |
Developer's note: could be helpful in debugging the pesky null pointer issue. [pool-2-thread-1] DEBUG gov.nasa.pds.tools.validate.rule.RuleContext - getCheckInbetweenFields:CHECK_INBETWEEN_FIELDS validate.strict-field-checks |
We have some good results from the code fix in DEV. Running 3 different ways are now valid: validate -R pds4.label --skip-context-validation -r report_github335_as_label.json -s json -t src/test/resources/github335/minimal_test_product.xml {pds-dev3.jpl.nasa.gov}/home/qchau/sandbox/validate 174 % egrep "status|label" report_github335*.json Will check in the code at next opportunity. |
…ased on record length instead of the normal <CR><LF> and null pointer should not show up. 1. Correct the null pointer issue in RuleContext.java 2. Move part of a long function into a shorter function validateTableContentLineWise() in TableDataContentValidationRule.java 3. Add a peek into a text label for length of first line in TableDataContentValidationRule.java 4. Add new function validateTableContentRecordWise() to process one record at a time according to record_length in TableDataContentValidationRule.java Refs: #325 Validate Incorrectly Throws Error When Embedded Field_Character Contains <CR><LF> #335 validate gives a NullPointerException during validation of a directory containing Table_Character products
@jordanpadams Please close #336 as well when this issue is closed since it seems to be the same problem of null pointer. |
#338) ### Summary Closes #325, #335 This pull request resolves two issues: Read the Table_Character correctly and corrected the null pointer when checking for a command line parameter. Tested in DEV for #325 Previously would result in ERROR because it was reading the file line by line, which causes the record to end prematurely % validate -R pds4.label --skip-context-validation -r report_github325_label_valid.json -s json -t src/test/resources/github325/crs009x.xml Tested in DEV for #335 Three different ways to process a target, none should throw an exception. % validate -R pds4.label --skip-context-validation -r report_github335_as_label.json -s json -t src/test/resources/github335/minimal_test_product.xml % validate --skip-context-validation -r report_github335_as_target.json -s json -t src/test/resources/github335/*.xml % validate --skip-context-validation -r report_github335_as_dir.json -s json -t src/test/resources/github335 --- * Read the Table_Character correctly to read to the end of the record based on record length instead of the normal <CR><LF> and null pointer should not show up. 1. Correct the null pointer issue in RuleContext.java 2. Move part of a long function into a shorter function validateTableContentLineWise() in TableDataContentValidationRule.java 3. Add a peek into a text label for length of first line in TableDataContentValidationRule.java 4. Add new function validateTableContentRecordWise() to process one record at a time according to record_length in TableDataContentValidationRule.java Refs: #325 Validate Incorrectly Throws Error When Embedded Field_Character Contains <CR><LF> #335 validate gives a NullPointerException during validation of a directory containing Table_Character products * Add javadoc to several functions * Add missing test resources * Update to latest PDS4 Jparser SNAPSHOT * fix for backwards compatibility with java8 cast ByteBuffer to Buffer * Add common error to docs for backwards incompatibility when trying to run validate with bundle validation against a directory in java8, the software just hangs. updated docs with a workaround. refs #336 * Revert "Add common error to docs for backwards incompatibility" This reverts commit a0158b8. * Update regex to be more valid This seems to work fine in newer versions of java, but java8 just hangs and doesn't know what do with those extra wildcards. resolves #336 Co-authored-by: Qui T Chau <qchau@pds-dev3.jpl.nasa.gov> Co-authored-by: Jordan Padams <jordan.h.padams@jpl.nasa.gov>
🐛 Describe the bug
I am getting the following output when trying to validate a directory of products using
-t .
in a directory containing Table_Character products. This always used to work, but now I get errors like:note that if I explicitly use
-t *.xml
then it works OK!The following test product (uploaded also for another ticket) shows the problem:
validate_field_formats.zip
Update: I only seem to get the error when using a catalog file (my default). This seems a tricky one to pin down, so please ping me if you need further details!
📚 Version of Software Used
🖥 System Info
** 🦄 Applicable requirements**
The text was updated successfully, but these errors were encountered: