ASF Bugzilla – Attachment 34078 Details for
Bug 59859
Tomcat WebDAV MOVE operation fails on Windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Use try-with and don't throw IOException while closing InputStream
01-close-inputstream.diff (text/plain), 2.14 KB, created by
Felix Schumacher
on 2016-07-28 20:05:34 UTC
(
hide
)
Description:
Use try-with and don't throw IOException while closing InputStream
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2016-07-28 20:05:34 UTC
Size:
2.14 KB
patch
obsolete
>diff --git a/java/org/apache/catalina/servlets/LocalStrings.properties b/java/org/apache/catalina/servlets/LocalStrings.properties >index 65cde51..cfa1326 100644 >--- a/java/org/apache/catalina/servlets/LocalStrings.properties >+++ b/java/org/apache/catalina/servlets/LocalStrings.properties >@@ -20,6 +20,7 @@ defaultServlet.missingResource=The requested resource ({0}) is not available > defaultservlet.skipfail=Only skipped [{0}] bytes when [{1}] were requested > webdavservlet.jaxpfailed=JAXP initialization failed > webdavservlet.enternalEntityIgnored=The request included a reference to an external entity with PublicID {0} and SystemID {1} which was ignored >+webdavservlet.inputstreamclosefail=Failed to close the inputStream of [{0}] > directory.filename=Filename > directory.lastModified=Last Modified > directory.parent=Up To {0} >diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java >index c3a9a74..4eeeeba 100644 >--- a/java/org/apache/catalina/servlets/WebdavServlet.java >+++ b/java/org/apache/catalina/servlets/WebdavServlet.java >@@ -17,6 +17,7 @@ > package org.apache.catalina.servlets; > > import java.io.IOException; >+import java.io.InputStream; > import java.io.StringReader; > import java.io.StringWriter; > import java.io.Writer; >@@ -1709,11 +1710,15 @@ public class WebdavServlet > } > } > } >- if (!resources.write(dest, sourceResource.getInputStream(), >- false)) { >- errorList.put(source, >- Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); >- return false; >+ try (InputStream is = sourceResource.getInputStream()) { >+ if (!resources.write(dest, is, >+ false)) { >+ errorList.put(source, >+ Integer.valueOf(WebdavStatus.SC_INTERNAL_SERVER_ERROR)); >+ return false; >+ } >+ } catch (IOException e) { >+ log(sm.getString("webdavservlet.inputstreamclosefail", source), e); > } > } else { > errorList.put(source,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59859
:
34040
|
34077
| 34078