Class TextUtils

java.lang.Object
org.openstreetmap.josm.tools.TextUtils

public final class TextUtils extends Object
Text/String utils.
Since:
13978
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Pattern
    The parameters which are private: API keys and tokens, and OAuth 2.0 client secrets, authorization codes and their verifiers, and passwords.
    private static final String
    What private information is replaced with
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<String,Object>
    stripHeaders(Map<String,?> headers)
    Remove privacy related values from output HTTP headers: those of Authorization and Proxy-Authorization, but for their scheme, so that the output still tells which kind of authentication was used, and those of Cookie and Set-Cookie.
    private static Object
    stripHeaderValue(Object value, boolean keepScheme)
     
    static String
    Remove privacy related parts from output URL.
    static String
    Inserts zero width space character (U+8203) after each slash/ampersand to wrap long URLs.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STRIPPED

      private static final String STRIPPED
      What private information is replaced with
      See Also:
    • PRIVATE_PARAMETERS

      private static final Pattern PRIVATE_PARAMETERS
      The parameters which are private: API keys and tokens, and OAuth 2.0 client secrets, authorization codes and their verifiers, and passwords. code is only matched as a whole name, so as not to strip e.g. a postcode. A value ends at white space too, so that what follows a URL in a log line is kept.
  • Constructor Details

  • Method Details

    • wrapLongUrl

      public static String wrapLongUrl(String url)
      Inserts zero width space character (U+8203) after each slash/ampersand to wrap long URLs.
      Parameters:
      url - URL
      Returns:
      wrapped URL
      Since:
      13978
    • stripUrl

      public static String stripUrl(String url)
      Remove privacy related parts from output URL.

      This works for a form-encoded (application/x-www-form-urlencoded) request body as well, which has the syntax of a query, such as an OAuth 2.0 token request with its client secret.

      Parameters:
      url - Unmodified URL
      Returns:
      Stripped URL (privacy related issues removed)
      Since:
      18652
    • stripHeaders

      public static Map<String,Object> stripHeaders(Map<String,?> headers)
      Remove privacy related values from output HTTP headers: those of Authorization and Proxy-Authorization, but for their scheme, so that the output still tells which kind of authentication was used, and those of Cookie and Set-Cookie.
      Parameters:
      headers - Unmodified headers, with a single value or a list of values for each
      Returns:
      Stripped copy of the headers, in the same order (privacy related issues removed)
      Since:
      19711
    • stripHeaderValue

      private static Object stripHeaderValue(Object value, boolean keepScheme)