Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2685

MixedParamsUrlCodingStrategy ,classcastexception from Long to String

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.5
    • 1.4.6
    • wicket
    • None
    • wicket 1.4.5,jetty 6.1.22

    Description

      i see classcastexception can't cast from Long to String at this line in a page(the url does not have page parameters) at line number 138 in mixedparameterurlcodingstrategy,

      String value = param instanceof String[] ? ((String[])param)[0] : (String)param;//line number 138
      cast in else can be clearly avoided,
      String value = param instanceof String[] ? ((String[])param)[0] : param.toString();// ie. cast changed to tostring()

      i tested that on my custommixed*strategy in which above mentioned is the only change,
      everything appears to be working,

      original exception in mixedparamurlcodingstrategy i got is as following :-

      java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
      at org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.appendParameters(MixedParamUrlCodingStrategy.java:138)
      at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.encode(BookmarkablePageRequestTargetUrlCodingStrategy.java:149)
      at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.pathForTarget(WebRequestCodingStrategy.java:491)
      at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.encode(WebRequestCodingStrategy.java:250)
      at org.apache.wicket.RequestCycle.encodeUrlFor(RequestCycle.java:811)
      at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:999)
      at org.apache.wicket.Component.urlFor(Component.java:3316)
      at org.apache.wicket.markup.html.link.BookmarkablePageLink.getURL(BookmarkablePageLink.java:276)
      at org.apache.wicket.markup.html.link.Link.onComponentTag(Link.java:408)
      at org.apache.wicket.Component.renderComponent(Component.java:2590)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1414)
      at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
      at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1501)
      at org.apache.wicket.Component.renderComponent(Component.java:2619)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(AbstractRepeater.java:122)
      at org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:103)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1414)
      at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
      at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:675)
      at org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:114)
      at org.apache.wicket.Component.renderComponent(Component.java:2619)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1414)
      at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
      at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1501)
      at org.apache.wicket.Component.renderComponent(Component.java:2619)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
      at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:66)
      at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1418)
      at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
      at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1501)
      at org.apache.wicket.Component.renderComponent(Component.java:2619)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
      at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:73)
      at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1418)
      at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1577)
      at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1501)
      at org.apache.wicket.Component.renderComponent(Component.java:2619)
      at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1414)
      at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1528)
      at org.apache.wicket.Page.onRender(Page.java:1545)
      at org.apache.wicket.Component.render(Component.java:2450)
      at org.apache.wicket.Page.renderPage(Page.java:914)
      at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
      at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
      at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
      at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:538)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            vineetsemwal vineet semwal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: