openpreserve / scape-toolwrapper

SCAPE project for creating debian packages from command line tools.
http://openplanets.github.io/scape-toolwrapper
Apache License 2.0
5 stars 1 forks source link

null pointer in BashWrapperGenerator #14

Closed alastairduncan closed 10 years ago

alastairduncan commented 10 years ago

Output.isRequired() is of type Boolean so it can be null.

Exception in thread "main" java.lang.NullPointerException at eu.scape_project.tool.toolwrapper.toolwrapper_bash_generator.BashWrapperGenerator.addCommandInformationToContext(BashWrapperGenerator.java:324) at eu.scape_project.tool.toolwrapper.toolwrapper_bash_generator.BashWrapperGenerator.generateWrapper(BashWrapperGenerator.java:154) at eu.scape_project.tool.toolwrapper.toolwrapper_bash_generator.BashWrapperGenerator.main(BashWrapperGenerator.java:584)

hsilva-keep commented 10 years ago

Good catch Alastair :) The main problem is not enforcing, in the XML schema, the presence of that attribute and therefore it can be null if the attribute is not set in the XML document. I'll see the best way to address this problem.

hsilva-keep commented 10 years ago

Alastair, I've provided a fix. I've made some tests, for the case where the attribute was missing, for the case where the attribute is present but has no value and for the case where the attribute is present but an invalid value is set. And it performed as expected, that is, falling because the schema validation failed. Can you please try it out and see if any other case if possible (I think those 3 cover all the cases but you never know)? Checkout into master branch, update it (pull), recompile source code with mvn clean package and try to generate the bash wrapper again.

alastairduncan commented 10 years ago

Hélder, this has fixed the problem when the value is missing I get a nice error message: [ERROR] Unable to process the toolspec provided! Please check it and also if all mandatory parameters were provided properly!

hsilva-keep commented 10 years ago

Nice ;) Closing this one... Thanks Alastair...