diff --git a/src/main/java/org/jabref/logic/importer/FetcherException.java b/src/main/java/org/jabref/logic/importer/FetcherException.java index 475f2716f10..cd82a392fb9 100644 --- a/src/main/java/org/jabref/logic/importer/FetcherException.java +++ b/src/main/java/org/jabref/logic/importer/FetcherException.java @@ -89,6 +89,10 @@ private String getRedactedUrl() { return API_KEY_PATTERN.matcher(url).replaceAll(REDACTED_STRING); } + public static Object getRedactedUrl(URL source) { + return API_KEY_PATTERN.matcher(source.toString()).replaceAll(REDACTED_STRING); + } + private String getPrefix() { String superLocalizedMessage = super.getLocalizedMessage(); if (!StringUtil.isBlank(superLocalizedMessage)) { diff --git a/src/main/java/org/jabref/logic/net/URLDownload.java b/src/main/java/org/jabref/logic/net/URLDownload.java index 669d265cc1d..1f054ea5024 100644 --- a/src/main/java/org/jabref/logic/net/URLDownload.java +++ b/src/main/java/org/jabref/logic/net/URLDownload.java @@ -382,7 +382,7 @@ public URLConnection openConnection() throws FetcherException { } else if (status >= 400) { // in case of an error, propagate the error message SimpleHttpResponse httpResponse = new SimpleHttpResponse(httpURLConnection); - LOGGER.info("{}: {}", this.source, httpResponse); + LOGGER.info("{}: {}", FetcherException.getRedactedUrl(this.source), httpResponse); if (status < 500) { throw new FetcherClientException(this.source, httpResponse); } else {