I'm having a problem debugging an application which uses an iterator to cycle through the entries in a beanmap. When I use the remove() function on the iterator, the application crashes, and I cannot figure out why. It used to work fine.
The application has been running fine for over a year now without any issues. Perhaps the .remove() function was never really called as it is inside an if clause, but I still think it should work fine.
Here's the code:
BeanMap bm = new BeanMap(pKzlGd);
        Iterator entries = bm.entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) entries.next();
            if (entry.getValue() instanceof Class) {
                entries.remove();
            }
        }
This is basically the StackTrace error I get:
Stack trace: javax.faces.FacesException: #{aopUpload.upload}: java.lang.UnsupportedOperationException: remove() is not supported
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
         at si.nkbm.bilbon.net.ExceptionActionListener.processAction(ExceptionActionListener.java:24)
         at javax.faces.component.UICommand.broadcast(UICommand.java:387)
         at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:170)
         at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
         at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
         at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
         at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
 
    