Any plans on adding the support to load ucum essence file
tiaden opened this issue · 3 comments
Hi,
I am new to the world of ucum. I have a error when I try to parse mm[Hg]
Do you have plans on supporting this ?
Thanks in advance
Code
UCUMServiceProvider ucumServiceProvider= new UCUMServiceProvider();
var unitFormat = ucumServiceProvider.getUnitFormatService().getUnitFormat();
var firstFormat= unitFormat.parse("[psi]").asType(Pressure.class);
var secondFormat = unitFormat.parse("mm[Hg]").asType(Pressure.class);
Quantity<?> sut1 = Quantities.getQuantity(2.5d, firstFormat).to(secondFormat);
System.out.println(sut1.getValue());
Error
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:823) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:804) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1275) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1263) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
at com.example.demo3.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.2.0.M2.jar:2.2.0.M2]
Caused by: systems.uom.ucum.internal.format.TokenException: null
at systems.uom.ucum.internal.format.UCUMFormatParser.SimpleUnit(UCUMFormatParser.java:207) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.internal.format.UCUMFormatParser.Annotatable(UCUMFormatParser.java:180) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.internal.format.UCUMFormatParser.Component(UCUMFormatParser.java:122) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.internal.format.UCUMFormatParser.Term(UCUMFormatParser.java:77) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.internal.format.UCUMFormatParser.parseUnit(UCUMFormatParser.java:67) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.format.UCUMFormat$Parsing.parse(UCUMFormat.java:453) ~[systems-ucum-1.0.jar:1.0]
at systems.uom.ucum.format.UCUMFormat$Parsing.parse(UCUMFormat.java:471) ~[systems-ucum-1.0.jar:1.0]
at com.example.demo3.demo.StartUp.run(StartUp.java:50) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:820) ~[spring-boot-2.2.0.M2.jar:2.2.0.M2]
The ucum-essense.xml is supported by Eclipse UOMo already: https://github.com/eclipse/uomo/tree/master/bundles/org.eclipse.uomo.ucum
While the last UOMo UCUM version still supports JSR 363, we plan to update the CQ at Eclipse for 385 as soon as the Final version is confirmed by the JCP. The ballot already passed, but it still requires a bit of paperwork to get it on JCP.org.
Ok Thank you !
See UOMo UCUM, I guess we won't do it here.