bytemechanics/standalone-ignite

Control parameter parse failed in order to give a understandable message

Closed this issue · 1 comments

Provide an understandable message when parameter parse fails
Example:
Parse a Path without value:

(...)
INPUTFILE(Path.class,"watever"),
(...)

And then call with:
(...) -inputfile: (...)

Causes an error:

Exception in thread "main" org.bytemechanics.standalone.ignite.exceptions.Unpars
eableParameter: Unparseable parameter INPUTFILE with value:
        at org.bytemechanics.standalone.ignite.Parameter.parseParameter(Parameter.java:123)
        at java.util.Optional.map(Unknown Source)
        at org.bytemechanics.standalone.ignite.Parameter.loadParameter(Parameter.java:133)
        at org.bytemechanics.standalone.ignite.Parameter.lambda$parseParameters$9(Parameter.java:160)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
        at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.util.stream.ReferencePipeline.forEach(Unknown Source)
        at org.bytemechanics.standalone.ignite.Parameter.parseParameters(Parameter.java:160)
        at org.bytemechanics.standalone.ignite.Standalone.lambda$parseParameters$1(Standalone.java:208)
        at java.util.Optional.ifPresent(Unknown Source)
        at org.bytemechanics.standalone.ignite.Standalone.parseParameters(Standalone.java:208)
        at org.bytemechanics.standalone.ignite.Standalone.ignite(Standalone.java:280)
        at com.allianz.cm.bridge.bdmig.CMBridgeDBMig.main(CMBridgeDBMig.java:121)
Caused by: java.text.ParseException: Unable to parse  with generic parser
        at org.bytemechanics.standalone.ignite.beans.DefaultParameterContainer.lambda$null$2(DefaultParameterContainer.java:83)
        at java.util.Optional.orElseThrow(Unknown Source)
        at org.bytemechanics.standalone.ignite.beans.DefaultParameterContainer.lambda$getDefaultParser$3(DefaultParameterContainer.java:83)
        at org.bytemechanics.standalone.ignite.internal.commons.functional.LambdaUnchecker.lambda$uncheckedFunction$4(LambdaUnchecker.java:299)
        at org.bytemechanics.standalone.ignite.Parameter.lambda$parseParameter$6(Parameter.java:120)
        at java.util.Optional.map(Unknown Source)
        at org.bytemechanics.standalone.ignite.Parameter.parseParameter(Parameter.java:120)
        ... 18 more

Resolved with #13