kazu2012 / persevere-framework

Automatically exported from code.google.com/p/persevere-framework
0 stars 0 forks source link

clearTimeout causes a NullPointerException for timeouts that have already passed. #276

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set a timer with setTimeout, and store the returned object:
var timer = setTimeout(function() {}, 100);
2. Clear the timer after the tiemout has passed:
clearTimeout(timer);

What is the expected output? What do you see instead?
Expected: Timer is cleared without problems. Instead, a NullPointerException is 
thrown.

What version of the product are you using? On what operating system?
1.0.2rc1 on Lucid Lynx (Ubuntu 10.04)

Please provide any additional information below.
clearTimeout (clearTimer in the Java code) doesn't check whether 
GlobalData.currentQueuedTasks.remove() returns null (which it would if the task 
has run, since TimerTask.run removes the timer from currentQueuedTasks).

Attached is a patch to fix this.

Original issue reported on code.google.com by remoun.metyas on 30 Jul 2010 at 12:02

Attachments: