Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Units of Measurement dependencies #2319

Merged
merged 1 commit into from
May 10, 2021
Merged

Conversation

wborn
Copy link
Member

@wborn wborn commented Apr 26, 2021

Based on #1664
Depends on openhab/openhab-osgiify#19


Upgrades UoM dependencies to:

  • javax.measure 2.1.2
  • si-units 2.0.1
  • indriya 2.1.2

An openHAB OSGi-ified si-units bundle is used as runtime dependency, because the latest si-units release is still missing proper OSGi manifest headers.

Notable changes:

  • Quantity not longer implements an equals method, so the unit tests had to be adjusted. This should have any impact outside of the unit tests though since the rest of openHAB should be using QuantityType instead.
  • RationalConverter is not package private, so instances of it much be created through the MultiplyConverter static functions.
  • Quantities.getQuantity can no longer parse values without units like 100. A workaround has been implemented.
  • The unicode greek mu letter is now returned for unit prefixes instead of the unicode micro character. These characters are visually identical but the unit tests had to be adjusted. The new library seems to parse both types just fine.

@wborn wborn added the awaiting other PR Depends on another PR label Apr 26, 2021
@wborn wborn requested a review from a team as a code owner April 26, 2021 08:04
@wborn wborn added dependencies Pull requests that update a dependency file enhancement An enhancement or new feature of the Core labels Apr 26, 2021
Upgrades UoM dependencies to:

* javax.measure 2.1.2
* si-units 2.0.1
* indriya 2.1.2

An openHAB OSGi-ified si-units bundle is used as runtime dependency, because the latest si-units release is still missing proper OSGi manifest headers.

Notable changes:

* Quantity not longer implements an `equals` method, so the unit tests had to be adjusted. This should have any impact outside of the unit tests though since the rest of openHAB should be using QuantityType instead.
* RationalConverter is not package private, so instances of it much be created through the MultiplyConverter static functions.
* Quantities.getQuantity can no longer parse values without units like `100`. A workaround has been implemented.
* The unicode greek `mu` letter is now returned for unit prefixes instead of the unicode `micro` character. These characters are visually identical but the unit tests had to be adjusted. The new library seems to parse both types just fine.

Also-by: Connor Petty <[email protected]>
Signed-off-by: Wouter Born <[email protected]>
@wborn wborn added UoM Units of Measurement rebuild Triggers the Jenkins PR build and removed awaiting other PR Depends on another PR rebuild Triggers the Jenkins PR build labels Apr 26, 2021
@cweitkamp cweitkamp added rebuild Triggers the Jenkins PR build and removed rebuild Triggers the Jenkins PR build labels Apr 26, 2021
@wborn wborn added rebuild Triggers the Jenkins PR build and removed rebuild Triggers the Jenkins PR build labels Apr 26, 2021
@wborn
Copy link
Member Author

wborn commented Apr 26, 2021

Ah, success! 😄

@wborn
Copy link
Member Author

wborn commented May 10, 2021

Friendly "ready for review" ping @openhab/core-maintainers.

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me, thanks for this huge effort!

@kaikreuzer kaikreuzer merged commit 9130799 into openhab:main May 10, 2021
@kaikreuzer kaikreuzer added this to the 3.1 milestone May 10, 2021
@wborn wborn deleted the update-uom branch May 10, 2021 19:41
@wborn wborn mentioned this pull request May 10, 2021
@ghys
Copy link
Member

ghys commented May 11, 2021

Edit: never mind I just saw the other freshly merged PRs

I incidentally installed the latest snapshot - which I haven't done in weeks - and now none of the addons install 😢

org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-persistence-rrd4j; type=karaf.feature; version="[3.1.0.SNAPSHOT,3.1.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-persistence-rrd4j)(type=karaf.feature)(version>=3.1.0.SNAPSHOT)(version<=3.1.0.SNAPSHOT))" [caused by: Unable to resolve openhab-persistence-rrd4j/3.1.0.SNAPSHOT: missing requirement [openhab-persistence-rrd4j/3.1.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.persistence.rrd4j; type=osgi.bundle; version="[3.1.0.202105100416,3.1.0.202105100416]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.persistence.rrd4j/3.1.0.202105100416: missing requirement [org.openhab.persistence.rrd4j/3.1.0.202105100416] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.measure)(version>=1.0.0)(!(version>=2.0.0)))"]]

Presumably it's because of this change. I have indeed the UoM library in version 2.x now:

openhab> bundle:list -u | grep measure
 58 x Active x  80 x 2.1.2                 x mvn:javax.measure/unit-api/2.1.2

Is there something to do on my side to fix this?

@wborn
Copy link
Member Author

wborn commented May 11, 2021

Yes build # 2373 unfortunately didn't have all changes.
Build # 2374 that just finished should have all these UoM changes.

@ghys
Copy link
Member

ghys commented May 11, 2021

2374 works indeed, I was unlucky, now everything's fine - sorry for the bother!

@ghys
Copy link
Member

ghys commented May 11, 2021

I did have some new UoM exceptions related to rrd4j on start though - but it was a couple times on start and now I can't reproduce them. I don't know which items they related to. Charting items with dimensions from the UI seems to work as before.

10:14:41.620 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.persistence.rrd4j.internal.RRD4jPersistenceService@7799bc94': Parse Error
javax.measure.format.MeasurementParseException: Parse Error
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.CommonFormatter.parseMixed(CommonFormatter.java:109) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.CommonFormatter.parseMixedAsLeading(CommonFormatter.java:138) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:207) ~[bundleFile:2.1.2]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:224) ~[bundleFile:2.1.2]
        at tech.units.indriya.quantity.Quantities.getQuantity(Quantities.java:85) ~[bundleFile:2.1.2]
        at org.openhab.core.types.util.UnitUtils.parseUnit(UnitUtils.java:166) ~[bundleFile:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:203) ~[bundleFile:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:161) ~[bundleFile:?]
        at org.openhab.persistence.rrd4j.internal.RRD4jPersistenceService.query(RRD4jPersistenceService.java:248) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

@wborn
Copy link
Member Author

wborn commented May 11, 2021

Thanks for reporting it. I will keep an eye on my logs and see if I can reproduce it. There have been quite a few changes in the new UoM implementation, so I can imagine there are also a few regressions.

@cweitkamp
Copy link
Contributor

I added the "API breaking" label. Some bundles might need to adopt their code to handle the new MeasurementParseException.

@gahubs
Copy link

gahubs commented May 13, 2021

Hi, some more errors:

e.g. openweather binding: Current dew point 908,0 °C, Current Gust Speed 1728,0 km/h

2021-05-12 21:59:53.937 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: Parse Error
javax.measure.format.MeasurementParseException: Parse Error
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixed(CommonFormatter.java:109) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixedAsLeading(CommonFormatter.java:138) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:207) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:224) ~[?:?]
        at tech.units.indriya.quantity.Quantities.getQuantity(Quantities.java:85) ~[?:?]
        at org.openhab.core.types.util.UnitUtils.parseUnit(UnitUtils.java:166) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:203) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:161) ~[?:?]
        at org.openhab.core.library.items.NumberItem.setState(NumberItem.java:110) ~[?:?]
        at org.openhab.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:76) ~[?:?]
        at org.openhab.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:48) ~[?:?]
        at org.openhab.core.internal.events.EventHandler.lambda$0(EventHandler.java:151) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
2021-05-12 21:59:54.338 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
javax.measure.format.MeasurementParseException: Parse Error
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixed(CommonFormatter.java:109) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixedAsLeading(CommonFormatter.java:138) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:207) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:224) ~[?:?]
        at tech.units.indriya.quantity.Quantities.getQuantity(Quantities.java:85) ~[?:?]
        at org.openhab.core.types.util.UnitUtils.parseUnit(UnitUtils.java:166) ~[?:?]
        at org.openhab.core.internal.items.ItemStateConverterImpl.parseItemUnit(ItemStateConverterImpl.java:129) ~[?:?]
        at org.openhab.core.internal.items.ItemStateConverterImpl.convertToAcceptedState(ItemStateConverterImpl.java:79) ~[?:?]
        at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.sendUpdate(ProfileCallbackImpl.java:121) ~[?:?]
        at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onStateUpdateFromHandler(SystemDefaultProfile.java:53) ~[?:?]
        at org.openhab.core.thing.internal.CommunicationManager.lambda$11(CommunicationManager.java:518) ~[?:?]
        at org.openhab.core.thing.internal.CommunicationManager.lambda$13(CommunicationManager.java:538) ~[?:?]
        at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
        at org.openhab.core.thing.internal.CommunicationManager.handleCallFromHandler(CommunicationManager.java:534) ~[?:?]
        at org.openhab.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:516) ~[?:?]
        at org.openhab.core.thing.internal.ThingManagerImpl$1.stateUpdated(ThingManagerImpl.java:176) ~[?:?]
        at org.openhab.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:231) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler.updateDailyForecastChannel(OpenWeatherMapOneCallHandler.java:665) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapOneCallHandler.updateChannel(OpenWeatherMapOneCallHandler.java:239) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateChannels(AbstractOpenWeatherMapHandler.java:166) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.AbstractOpenWeatherMapHandler.updateData(AbstractOpenWeatherMapHandler.java:137) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThing(OpenWeatherMapAPIHandler.java:176) ~[?:?]
        at org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler.updateThings(OpenWeatherMapAPIHandler.java:167) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
2021-05-12 22:00:09.243 [ERROR] [ence.internal.PersistenceManagerImpl] - bundle org.openhab.core.persistence:3.1.0.202105120641 (210)[org.openhab.core.persistence.internal.PersistenceManagerImpl(211)] : The addPersistenceService method has thrown an exception
javax.measure.format.MeasurementParseException: Parse Error
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixed(CommonFormatter.java:109) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixedAsLeading(CommonFormatter.java:138) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:207) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:224) ~[?:?]
        at tech.units.indriya.quantity.Quantities.getQuantity(Quantities.java:85) ~[?:?]
        at org.openhab.core.types.util.UnitUtils.parseUnit(UnitUtils.java:166) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:203) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:161) ~[?:?]
        at org.openhab.core.library.items.NumberItem.setState(NumberItem.java:110) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.initialize(PersistenceManagerImpl.java:302) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.startEventHandling(PersistenceManagerImpl.java:419) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.addPersistenceService(PersistenceManagerImpl.java:126) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:244) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:685) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:529) [bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:2083) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:2058) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:443) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:333) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:301) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1200) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1121) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:928) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:864) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1152) [bundleFile:?]
        at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:114) [bundleFile:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:120) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:957) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:936) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:873) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:141) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:261) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:496) [org.eclipse.osgi-3.16.200.jar:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:929) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:915) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:984) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:752) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:674) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:437) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:667) [bundleFile:?]
        at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:305) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:554) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator.access$200(Activator.java:70) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:421) [bundleFile:?]
        at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) [bundleFile:?]
        at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) [bundleFile:?]
        at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) [bundleFile:?]
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) [osgi.core-7.0.0.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:945) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:232) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:138) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:130) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:217) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.Module.publishEvent(Module.java:499) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.Module.start(Module.java:486) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.16.200.jar:?]
2021-05-12 22:00:10.360 [ERROR] [ence.internal.PersistenceManagerImpl] - bundle org.openhab.core.persistence:3.1.0.202105120641 (210)[org.openhab.core.persistence.internal.PersistenceManagerImpl(211)] : The addPersistenceService method has thrown an exception
javax.measure.format.MeasurementParseException: Parse Error
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.check(SimpleUnitFormat.java:631) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseSingleUnit(SimpleUnitFormat.java:486) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:505) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:293) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:834) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:829) ~[?:?]
        at tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:825) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixed(CommonFormatter.java:109) ~[?:?]
        at tech.units.indriya.format.CommonFormatter.parseMixedAsLeading(CommonFormatter.java:138) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:207) ~[?:?]
        at tech.units.indriya.format.SimpleQuantityFormat.parse(SimpleQuantityFormat.java:224) ~[?:?]
        at tech.units.indriya.quantity.Quantities.getQuantity(Quantities.java:85) ~[?:?]
        at org.openhab.core.types.util.UnitUtils.parseUnit(UnitUtils.java:166) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:203) ~[?:?]
        at org.openhab.core.library.items.NumberItem.getUnit(NumberItem.java:161) ~[?:?]
        at org.openhab.core.library.items.NumberItem.setState(NumberItem.java:119) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.initialize(PersistenceManagerImpl.java:302) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.startEventHandling(PersistenceManagerImpl.java:419) ~[?:?]
        at org.openhab.core.persistence.internal.PersistenceManagerImpl.addPersistenceService(PersistenceManagerImpl.java:126) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:244) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:685) ~[bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:529) [bundleFile:?]
        at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:2083) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:2058) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:443) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:333) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:301) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1200) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1121) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:928) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:864) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1152) [bundleFile:?]
        at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:114) [bundleFile:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:120) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:957) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.16.200.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:936) [org.eclipse.osgi-3.16.200.jar:?]

t-8ch added a commit to t-8ch/openhab-binding-wmbus that referenced this pull request May 16, 2021
fwolter pushed a commit to fwolter/openhab-core that referenced this pull request May 24, 2021
Upgrades UoM dependencies to:

* javax.measure 2.1.2
* si-units 2.0.1
* indriya 2.1.2

An openHAB OSGi-ified si-units bundle is used as runtime dependency, because the latest si-units release is still missing proper OSGi manifest headers.

Notable changes:

* Quantity not longer implements an `equals` method, so the unit tests had to be adjusted. This should have any impact outside of the unit tests though since the rest of openHAB should be using QuantityType instead.
* RationalConverter is not package private, so instances of it much be created through the MultiplyConverter static functions.
* Quantities.getQuantity can no longer parse values without units like `100`. A workaround has been implemented.
* The unicode greek `mu` letter is now returned for unit prefixes instead of the unicode `micro` character. These characters are visually identical but the unit tests had to be adjusted. The new library seems to parse both types just fine.

Also-by: Connor Petty <[email protected]>
Signed-off-by: Wouter Born <[email protected]>
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/resol-binding-stopped-working-in-recent-nightly-builds/122371/4

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-3-1-milestone-discussion/116025/181

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/broadlink-binding-for-rmx-a1-spx-and-mp-any-interest/22768/1392

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/bug-hydrawise-binding-scheduled-runnable-ended-with-an-exception/98013/11

quantity = (Quantity<T>) Quantities.getQuantity(formatted);
if (!formatted.contains(" ")) {
BigDecimal bd = new BigDecimal(value);
quantity = (Quantity<T>) Quantities.getQuantity(bd, AbstractUnit.ONE, Scale.RELATIVE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wborn, do you remember why you picked Scale.RELATIVE here? While reviewing #3177 I found that the default is Scale.ABSOLUTE but we explicitly set it to a different value. Instinctively I would have chosen Scale.ABSOLUTE because that is what we usually get when we talk e.g. about temperatures.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC such a change would cause a lot more rules to break.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to suggest changing it. I was just wondering if this was a deliberate decision or not. Because #3177 only works because of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there was no legacy code and there were no openHAB users I would also opt for using all the default behaviors. 🙂

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 11, 2023
Upgrades UoM dependencies to:

* javax.measure 2.1.2
* si-units 2.0.1
* indriya 2.1.2

An openHAB OSGi-ified si-units bundle is used as runtime dependency, because the latest si-units release is still missing proper OSGi manifest headers.

Notable changes:

* Quantity not longer implements an `equals` method, so the unit tests had to be adjusted. This should have any impact outside of the unit tests though since the rest of openHAB should be using QuantityType instead.
* RationalConverter is not package private, so instances of it much be created through the MultiplyConverter static functions.
* Quantities.getQuantity can no longer parse values without units like `100`. A workaround has been implemented.
* The unicode greek `mu` letter is now returned for unit prefixes instead of the unicode `micro` character. These characters are visually identical but the unit tests had to be adjusted. The new library seems to parse both types just fine.

Also-by: Connor Petty <[email protected]>
Signed-off-by: Wouter Born <[email protected]>
GitOrigin-RevId: 9130799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API breaking dependencies Pull requests that update a dependency file enhancement An enhancement or new feature of the Core UoM Units of Measurement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants