Browse Source

Merge branch '5.2.x'

pull/25742/head
Juergen Hoeller 5 years ago
parent
commit
7dbb40ffa0
  1. 11
      spring-core/src/main/java/org/springframework/core/io/FileUrlResource.java
  2. 6
      spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

11
spring-core/src/main/java/org/springframework/core/io/FileUrlResource.java

@ -89,15 +89,8 @@ public class FileUrlResource extends UrlResource implements WritableResource {
@Override @Override
public boolean isWritable() { public boolean isWritable() {
try { try {
URL url = getURL(); File file = getFile();
if (ResourceUtils.isFileURL(url)) { return (file.canWrite() && !file.isDirectory());
// Proceed with file system resolution
File file = getFile();
return (file.canWrite() && !file.isDirectory());
}
else {
return true;
}
} }
catch (IOException ex) { catch (IOException ex) {
return false; return false;

6
spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

@ -286,14 +286,14 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
} }
/** /**
* Return the charset to use for JSON input. * Determine the charset to use for JSON input.
* <p>By default this is either the charset from the input {@code MediaType} * <p>By default this is either the charset from the input {@code MediaType}
* or otherwise falling back on {@code UTF-8}. * or otherwise falling back on {@code UTF-8}. Can be overridden in subclasses.
* @param contentType the content type of the HTTP input message * @param contentType the content type of the HTTP input message
* @return the charset to use * @return the charset to use
* @since 5.1.18 * @since 5.1.18
*/ */
protected static Charset getCharset(@Nullable MediaType contentType) { protected Charset getCharset(@Nullable MediaType contentType) {
if (contentType != null && contentType.getCharset() != null) { if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset(); return contentType.getCharset();
} }

Loading…
Cancel
Save