This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new acfa5cc919 Improve error reporting of file copy errors acfa5cc919 is described below commit acfa5cc91921434f001c3fc431a6faccb44c947b Author: remm <r...@apache.org> AuthorDate: Mon May 19 14:21:36 2025 +0200 Improve error reporting of file copy errors BZ69694. --- .../catalina/manager/LocalStrings.properties | 2 +- .../apache/catalina/manager/ManagerServlet.java | 23 +++++++++++++++++----- webapps/docs/changelog.xml | 8 ++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/manager/LocalStrings.properties b/java/org/apache/catalina/manager/LocalStrings.properties index 1150786d91..7d7d8e4e4f 100644 --- a/java/org/apache/catalina/manager/LocalStrings.properties +++ b/java/org/apache/catalina/manager/LocalStrings.properties @@ -125,7 +125,7 @@ jmxProxyServlet.noOperationOnBean=Cannot find operation [{0}] with [{1}] argumen managerServlet.alreadyContext=FAIL - Application already exists at path [{0}] managerServlet.certsNotAvailable=Certificate information cannot be obtained from this connector at runtime -managerServlet.copyError=Could not copy configuration file from path [{0}] +managerServlet.copyFail=FAIL - Unable to copy [{0}] to [{1}], details of the error may be in the server logs managerServlet.deleteFail=FAIL - Unable to delete [{0}]. The continued presence of this file may cause problems. managerServlet.deployFailed=FAIL - Failed to deploy application at context path [{0}] managerServlet.deployed=OK - Deployed application at context path [{0}] diff --git a/java/org/apache/catalina/manager/ManagerServlet.java b/java/org/apache/catalina/manager/ManagerServlet.java index ac5d4c65d7..40392e2d29 100644 --- a/java/org/apache/catalina/manager/ManagerServlet.java +++ b/java/org/apache/catalina/manager/ManagerServlet.java @@ -734,7 +734,8 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { return; } if (!ExpandWar.copy(new File(config), new File(configBase, baseName + ".xml"))) { - throw new Exception(sm.getString("managerServlet.copyError", config)); + writer.println(smClient.getString("managerServlet.copyFail", new File(config), new File(configBase, baseName + ".xml"))); + return; } } // Upload WAR @@ -752,7 +753,10 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { } if (tag != null) { // Copy WAR to the host's appBase - ExpandWar.copy(uploadedWar, deployedWar); + if (!ExpandWar.copy(uploadedWar, deployedWar)) { + writer.println(smClient.getString("managerServlet.copyFail", uploadedWar, deployedWar)); + return; + } } } finally { removeServiced(name); @@ -806,7 +810,10 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { writer.println(smClient.getString("managerServlet.deleteFail", deployedWar)); return; } - ExpandWar.copy(localWar, deployedWar); + if (!ExpandWar.copy(localWar, deployedWar)) { + writer.println(smClient.getString("managerServlet.copyFail", localWar, deployedWar)); + return; + } } finally { removeServiced(name); } @@ -900,7 +907,10 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { writer.println(smClient.getString("managerServlet.deleteFail", localConfigFile)); return; } - ExpandWar.copy(configFile, localConfigFile); + if (!ExpandWar.copy(configFile, localConfigFile)) { + writer.println(smClient.getString("managerServlet.copyFail", configFile, localConfigFile)); + return; + } } } if (war != null) { @@ -920,7 +930,10 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { writer.println(smClient.getString("managerServlet.deleteFail", localWarFile)); return; } - ExpandWar.copy(warFile, localWarFile); + if (!ExpandWar.copy(warFile, localWarFile)) { + writer.println(smClient.getString("managerServlet.copyFail", warFile, localWarFile)); + return; + } } } } finally { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 3bea20ab99..c8a738b9e9 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -105,6 +105,14 @@ issues do not "pop up" wrt. others). --> <section name="Tomcat 9.0.106 (remm)" rtext="in development"> + <subsection name="Web applications"> + <changelog> + <fix> + <bug>69694</bug>: Improve error reporting of deployment tasks done + using the manager webapp when a copy operation fails. (remm) + </fix> + </changelog> + </subsection> <subsection name="Other"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org