RE: IllegalArgumentException Exception in URLDecoder

Kirk Daries <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <D09B591872D1D611AF2B0010B5A1AAD0914AD2@WCSMAIL>
Hi Jake,
Yep, the query string is valid...
Being working all day....on production like that.

I suggest logging a WARN just in case.
Never a good idea to have the exception 'disappear'.

Fire away! ;)

Regards
KD

-----Original Message-----
From: Jacob Kjome [mailto:[email protected]]
Sent: 31 July 2003 03:57
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.HttpServletRequestWrapper.getPara
>m
> >eter(HttpServletRequestWrapper.java:398)
> >         at
>
>org.enhydra.barracuda.core.event.DefaultEventContext.restoreContext(Default
>E
> >ventContext.java:224)
> >         at
>
>org.enhydra.barracuda.core.event.DefaultEventContext.(DefaultEventContext.j
>a
> >va:74)
> >         at
>
>org.enhydra.barracuda.core.event.ApplicationGateway.handleDefaultExt(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(ApplicationGatewa
>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(ApplicationFilterC
>h
> >ain.java:193)
> >         at
>
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
>a
> >va:256)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.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(StandardContextValve.j
>a
> >va:191)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.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.java:2415)
> >         at
>
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:18
>0
> >)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo
>k
> >eNext(StandardPipeline.java:643)
> >         at
>
>org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve
>.
> >java:171)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo
>k
> >eNext(StandardPipeline.java:641)
> >         at
>
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:17
>2
> >)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.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(StandardEngineValve.jav
>a
> >:174)
> >         at
>
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.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.processConn
>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(ThreadPool.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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.