2 Replies Latest reply on Nov 27, 2012 2:59 AM by Sebastian Hort

    http-Parameter with empty value produces NoSuchElementException in FacesManager

    Sebastian Hort Newbie

      Hi,

       

      we use jboss seam 2.1.0 on jboss as 4.2.3.

       

      Now we run into this issue if the application is called with an empty http-Parametervalue like

       

      http://localhost:8080/application/?parametername

       

      we got the following exception:

       

      java.util.NoSuchElementException

                at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)

                at org.jboss.seam.faces.FacesManager.interpolateAndRedirect(FacesManager.java:91)

                at org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:36)

                at org.jboss.seam.navigation.Pages.handleOutcome(Pages.java:652)

                at org.jboss.seam.navigation.Page.preRender(Page.java:295)

                at org.jboss.seam.navigation.Pages.preRender(Pages.java:350)

                at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)

                at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)

                at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)

                at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)

                at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)

                at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)

                at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

                at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

                at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

                at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      <snip>

       

       

      the code inside the method interpolateAndRedirect is

       

      public void interpolateAndRedirect(String url)

         {

            Map<String, Object> parameters = new HashMap<String, Object>();

            int loc = url.indexOf('?');

            if (loc>0)

            {

               StringTokenizer tokens = new StringTokenizer( url.substring(loc), "?=&" );

               while ( tokens.hasMoreTokens() )

               {

      90            String name = tokens.nextToken();

      91            String value = Interpolator.instance().interpolate( tokens.nextToken() );

      92            parameters.put(name, value);

               }

               url = url.substring(0, loc);

            }

            redirect(url, parameters, true, true);

         }

       

      has somebody any idea why this error occours?

       

      thx!