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

Set registered context products in doValidation method #526

Closed
jordanpadams opened this issue Jul 13, 2022 · 0 comments · Fixed by #527
Closed

Set registered context products in doValidation method #526

jordanpadams opened this issue Jul 13, 2022 · 0 comments · Fixed by #527

Comments

@jordanpadams
Copy link
Member

Hi @jordanpadams I have checked the latest snapshot and I would need a modification for our integration to work.

From our integration code, calling doValidate() on gov.nasa.pds.validate.ValidateLauncher after calling setNonRegisteredProductsFile() and setRegisteredProductsFile() raises a NullPointerException.

I have been debugging the code and I realised that on line 173 gov.nasa.pds.tools.validate.rule.pds4.ContextProductReferenceValidationRule.checkContextReferences() when checkContextReferences() retrieves the registered products from the context it gets a null object, causing a NullPointerException on line 220.

It seems that although the register / non registered context products have been set, they have not been parsed as the method used for parsing and put them in the context- ValidateLauncher.setRegisteredProducts() - is called in ValidateLauncher.processMain(String[] args) instead of in ValidateLaucher.doValidation() which is used for the integration.

I have tried to change the integration code to use ValidateLaucher.processMain(String args[]) instead of ValidateLauncher.doValidation() to work-around this error but that is not possible, mainly because processMain does it own report set-up and the integration code needs to customise the report before it writes anything.

To get the integration code working I would need that either ValidateLauncher.setRegisteredProducts() becomes public instead of private [so I can call it from the integration code before calling ValidateLauncher.doValidate()] or that the call to ValidateLauncher.setRegisteredProducts() in ValidateLauncher.processMain(String[] args) - line 1622 - gets moved inside ValidateLauncher.doValidate(). Could it be possible to include one of those modifications in the snapshot ?

Many thanks for your support.

Originally posted by @fran-vallejo in #241 (comment)

Related Requirements

🦄 #241

@jordanpadams jordanpadams changed the title Enhancements to #241 Set registered context products in doValidation method Jul 13, 2022
@jordanpadams jordanpadams self-assigned this Jul 13, 2022
jordanpadams added a commit that referenced this issue Jul 13, 2022
Executing `setRegisteredProducts` in `processMain` doesn't make sense for someone trying to call this class through the API.

Solution is the execution in the `doValidation` method, which encapsulates a lot of setup prior to executing validation.

Alternative would be to make `setRegisteredProducts` public.

Resolves #526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant