eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 787 forks source link

[astro] throws exception on new moon #6808

Closed ggzengel closed 5 years ago

ggzengel commented 5 years ago

I use OH2.4.0

I saw this exception:

20:18:27.449 [ERROR] [nding.astro.handler.AstroThingHandler] - Can't update state for channel astro:moon:home:phase#ageDegree : null
java.lang.reflect.InvocationTargetException: null
    at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:98) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:100) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:88) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getState(PropertyUtils.java:53) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishChannelIfLinked(AstroThingHandler.java:156) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishPlanet(AstroThingHandler.java:139) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.MoonHandler.publishPositionalInfo(MoonHandler.java:60) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.job.PositionalJob.run(PositionalJob.java:45) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.NumberFormatException
    at java.math.BigDecimal.<init>(BigDecimal.java:494) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:383) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:806) ~[?:?]
    at org.eclipse.smarthome.core.library.types.QuantityType.<init>(QuantityType.java:109) ~[?:?]
    at org.eclipse.smarthome.binding.astro.internal.model.MoonPhase.getAgeDegree(MoonPhase.java:147) ~[?:?]
    ... 18 more
20:18:27.456 [ERROR] [nding.astro.handler.AstroThingHandler] - Can't update state for channel astro:moon:home:phase#agePercent : null
java.lang.reflect.InvocationTargetException: null
    at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:98) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:100) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:88) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getState(PropertyUtils.java:53) ~[200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishChannelIfLinked(AstroThingHandler.java:156) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishPlanet(AstroThingHandler.java:139) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.handler.MoonHandler.publishPositionalInfo(MoonHandler.java:60) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at org.eclipse.smarthome.binding.astro.internal.job.PositionalJob.run(PositionalJob.java:45) [200:org.eclipse.smarthome.binding.astro:0.10.0.oh240]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.NumberFormatException
    at java.math.BigDecimal.<init>(BigDecimal.java:494) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:383) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:806) ~[?:?]
    at org.eclipse.smarthome.core.library.types.QuantityType.<init>(QuantityType.java:109) ~[?:?]
    at org.eclipse.smarthome.binding.astro.internal.model.MoonPhase.getAgePercent(MoonPhase.java:161) ~[?:?]
    ... 18 more
maggu2810 commented 5 years ago

Would be interesting to knwo which arguments org.eclipse.smarthome.binding.astro.internal.model.MoonPhase.getAgeDegree(MoonPhase.java:147) is using to call org.eclipse.smarthome.core.library.types.QuantityType.<init>(QuantityType.java:109).

Can you set a break point and post that information?

ggzengel commented 5 years ago

It's a live system and error is gone now until next new moon.

cweitkamp commented 5 years ago

Is this a duplicate of #6693?

ggzengel commented 5 years ago

Is this a duplicate of #6693?

No, it works until new moon.

cweitkamp commented 5 years ago

No, it works until new moon.

Alright. I will set-up a test scenario in my environment. And try to reproduce it. Unfortunately we have to wait a little bit next new moon will be in four weeks.

cweitkamp commented 5 years ago

The calculation results in Double.POSITIVE_INFINITY ("Infinity" after converting to String) which cannot be parsed correctly.

https://github.com/eclipse/smarthome/blob/b8455de15d65512e8fac4e94d42de6ab2fccf1c5/extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/calc/MoonCalc.java#L132

Will be closed by https://github.com/openhab/openhab2-addons/pull/5692.

J-N-K commented 5 years ago

Fixed. Can be closed.

ggzengel commented 5 years ago

Thanks for fixing.