Polishing

(cherry picked from commit 95330d0)
This commit is contained in:
Juergen Hoeller 2017-01-16 21:49:21 +01:00
parent 8656e30550
commit 8c62a2f11a
3 changed files with 17 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -128,7 +128,7 @@ public enum HttpStatus {
/**
* {@code 302 Moved Temporarily}.
* @see <a href="http://tools.ietf.org/html/rfc1945#section-9.3">HTTP/1.0, section 9.3</a>
* @deprecated In favor of {@link #FOUND} which will be returned from {@code HttpStatus.valueOf(302)}
* @deprecated in favor of {@link #FOUND} which will be returned from {@code HttpStatus.valueOf(302)}
*/
@Deprecated
MOVED_TEMPORARILY(302, "Moved Temporarily"),
@ -236,7 +236,7 @@ public enum HttpStatus {
/**
* {@code 413 Request Entity Too Large}.
* @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.14">HTTP/1.1, section 10.4.14</a>
* @deprecated In favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from {@code HttpStatus.valueOf(413)}
* @deprecated in favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from {@code HttpStatus.valueOf(413)}
*/
@Deprecated
REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"),
@ -249,7 +249,7 @@ public enum HttpStatus {
/**
* {@code 414 Request-URI Too Long}.
* @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.15">HTTP/1.1, section 10.4.15</a>
* @deprecated In favor of {@link #URI_TOO_LONG} which will be returned from {@code HttpStatus.valueOf(414)}
* @deprecated in favor of {@link #URI_TOO_LONG} which will be returned from {@code HttpStatus.valueOf(414)}
*/
@Deprecated
REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"),

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@ -107,15 +107,11 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
}
setMultipartFiles(files);
}
catch (Exception ex) {
catch (Throwable ex) {
throw new MultipartException("Could not parse multipart servlet request", ex);
}
}
private String extractFilename(String contentDisposition) {
return extractFilename(contentDisposition, FILENAME_KEY);
}
private String extractFilename(String contentDisposition, String key) {
if (contentDisposition == null) {
return null;
@ -140,6 +136,10 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
return filename;
}
private String extractFilename(String contentDisposition) {
return extractFilename(contentDisposition, FILENAME_KEY);
}
private String extractFilenameWithCharset(String contentDisposition) {
String filename = extractFilename(contentDisposition, FILENAME_WITH_CHARSET_KEY);
if (filename == null) {
@ -220,7 +220,7 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
Part part = getPart(paramOrFileName);
return (part != null ? part.getContentType() : null);
}
catch (Exception ex) {
catch (Throwable ex) {
throw new MultipartException("Could not access multipart servlet request", ex);
}
}
@ -240,7 +240,7 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
return null;
}
}
catch (Exception ex) {
catch (Throwable ex) {
throw new MultipartException("Could not access multipart servlet request", ex);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@ -42,6 +42,9 @@ import org.springframework.web.multipart.MultipartResolver;
*
* @author Juergen Hoeller
* @since 3.1
* @see #setResolveLazily
* @see HttpServletRequest#getParts()
* @see org.springframework.web.multipart.commons.CommonsMultipartResolver
*/
public class StandardServletMultipartResolver implements MultipartResolver {
@ -87,7 +90,7 @@ public class StandardServletMultipartResolver implements MultipartResolver {
}
}
}
catch (Exception ex) {
catch (Throwable ex) {
LogFactory.getLog(getClass()).warn("Failed to perform cleanup of multipart items", ex);
}
}