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

Command line arguments are ignored #85

Closed
ghost opened this issue Dec 10, 2019 · 14 comments
Closed

Command line arguments are ignored #85

ghost opened this issue Dec 10, 2019 · 14 comments

Comments

@ghost
Copy link

ghost commented Dec 10, 2019

All of the below commands generate the same results. All the arguments are being ignored.

This is as of commit ae126de

java -jar target/stationxml-validator-1.6.0.2-SNAPSHOT-jar-with-dependencies.jar ~/export/FDSNstationXML/IC/IC_BJT.xml --format report
java -jar target/stationxml-validator-1.6.0.2-SNAPSHOT-jar-with-dependencies.jar ~/export/FDSNstationXML/IC/IC_BJT.xml --ignore-warnings   
java -jar target/stationxml-validator-1.6.0.2-SNAPSHOT-jar-with-dependencies.jar ~/export/FDSNstationXML/IC/IC_BJT.xml --help
java -jar target/stationxml-validator-1.6.0.2-SNAPSHOT-jar-with-dependencies.jar ~/export/FDSNstationXML/IC/IC_BJT.xml --rules
@ghost
Copy link
Author

ghost commented Dec 10, 2019

Fix this issue in Merge request #88

Is there a reason you don't allow a plain java -jar validator.jar path/to/station.xml to run anymore (version 1.52 allowed this behavior)?

@ghost
Copy link
Author

ghost commented Dec 10, 2019

Note I haven't fixed ignoring --show-units, --show-rules. I will add that now.

@ghost
Copy link
Author

ghost commented Dec 10, 2019

--show-units and --show-rules should now work if called like

java -jar validator.jar --show-rules
java -jar validator.jar --show-units

I noticed the help text did not match what was in the code. So I updated that as well.

@megies
Copy link

megies commented Jan 16, 2020

I don't get any output as well using the latest release 1.6.0.2-SNAPSHOT, just getting NullPointer exceptions when using options and just getting the help message when using no options (btw. replacing the actual version in the help message doesn't seem to work as intended). I'm using 1.5.9.5 for now for this reason.
What is a bit weird about that one is that the output is going to stdout per default, but its not plain text but html, which is not what I would expect for a command line tool outputting to stdout. ;-)

//tmp$ java -jar ~/local/src/stationxml-validator.jar /tmp/ACW5S.xml --debug
java.lang.NullPointerException
	at edu.iris.dmc.station.conditions.SampleRateCondition.evaluate(SampleRateCondition.java:41)
	at edu.iris.dmc.station.rules.Rule.execute(Rule.java:44)
	at edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:160)
	at edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:142)
	at edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:108)
	at edu.iris.dmc.station.RuleEngineService.executeAllRules(RuleEngineService.java:47)
	at edu.iris.dmc.Application.run(Application.java:134)
	at edu.iris.dmc.Application.run(Application.java:121)
	at edu.iris.dmc.Application.main(Application.java:92)
tmp$ java -jar ~/local/src/stationxml-validator.jar dataless.seed.BW_MGS04
===============================================================
|                  FDSN StationXml validator                   |
|                  Version ${project.version}                  |
================================================================
Usage:
java -jar stationxml-validator <FILE> [OPTIONS]
OPTIONS
   --output      	: where to output result, default is System.out
   --ignore-warnings: don't show warnings
   --rules 			: print a list of validation rules
   --units 			: print a list of units used to validate
   --debug       	:
   --help        	: print this message
===============================================================

@ghost
Copy link
Author

ghost commented Jan 16, 2020

@megies I have patched this on my fork of the project if you need a working version. I am keeping my fork up to date against the latest changes they put in the IRIS master branch. https://github.com/jholland-usgs/stationxml-validator

@timronan @CTrabant @yazan-iris Is there a reason my merge request that fixes this can't be merged?

@ghost
Copy link
Author

ghost commented Jan 16, 2020

Also:
Is there a reason you don't allow a plain "java -jar validator.jar path/to/station.xml" to run anymore (version 1.52 allowed this behavior)? If not, I would like to readd this functionality back into the validator.

@timronan
Copy link
Collaborator

Please do not use the 1.5.9.5 version of the validator. There are many bugs, including null pointer exceptions, that have been fixed since 1.5.9.5 was released. This version of the validator does not verify compliance with the FDSN-Stationxml-Schema v1.1. We cannot resolve issues posted if the 1.5.9.5 version of the validator is being used.

@jholland-usgs I will review your pull request. Sorry about the delay on this, the PR must have been forgotten during AGU and the holiday madness. We are working on a new front end to the validator right now, so this issue may eventually change.

@megies the null pointer exception issue is triggering because the file /tmp/ACW5S.xml has a null field that the validator has not been coded to handle. Can you please send us this file so we can fix this issue.

java -jar ~/local/src/stationxml-validator.jar dataless.seed.BW_MGS04

Until the validator is patched, an argument in addition to the file needs to be included for the validator to run. The posted output is the validators help message. Use the command:

java -jar ~/local/src/stationxml-validator.jar dataless.seed.BW_MGS04 --format report

And you should get the output that you expect unless the validator chokes on another null pointer exception which is unlikely.

@ghost
Copy link
Author

ghost commented Jan 16, 2020

@timronan --format isn't currently an option in Application.java

It is hard coded to always run csv currently.

run(input, "csv", outputStream, commandLine.ignoreRules(), commandLine.ignoreWarnings());

@ghost
Copy link
Author

ghost commented Jan 16, 2020

Also, thanks for looking at my pull request.

@timronan
Copy link
Collaborator

As pointed out in this issue's original post, if you provide a second argument you will receive the validation results formatted in csv. We are working on changing the validator's front end right now. This is why the validator still has the tags prerelease and snapshot.
For the validator to run follow this pattern:

java -jar ~/local/src/stationxml-validator.jar /Path/to/metadata.xml --string

@megies
Copy link

megies commented Jan 17, 2020

@timronan modified file is attached
XXX..txt

@peacocks
Copy link

peacocks commented Mar 9, 2020

I have 1.6.0.2 and got it to work but it did not write output, only a usage message, unless I specified an output file. Furthermore, I had to "touch" the output file before invoking the command, otherwise it came back with "File not found". So the command line that worked was:

touch jjoutput
java -jar stationxml-validator-1.6.0.2-SNAPSHOT.jar data-EKR5-20200301-203000v2.1.15.xml --output jjoutput --debug

"jjoutput" contains:
"",420,Warning,BN,EKR5,BHZ,,2009-09-14T10:41:20,2099-01-01T00:00:00,No decimation found
"",420,Warning,BN,EKR5,BHZ,,2009-09-14T10:41:20,2099-01-01T00:00:00,Decimation cannot be null
(These are almost certainly legitimate shortcomings of the particular xml file that I used).

@timronan
Copy link
Collaborator

These issue should be addressed in Validator version stationxml-validator-1.7.0-RC-01, available on the Validator's releases page. For usage infomration

http://iris-edu.github.io/stationxml-validator/
or
java -jar stationxml-validator-1.7.0.jar --help

Please verify these functions work satisfactorily and report or close the issue based on your findings.

@peacocks
Copy link

Using 1.7.0-RC-01 - yes, the problem seems to have been fixed. Thanks.

@ghost ghost closed this as completed May 6, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants