farhanrahman / kyoto

18 stars 7 forks source link

Carbon Target NullPointer #97

Closed tumblerer closed 12 years ago

tumblerer commented 12 years ago

Carbon target sometimes seems to throw a null pointer exception. Simulation was run for 20 years.

1666 [main] WARN  uk.ac.imperial.presage2.core.event.EventBusImpl  - Exception when invoking EventListener uk.ac.ic.kyoto.countries.CarbonTarget@e020c9 with event uk.ac.ic.kyoto.services.GlobalTimeService$EndOfYearCycle@15983b7
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at uk.ac.imperial.presage2.core.event.EventBusImpl.publish(EventBusImpl.java:139)
    at uk.ac.ic.kyoto.services.GlobalTimeService.updateTickCounter(GlobalTimeService.java:62)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at uk.ac.imperial.presage2.core.event.EventBusImpl.publish(EventBusImpl.java:139)
    at uk.ac.imperial.presage2.core.simulator.MultiThreadedSimulator.run(MultiThreadedSimulator.java:271)
    at uk.ac.imperial.presage2.core.simulator.RunnableSimulation.run(RunnableSimulation.java:396)
    at uk.ac.imperial.presage2.core.simulator.RunnableSimulation.main(RunnableSimulation.java:487)
Caused by: java.lang.NullPointerException
    at uk.ac.ic.kyoto.countries.CarbonTarget.getReportedCarbonOutput(CarbonTarget.java:176)
    at uk.ac.ic.kyoto.countries.CarbonTarget.updateSessionTargets(CarbonTarget.java:251)
    at uk.ac.ic.kyoto.countries.CarbonTarget.updateYearTargets(CarbonTarget.java:212)
    at uk.ac.ic.kyoto.countries.CarbonTarget.onEndOfYear(CarbonTarget.java:202)
    ... 12 more
tumblerer commented 12 years ago

Appears to be everywhere timeservice is used.

jjonnnyy commented 12 years ago

From that stack trace it appears the error is due to not being able to find the necessary carbon report.

Sergeus commented 12 years ago

Fixed, because BLAM!