Mantis - Quercus
Viewing Issue Advanced Details
5976 minor always 02-11-16 09:13 02-11-16 09:14
nam  
 
normal  
new  
open  
none    
none  
0005976: array out of bounds for WebApp.java ServletListener
(rep by zouzhir)

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:635) ~[na:1.7.0_67]
        at java.util.ArrayList.get(ArrayList.java:411) ~[na:1.7.0_67]
        at com.caucho.server.webapp.WebApp.hasListener(WebApp.java:2197) ~[resin.jar:4.0.47]
        at com.caucho.server.webapp.WebApp.addListenerObject(WebApp.java:2148) ~[resin.jar:4.0.47]
        at com.caucho.server.webapp.WebApp.addListener(WebApp.java:2108) ~[resin.jar:4.0.47]

In WebApp.java, hasListener() is using the wrong arraylist (_listeners vs listeners):

  public boolean hasListener(ArrayList<?> listeners, Class<?> listenerClass)
  {
    for (int i = 0; i < listeners.size(); i++) {
      Object listener = _listeners.get(i);

      if (listener.getClass().equals(listenerClass)) {
        return true;
      }
    }

    return false;
  }

There are no notes attached to this issue.