Menu

#70 Connection String Breaks when headerline contains '%' char

open-wont-fix
None
5
2012-08-15
2012-06-12
jbocarsly
No

If a header contains the '%' character, and the headers are passed in the connection string, processing the string results in an exception. If the headerline value containing the '%' char is passed in a Properties object, it is processed correctly.

Discussion

  • Simon Chenery

    Simon Chenery - 2012-06-12

    When using a URL string to connect to the database, encode property values containing special characters using class java.net.URLEncoder. For example,

    String encoded = URLEncoder.encode("America/Los_Angeles", "UTF-8");
    System.out.println(encoded);
    Connection conn = DriverManager.getConnection("jdbc:relique:csv:/tmp?timeZoneName=" + encoded + "&fileExtension=.log");

    This is the same method that you would use for encoding a HTTP request.

     
  • jbocarsly

    jbocarsly - 2012-06-12

    May I suggest something like the following in the connect() method, so that a headerline property inserted using a Properties object is handled the same as one where the headerline is specified in the URL?

    try {
    key = URLDecoder.decode(property[0], "UTF-8");
    } catch (IllegalArgumentException e){
    key = property[0];
    }
    try {
    value = URLDecoder.decode(property[1], "UTF-8");
    } catch (IllegalArgumentException e){
    value = property[1];
    }

     
  • Simon Chenery

    Simon Chenery - 2012-06-12

    No, we cannot make this change.

    This would result in currently correct property values (here, a fileTailPattern) such as

    -(\d+)-(\d+)

    being changed to

    -(\d )-(\d )

    which is not we want.

     
  • Mario Frasca

    Mario Frasca - 2012-08-15
    • assigned_to: nobody --> simoc
     
  • Simon Chenery

    Simon Chenery - 2012-08-15
    • status: open --> open-wont-fix
     
  • Nobody/Anonymous

    This design is wicked! You most certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog well, almostHaHa! Excellent job. I really loved what you had to say, and more than that, how you presented it. Too cool!
    <a href="http://www.vilago21.com/event/To+Get+the+Best+Photography+Hire+a+Calgary+Wedding+Photographers/1790250/profile" title="Wedding ceremony">Wedding ceremony</a>

     
MongoDB Logo MongoDB