[JSCIENCE-166] Amount string parsing Created: 12/Feb/13  Updated: 01/Jul/14

Status: Open
Project: jscience
Component/s: Physics
Affects Version/s: current
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: DanielJackson Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7, Eclipse Juno, Java 7



 Description   

When using the Amount.valueOf(csq) method I receive an error; for example, the following code produces this:

Amount<Power> a = Amount.valueOf(10.0, SI.WATT); // so far so good
Amount<Power> b = (Amount<Power>) Amount.valueOf(a.toString); // this produces an error

java.lang.IllegalArgumentException: Incomplete Parsing
at javolution.text.TextFormat.parse(Unknown Source)
at org.jscience.physics.amount.Amount.valueOf(Amount.java:244)
at ... // project specific path
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



 Comments   
Comment by cameronsstone [ 03/Feb/14 ]

Any updates on this?

How about a hint on:
1) how to implement parsing for arbitrary Amount types?
2) which version of JScience to implement them in?

Comment by dautelle [ 06/Feb/14 ]

Hello,
The amount class with a new implementation will be in the draft release 5.0 (this month hopefully).
Cheers

Comment by cdupont2 [ 01/Jul/14 ]

Hello!
Is there a workaround to make the parsing of a new unit work on 4.3?
Cheers

Generated at Wed May 27 09:14:57 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.