Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
ExpandWar.expand does not check the return value of File.mkdirs.
Provide better message when a war file cannot be unpacked due to failure to create a directory.
Fix missing message argument in ContextConfig.init().

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc5.5.x/trunk@1392228 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/STATUS.txt b/STATUS.txt
index 4634f37..46b8b7c 100644
--- a/STATUS.txt
+++ b/STATUS.txt
@@ -66,15 +66,6 @@
   +1: kkolinko, markt
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
-  ExpandWar.expand does not check the return value of File.mkdirs.
-  Provide better message when a war file cannot be unpacked due to failure
-  to create a directory. Fix missing message argument in ContextConfig.init().
-  kkolinko: Updated patch:
-  https://issues.apache.org/bugzilla/attachment.cgi?id=29212
-  +1: schultz, kkolinko, markt
-  -1:
-
 * Various DIGEST improvements ported from Tomcat 7
   http://people.apache.org/~markt/patches/2012-08-28-digest-tc5.patch
   +1: markt, kkolinko
diff --git a/container/catalina/src/share/org/apache/catalina/startup/ContextConfig.java b/container/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
index a266069..4d2e6f2 100644
--- a/container/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
+++ b/container/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
@@ -998,7 +998,8 @@
         try {
             fixDocBase();
         } catch (IOException e) {
-            log.error(sm.getString("contextConfig.fixDocBase"), e);
+            log.error(sm.getString(
+                    "contextConfig.fixDocBase", context.getPath()), e);
         }
         
     }
diff --git a/container/catalina/src/share/org/apache/catalina/startup/ExpandWar.java b/container/catalina/src/share/org/apache/catalina/startup/ExpandWar.java
index 2d036c3..96f3777 100644
--- a/container/catalina/src/share/org/apache/catalina/startup/ExpandWar.java
+++ b/container/catalina/src/share/org/apache/catalina/startup/ExpandWar.java
@@ -132,7 +132,9 @@
         }
 
         // Create the new document base directory
-        docBase.mkdir();
+        if(!docBase.mkdir() && !docBase.isDirectory())
+            throw new IOException(
+                    sm.getString("expandWar.createFailed", docBase));
 
         // Expand the WAR into the new document base directory
         String canonicalDocBasePrefix = docBase.getCanonicalPath();
@@ -162,7 +164,9 @@
                 if (last >= 0) {
                     File parent = new File(docBase,
                                            name.substring(0, last));
-                    parent.mkdirs();
+                    if(!parent.mkdirs() && !parent.isDirectory())
+                        throw new IOException(
+                                sm.getString("expandWar.createFailed", parent));
                 }
                 if (name.endsWith("/")) {
                     continue;
@@ -192,7 +196,7 @@
                 try {
                     input.close();
                 } catch (Throwable t) {
-                    ;
+                    // Ignore
                 }
                 input = null;
             }
@@ -200,7 +204,7 @@
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    ;
+                    // Ignore
                 }
                 jarFile = null;
             }
diff --git a/container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties b/container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
index e1b5edf..4fe3f89 100644
--- a/container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
+++ b/container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
@@ -57,6 +57,7 @@
 engineConfig.start=EngineConfig: Processing START
 engineConfig.stop=EngineConfig: Processing STOP
 expandWar.copy=Error copying {0} to {1}
+expandWar.createFailed=Unable to create the directory [{0}]
 expandWar.deleteFailed=[{0}] could not be completely deleted. The presence of the remaining files may cause problems
 expandWar.illegalPath=The archive [{0}] is malformed and will be ignored: an entry contains an illegal path [{1}]
 hostConfig.appBase=Application base directory {0} does not exist
diff --git a/container/webapps/docs/changelog.xml b/container/webapps/docs/changelog.xml
index bf2c347..580f832 100644
--- a/container/webapps/docs/changelog.xml
+++ b/container/webapps/docs/changelog.xml
@@ -45,6 +45,12 @@
       <update>
         Update to Apache Commons Daemon 1.0.9. (markt)
       </update>
+      <fix>
+        Various improvements to the DIGEST authenticator including
+        <bug>52954</bug>, the disabling caching of an authenticated user in the
+        session by default, tracking server rather than client nonces and better
+        handling of stale nonce values. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Catalina">
@@ -58,6 +64,10 @@
         entropy to initialize random numbers generator in session manager. Based
         on a proposal by Andras Rozsa. (kkolinko/jim)
       </fix>
+      <fix>
+        <bug>53531</bug>: Better checking and improved error messages for
+        directory creation during automatic deployment. (schultz/kkolinko)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">