Changeset 7720


Ignore:
Timestamp:
Jun 3, 2019, 11:36:49 AM (2 years ago)
Author:
Nicklas Nordborg
Message:

References #2179: HTTP Status 400 - Bad request when logging in

The original fix used URLEncoder.encode(String, Charset) which didn't appear until Java 10, so we have to revert to URLEncoder.encode(String, String) to be compatible with Java 8.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.15-stable/src/clients/web/net/sf/basedb/clients/web/util/HTML.java

    r7710 r7720  
    2323package net.sf.basedb.clients.web.util;
    2424
     25import java.io.UnsupportedEncodingException;
    2526import java.net.URLEncoder;
    26 import java.nio.charset.StandardCharsets;
    2727import java.util.regex.*;
    2828
     
    348348  {
    349349    if (in == null) return "";
    350     return URLEncoder.encode(in, StandardCharsets.UTF_8);
     350    try
     351    {
     352      in = URLEncoder.encode(in, "UTF-8");
     353    }
     354    catch (UnsupportedEncodingException ex)
     355    {}
     356    return in;
    351357  }
    352358 
Note: See TracChangeset for help on using the changeset viewer.