Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-375

IndexOutOfBoundsException when mapping filters by servlet name and url pattern.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.3.Final, 1.2.0.Beta9
    • 1.2.0.Beta9
    • None
    • None

      I have a sample Spring Boot application (available at https://github.com/dankelleher/UndertowFilterTester) which registers programmatically (no web.xml) two filters, one mapped by servlet name, and one by url pattern.

      On startup I get the following exception:

      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
      at java.lang.Thread.run(Thread.java:744)
      Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index: 4, Size: 0
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:688)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:947)
      at Example.main(Example.java:22)
      ... 6 more
      Caused by: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index: 4, Size: 0
      at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:222)
      at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.createDeploymentManager(UndertowEmbeddedServletContainerFactory.java:344)
      at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.getEmbeddedServletContainer(UndertowEmbeddedServletContainerFactory.java:204)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
      ... 13 more
      Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 0
      at java.util.ArrayList.rangeCheckForAdd(ArrayList.java:643)
      at java.util.ArrayList.add(ArrayList.java:455)
      at io.undertow.servlet.api.DeploymentInfo.insertFilterServletNameMapping(DeploymentInfo.java:354)
      at io.undertow.servlet.spec.ServletContextImpl.addMappingForServletNames(ServletContextImpl.java:836)
      at io.undertow.servlet.spec.FilterRegistrationImpl.addMappingForServletNames(FilterRegistrationImpl.java:54)
      at org.springframework.boot.context.embedded.FilterRegistrationBean.configure(FilterRegistrationBean.java:287)
      at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:256)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:222)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:84)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:206)
      at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory$Initializer.onStartup(UndertowEmbeddedServletContainerFactory.java:517)
      at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:182)
      ... 17 more

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              dankelleher_jira Daniel Kelleher (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: