-
Bug
-
Resolution: Done
-
Major
-
JBossAS-4.0.3 SP1, JBossAS-4.0.4RC1, JBossAS-3.2.8 Final
-
None
We are using the org.jboss.varia.scheduler.ScheduleManager class, and have been getting ClassCastExceptions. Looking at the code, I can see why. There are a number of places where there is code like this:
Iterator i = mSchedules.entrySet().iterator();
while (i.hasNext()) {
ScheduleInstance lInstance = (ScheduleInstance) i.next();
...
Unless the mSchedules map is empty, this code is going to throw a ClassCastException every time, because the entrySet method on a Map produces a set of Map.Entry objects. The code should say something line the following instead:
Iterator i = mSchedules.values().iterator();
while (i.hasNext()) {
ScheduleInstance lInstance = (ScheduleInstance) i.next();
...
If you need the key and the value, you would do something like:
Iterator i = mSchedules.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
Integer id = (Integer) entry.getKey();
ScheduleInstance lInstance = (ScheduleInstance) entry.getValue();
...
- is duplicated by
-
JBAS-2615 error using schedule-manager-service.xml at the boot in mode 'all'
- Closed