Ignore:
Timestamp:
2023-02-09T09:47:37+01:00 (2 years ago)
Author:
stoecker
Message:

unify stripUrl() handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r18437 r18652  
    3434import org.openstreetmap.josm.io.auth.DefaultAuthenticator;
    3535import org.openstreetmap.josm.spi.preferences.Config;
     36import org.openstreetmap.josm.tools.TextUtils;
    3637
    3738/**
     
    126127
    127128    /**
    128      * Removed privacy related parts form output URL
    129      * @param url Unmodified URL
    130      * @return Stripped URL (privacy related issues removed)
    131      */
    132     private String stripUrl(URL url) {
    133         return url.toString().replaceAll("(token|key|connectId)=[^&]+", "$1=...stripped...");
    134     }
    135 
    136     /**
    137129     * Opens the HTTP connection.
    138130     * @param progressMonitor progress monitor
     
    158150                final boolean hasReason = !Utils.isEmpty(reasonForRequest);
    159151                logRequest("{0} {1}{2} -> {3} {4} ({5}{6})",
    160                         getRequestMethod(), stripUrl(getURL()), hasReason ? (" (" + reasonForRequest + ')') : "",
     152                        getRequestMethod(), TextUtils.stripUrl(getURL().toString()), hasReason ? (" (" + reasonForRequest + ')') : "",
    161153                        cr.getResponseVersion(), cr.getResponseCode(),
    162154                        stopwatch,
     
    176168                }
    177169            } catch (IOException | RuntimeException e) {
    178                 logRequest("{0} {1} -> !!! ({2})", requestMethod, stripUrl(url), stopwatch);
     170                logRequest("{0} {1} -> !!! ({2})", requestMethod, TextUtils.stripUrl(url.toString()), stopwatch);
    179171                Logging.warn(e);
    180172                //noinspection ThrowableResultOfMethodCallIgnored
Note: See TracChangeset for help on using the changeset viewer.