Use Charset variants of URLEncoder and URLDecoder methods
This commit is contained in:
committed by
Juergen Hoeller
parent
2fba0bc272
commit
5c972fcc54
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -80,7 +81,7 @@ public class ResourceEntityResolver extends DelegatingEntityResolver {
|
||||
if (source == null && systemId != null) {
|
||||
String resourcePath = null;
|
||||
try {
|
||||
String decodedSystemId = URLDecoder.decode(systemId, "UTF-8");
|
||||
String decodedSystemId = URLDecoder.decode(systemId, StandardCharsets.UTF_8);
|
||||
String givenUrl = new URL(decodedSystemId).toString();
|
||||
String systemRootUrl = new File("").toURI().toURL().toString();
|
||||
// Try relative to resource base if currently in system root.
|
||||
|
||||
Reference in New Issue
Block a user