open-simulation-platform / osp-validator

Ontology-based systems structure validator
Mozilla Public License 2.0
4 stars 1 forks source link

NullPointerException on invalid command line arguments #80

Open kyllingstad opened 4 years ago

kyllingstad commented 4 years ago

When running

java -jar osp-cli.jar -fmu path/to/model.fmu

or

java -jar osp-cli.jar -file path/to/model_OspModelDescription.xml

I get error messages like the following:

Exception in thread "main" java.lang.NullPointerException
        at java.io.File.<init>(File.java:277)
        at com.opensimulationplatform.cli.Main.main(Main.java:85)

Presumably, the error occurs because both the -fmu and -file switches are mandatory, but the message does not indicate this. (Furthermore, IMO, a NullPointerException always represents a bug in the program, never a usage error.)

Also note that the mandatoriness of the options is not specified in the built-in usage documentation, so it's hard for a user to tell. (They're listed as "options", which at least seems to hint that they might be optional.)