#4 % not working for axis

closed-fixed
David Gilbert
None
5
2008-06-26
2008-03-05
Anonymous
No

Inserting a % screws up axis strings. So something like "40%|50%|60%|70%|80%|90%|100%" will work for an axis in google's map api, it will not work on Eastwood.

Discussion

  • David Gilbert
    David Gilbert
    2008-06-12

    Logged In: YES
    user_id=112975
    Originator: NO

    Thanks for the report. I'm able to reproduce this, but it appears to be Tomcat failing to decode the parameters in the URL, because of some encoding issue that I don't understand yet. The Java code that configures the chart is fine with the percentage symbols, it's just that the servlet container isn't passing them over. I'll try to figure out how to fix that.

     
  • David Gilbert
    David Gilbert
    2008-06-12

    • assigned_to: nobody --> mungady
     
  • Logged In: NO

    This is the exception in the Tomcat logs:

    WARNING: Parameters: Character decoding failed. Parameter skipped.
    java.io.CharConversionException: isHexDigit
    at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
    at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
    at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:412)
    at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:394)
    at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:510)
    at org.apache.tomcat.util.http.Parameters.handleQueryParameters(Parameters.java:267)
    at org.apache.catalina.connector.Request.parseParameters(Request.java:2441)
    at org.apache.catalina.connector.Request.getParameterNames(Request.java:1082)
    at org.apache.catalina.connector.Request.getParameterMap(Request.java:1062)
    at org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:414)
    at org.jfree.eastwood.ChartServlet.doGet(ChartServlet.java:83)

     
  • Logged In: YES
    user_id=1101005
    Originator: NO

    The reason is that tomcat tries to URL decode the % and whatever comes after it. E.g. %20 => ' ', %30 => '0'. Since %| is an invalid encoded character tomcat throws an exception. The workaround is to use %25 instead of only %, e.g.: 40%25|50%25|60%25|70%25|80%25|90%25|100%25

    To make Eastwood handle this just like Google Chart does Eastwood would have to ignore the parameter map provided by the servlet container and instead parse the query string by itself. This code should handle proper %xx sequences but don't do anything with invalid sequences. This is how Google seem to do it. E.g. "40%20%|60%20%" => "40 %|60 %" after decoding.

     
  • David Gilbert
    David Gilbert
    2008-06-24

    Logged In: YES
    user_id=112975
    Originator: NO

    Thanks, I'll look at your patch soon. I came to the same conclusion about the encoding (eventually - I'm not very experienced with servlets/web programming etc)...but it will be good to decode the arguments ourselves in any case because I want to use the same chart specs to configure an applet, and also for a little Java client application that I'm putting together to make it a bit simpler/quicker for me to debug Eastwood.

    Regards,

    Dave Gilbert

     
  • David Gilbert
    David Gilbert
    2008-06-26

    • milestone: 788247 -->
    • status: open --> closed-fixed
     
  • David Gilbert
    David Gilbert
    2008-06-26

    Logged In: YES
    user_id=112975
    Originator: NO

    Thanks, your patch does indeed fix the problem, and is now committed to Subversion.

    Regards,

    Dave Gilbert