gok03 / rosjava

Automatically exported from code.google.com/p/rosjava
0 stars 0 forks source link

NullPointerException in ClockTopicTimeProvider due to synchronizing with null #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using turtlebot_simulator and try to get the odom position. However, when 
trying to subscribe to a topic, I will get a NullPointerException from 
ClockTopicTimeProvider. It's in line 45:

synchronized (clock) {
   clock = message;
}

This throws the exception, since clock is null at the first time this block is 
executed.

Thanks

Original issue reported on code.google.com by DenisSta...@gmail.com on 5 Jun 2012 at 6:54

GoogleCodeExporter commented 9 years ago
I suspect this has the same cause as a problem I've just encountered (I'll 
submit an issue later). I see the same exception, but I'm using a different 
(not ROS-affiliated) simulator and setting up my own TimeProvider, so the 
following may not apply to your situation.

In the rosjava package, in file 'org/ros/internal/node/DefaultNode.java', the 
'start()' method checks to see if 'useSimTime' is set; if it is, a new 
ClockTopicTimeProvider is created. In my case, essentially ignoring the 'if 
(useSimTime)' block does the trick, as I neither need, want, nor use a 
ClockTopicTimeProvider instance.

Original comment by jkramert...@gmail.com on 11 Jun 2012 at 2:59

GoogleCodeExporter commented 9 years ago
Issue 120 has been merged into this issue.

Original comment by damonkoh...@google.com on 3 Jul 2012 at 8:24

GoogleCodeExporter commented 9 years ago
Fixed by dbd6845a3c3a

Original comment by damonkoh...@google.com on 3 Jul 2012 at 8:24