RE: IllegalArgumentException Exception in URLDecoder
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Christian, At 04:19 PM 7/31/2003 -0600, you wrote: > > Ahhhh..... Ok, that makes sense. So, Kirk, when the decode > > fails, but is > > caught, is the queryString valid? If so, then I think I'll just add the > > try/catch as you've suggested unless anyone else has objections (better > > speak up soon, if so). > >I'm ok with this... Already been done. Jake >---------------------------------------------- >Christian Cryder >Internet Architect, ATMReports.com >Project Chair, BarracudaMVC - http://barracudamvc.org >---------------------------------------------- >"Coffee? I could quit anytime, just not today" > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]]On Behalf Of Jacob Kjome > > Sent: Thursday, July 31, 2003 7:57 AM > > To: [email protected] > > Subject: RE: [Barracuda] IllegalArgumentException Exception in > > URLDecoder > > > > > > At 10:19 AM 7/31/2003 +0200, you wrote: > > >Hi Jake, > > > > > > >>Also, shouldn't we be using the non-deprecated method where > > we include the > > >encoding? > > >The method was deprecated between JDK 1.3 and 1.4. > > >I suppose it's just there to keep support for 1.3. > > > > Ahhhh..... Ok, that makes sense. So, Kirk, when the decode > > fails, but is > > caught, is the queryString valid? If so, then I think I'll just add the > > try/catch as you've suggested unless anyone else has objections (better > > speak up soon, if so). > > > > Jake > > > > > > >-----Original Message----- > > >From: Jacob Kjome [mailto:[email protected]] > > >Sent: 30 July 2003 06:10 > > >To: [email protected] > > >Subject: RE: [Barracuda] IllegalArgumentException Exception in > > >URLDecoder > > > > > > > > >Hi Kirk, > > > > > >Looks like something like that was already done before and reverted by > > >Christian for reasons that aren't documented. The question is, if this > > >happens, what state is the "queryString" variable in? Does this meet url > > >encoding spec requirements? I'm no expert in this area. If anyone has > > >something to say about this, please speak up. In general, I > > think catching > > >the exception is probably a good thing even if it results in a > > string that > > >might not exactly match up with a the specs. > > > > > >Here is what was commented out... > > > > > > try { > > > queryString = > > >java.net.URLDecoder.decode(queryString, "UTF-8"); > > > } catch (UnsupportedEncodingException e) { > > > System.out.println("Encoding Exception: "+e); > > > e.printStackTrace(); > > > } > > > > > >Here is what replaced it... > > > > > > queryString = > > java.net.URLDecoder.decode(queryString); > > > > > > > > >Maybe it was reverted to much? There are still runtime > > exceptions that can > > >be thrown whether or not the method states one will be thrown. Also, > > >shouldn't we be using the non-deprecate method where we include the > > >encoding? It was done in the commented out code. What was the > > regression > > >that was seen? > > > > > >Besides this, here is a case where the servlet-2.3 class > > >javax.servlet.http.HttpServletRequestWrapper could really help out. We > > >wouldn't even need to implement methods we really don't care about > > >including this one. I think we need to make the move to servlet-2.3 at > > >some point. Servlet-2.2 is very limiting. > > > > > >Jake > > > > > > > > >At 02:11 PM 7/30/2003 +0200, you wrote: > > > >To reply to my own mail.. > > > > > > > >I put a empty try/catch block around the respective code... > > > >and just ignored the exception when it arose.. > > > > > > > >ok.. it's a hack.. but at least it's not fallin over now.. > > > > > > > >try { > > > > queryString = java.net.URLDecoder.decode(queryString); > > > >} catch (Exception e) {} > > > > > > > >-----Original Message----- > > > >From: Kirk Daries [mailto:[email protected]] > > > >Sent: 30 July 2003 02:01 > > > >To: [email protected] > > > >Subject: [Barracuda] IllegalArgumentException Exception in URLDecoder > > > > > > > > > > > >Hi Guys, > > > > > > > >I'm running into a exception... > > > > > > > >Basically... when I submit any text containing the symbol '%', it falls > > > >over. > > > >E.g. > > > >req.getQueryString() is: p_comments=Test+%25 > > > > > > > >Which is "Test %" > > > > > > > >I've traced it to the HttpServletRequestWrapper class, line 398. > > > > > > > >Which says, > > > >queryString = java.net.URLDecoder.decode(queryString); > > > > > > > >I think the decode function is attempting to 'decode' the > > string a second > > > >time.. > > > > > > > >Help? > > > >Regards > > > >KD > > > > > > > >java.lang.IllegalArgumentException: URLDecoder: Illegal hex > > characters in > > > >escape (%) pattern - For input string: "&p" > > > > at java.net.URLDecoder.decode(URLDecoder.java:168) > > > > at java.net.URLDecoder.decode(URLDecoder.java:82) > > > > at > > > > > >org.enhydra.barracuda.core.helper.servlet.HttpServletRequestWrapp > > er.getPara > > >m > > > >eter(HttpServletRequestWrapper.java:398) > > > > at > > > > > >org.enhydra.barracuda.core.event.DefaultEventContext.restoreConte > > xt(Default > > >E > > > >ventContext.java:224) > > > > at > > > > > >org.enhydra.barracuda.core.event.DefaultEventContext.(DefaultEven > > tContext.j > > >a > > > >va:74) > > > > at > > > > > >org.enhydra.barracuda.core.event.ApplicationGateway.handleDefault > > Ext(Applic > > >a > > > >tionGateway.java:398) > > > > at > > > > > >org.enhydra.barracuda.core.event.ApplicationGateway.handleDefault > > (Applicati > > >o > > > >nGateway.java:234) > > > > at > > > > > >org.enhydra.barracuda.core.event.ApplicationGateway.doGet(Applica > > tionGatewa > > >y > > > >.java:717) > > > > at > > javax.servlet.http.HttpServlet.service(HttpServlet.java:740) > > > > at > > javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > > > > at > > > > > >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > > Applicatio > > >n > > > >FilterChain.java:247) > > > > at > > > > > >org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicat > > ionFilterC > > >h > > > >ain.java:193) > > > > at > > > > > >org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrap > > perValve.j > > >a > > > >va:256) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:643) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline > > .java:480) > > > > at > > > >org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > > > at > > > > > >org.apache.catalina.core.StandardContextValve.invoke(StandardCont > > extValve.j > > >a > > > >va:191) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:643) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline > > .java:480) > > > > at > > > >org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > > > at > > > > > >org.apache.catalina.core.StandardContext.invoke(StandardContext.j > > ava:2415) > > > > at > > > > > >org.apache.catalina.core.StandardHostValve.invoke(StandardHostVal > > ve.java:18 > > >0 > > > >) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:643) > > > > at > > > > > >org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispa > > tcherValve > > >. > > > >java:171) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:641) > > > > at > > > > > >org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportVal > > ve.java:17 > > >2 > > > >) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:641) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline > > .java:480) > > > > at > > > >org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > > > at > > > > > >org.apache.catalina.core.StandardEngineValve.invoke(StandardEngin > > eValve.jav > > >a > > > >:174) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline$StandardPipelineValveCo > > ntext.invo > > >k > > > >eNext(StandardPipeline.java:643) > > > > at > > > > > >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline > > .java:480) > > > > at > > > >org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > > > > at > > > >org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) > > > > at > > > > > >org.apache.coyote.http11.Http11Processor.process(Http11Processor. > > java:594) > > > > at > > > > > >org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.p > > rocessConn > > >e > > > >ction(Http11Protocol.java:392) > > > > at > > > > > >org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint. > > java:565) > > > > at > > > > > >org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Thr > > eadPool.ja > > >v > > > >a:619) > > > > at java.lang.Thread.run(Thread.java:534) > > > > > > > >_______________________________________________ > > > >Barracuda mailing list > > > >[email protected] > > > >http://barracudamvc.org/lists/listinfo/barracuda > > > >_______________________________________________ > > > >Barracuda mailing list > > > >[email protected] > > > >http://barracudamvc.org/lists/listinfo/barracuda > > > > > >_______________________________________________ > > >Barracuda mailing list > > >[email protected] > > >http://barracudamvc.org/lists/listinfo/barracuda > > >_______________________________________________ > > >Barracuda mailing list > > >[email protected] > > >http://barracudamvc.org/lists/listinfo/barracuda > > > > _______________________________________________ > > Barracuda mailing list > > [email protected] > > http://barracudamvc.org/lists/listinfo/barracuda > >_______________________________________________ >Barracuda mailing list >[email protected] >http://barracudamvc.org/lists/listinfo/barracuda