Wicket
  1. Wicket
  2. WICKET-524

ClassCastException in WebRequestCodingStrategy

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.2.6
    • Fix Version/s: 1.2.7
    • Component/s: wicket
    • Labels:
      None

      Description

      I upgraded to 1.2.6 and am getting a ClassCastException on line 161 of WebRequestCodingStrategy. When it calls request.getParameter(BEHAVIOR_ID_PARAMETER_NAME) it is expecting a String, but it is returning a String array so I get a classcastexception. I am using CryptedUrlWebRequestCodingStrategy to build the URLs. The actual bug appears to be in the WebRequest because it casts to a String which is incorrect, since the actual parameter is a String array.

        Issue Links

          Activity

          Hide
          Jean-Baptiste Quenot added a comment -

          This is fixed by Igor already, in a similar way (but more simple) as the patch I submitted in this issue.

          Show
          Jean-Baptiste Quenot added a comment - This is fixed by Igor already, in a similar way (but more simple) as the patch I submitted in this issue.
          Hide
          Eelco Hillenius added a comment -

          You want to have this one JBQ? Or are there conflicting issues?

          Show
          Eelco Hillenius added a comment - You want to have this one JBQ? Or are there conflicting issues?
          Hide
          Andrew Berman added a comment -

          The patch works. Once I get some time I'll try to write up a test class which can replicate the issue, I hope.

          Thanks!

          Show
          Andrew Berman added a comment - The patch works. Once I get some time I'll try to write up a test class which can replicate the issue, I hope. Thanks!
          Hide
          Jean-Baptiste Quenot added a comment -

          Please try the attached patch. (This is a workaround)

          $ cd wicket-1.2.6/wicket
          $ patch < ~/20070511-wicket126-CryptedUrlWebRequestCodingStrategy-StringArray.txt
          $ mvn install

          Show
          Jean-Baptiste Quenot added a comment - Please try the attached patch. (This is a workaround) $ cd wicket-1.2.6/wicket $ patch < ~/20070511-wicket126-CryptedUrlWebRequestCodingStrategy-StringArray.txt $ mvn install
          Hide
          Andrew Berman added a comment -

          Here is the stacktrace. I'm still working on some code to give you, but maybe this will help in the meantime.

          java.lang.ClassCastException: [Ljava.lang.String;
          at wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy$DecodedUrlRequest.getParameter(CryptedUrlWebRequestCodingStrategy.java:432)
          at wicket.protocol.http.request.WebRequestCodingStrategy.decode(WebRequestCodingStrategy.java:161)
          at wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy.decode(CryptedUrlWebRequestCodingStrategy.java:98)
          at wicket.Request.getRequestParameters(Request.java:163)
          at wicket.RequestCycle.step(RequestCycle.java:992)
          at wicket.RequestCycle.steps(RequestCycle.java:1084)
          at wicket.RequestCycle.request(RequestCycle.java:454)
          at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
          at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
          at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
          at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
          at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
          at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
          at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
          at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
          at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
          at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
          at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
          at java.lang.Thread.run(Thread.java:595)

          Show
          Andrew Berman added a comment - Here is the stacktrace. I'm still working on some code to give you, but maybe this will help in the meantime. java.lang.ClassCastException: [Ljava.lang.String; at wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy$DecodedUrlRequest.getParameter(CryptedUrlWebRequestCodingStrategy.java:432) at wicket.protocol.http.request.WebRequestCodingStrategy.decode(WebRequestCodingStrategy.java:161) at wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy.decode(CryptedUrlWebRequestCodingStrategy.java:98) at wicket.Request.getRequestParameters(Request.java:163) at wicket.RequestCycle.step(RequestCycle.java:992) at wicket.RequestCycle.steps(RequestCycle.java:1084) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:178) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)
          Hide
          Andrew Berman added a comment -

          I'm using the CryptURL class so the URL will just be ?x=....

          Show
          Andrew Berman added a comment - I'm using the CryptURL class so the URL will just be ?x=....
          Hide
          Jean-Baptiste Quenot added a comment -

          Can you please provide the requested URL? Are there duplicated parameters? If this is the case it should not happen.

          Show
          Jean-Baptiste Quenot added a comment - Can you please provide the requested URL? Are there duplicated parameters? If this is the case it should not happen.
          Hide
          Andrew Berman added a comment -

          Eelco, I don't know when I can get you a unit test, but I can give you some more info. It happens on AjaxLinks and AjaxButtons and only with the Ajax stuff. When I click one of the links, it doesn't work and I get the ClassCastException, so there seems to be some sort of incompatibility between the Ajax calls and any changes that were made between 1.2.5. and 1.2.6. Hope this helps a bit.

          Show
          Andrew Berman added a comment - Eelco, I don't know when I can get you a unit test, but I can give you some more info. It happens on AjaxLinks and AjaxButtons and only with the Ajax stuff. When I click one of the links, it doesn't work and I get the ClassCastException, so there seems to be some sort of incompatibility between the Ajax calls and any changes that were made between 1.2.5. and 1.2.6. Hope this helps a bit.
          Hide
          Andrew Berman added a comment -

          I'll see what I can do.

          Show
          Andrew Berman added a comment - I'll see what I can do.
          Hide
          Eelco Hillenius added a comment -

          It would help to have a unit test for this. Currently there is none, and wicket-examples has signin2 which uses CryptedUrlWebRequestCodingStrategy but doesn't fail.

          Andrew, you think you could provide me with a test (attach to this issue) that proves your problem? And/ or a complete stack trace would help.

          Cheers.

          Show
          Eelco Hillenius added a comment - It would help to have a unit test for this. Currently there is none, and wicket-examples has signin2 which uses CryptedUrlWebRequestCodingStrategy but doesn't fail. Andrew, you think you could provide me with a test (attach to this issue) that proves your problem? And/ or a complete stack trace would help. Cheers.

            People

            • Assignee:
              Eelco Hillenius
              Reporter:
              Andrew Berman
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development