tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1154574 - in /tomcat/trunk: java/org/apache/juli/DateFormatCache.java java/org/apache/juli/FileHandler.java res/findbugs/filter-false-positives.xml webapps/docs/changelog.xml
Date Sat, 06 Aug 2011 20:00:39 GMT
Author: markt
Date: Sat Aug  6 20:00:39 2011
New Revision: 1154574

URL: http://svn.apache.org/viewvc?rev=1154574&view=rev
Log:
Fix a small number of warnings reported by FindBugs.

Modified:
    tomcat/trunk/java/org/apache/juli/DateFormatCache.java
    tomcat/trunk/java/org/apache/juli/FileHandler.java
    tomcat/trunk/res/findbugs/filter-false-positives.xml
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/juli/DateFormatCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/DateFormatCache.java?rev=1154574&r1=1154573&r2=1154574&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/DateFormatCache.java (original)
+++ tomcat/trunk/java/org/apache/juli/DateFormatCache.java Sat Aug  6 20:00:39 2011
@@ -53,7 +53,6 @@ public class DateFormatCache {
     /* Number of cached entries */
     private int cacheSize = 0;
 
-    private DateFormatCache parent;
     private Cache cache;
 
     /**
@@ -85,7 +84,6 @@ public class DateFormatCache {
     public DateFormatCache(int size, String format, DateFormatCache parent) {
         cacheSize = size;
         this.format = tidyFormat(format);
-        this.parent = parent;
         Cache parentCache = null;
         if (parent != null) {
             synchronized(parent) {

Modified: tomcat/trunk/java/org/apache/juli/FileHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/FileHandler.java?rev=1154574&r1=1154573&r2=1154574&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/FileHandler.java (original)
+++ tomcat/trunk/java/org/apache/juli/FileHandler.java Sat Aug  6 20:00:39 2011
@@ -173,12 +173,13 @@ public class FileHandler
         String tsDate = tsString.substring(0, 10);
 
         writerLock.readLock().lock();
-        // If the date has changed, switch log files
-        if (rotatable && !date.equals(tsDate)) {
-            // Update to writeLock before we switch
-            writerLock.readLock().unlock();
-            writerLock.writeLock().lock();
-            try {
+        try {
+            // If the date has changed, switch log files
+            if (rotatable && !date.equals(tsDate)) {
+                // Update to writeLock before we switch
+                writerLock.readLock().unlock();
+                writerLock.writeLock().lock();
+
                 // Make sure another thread hasn't already done this
                 if (!date.equals(tsDate)) {
                     closeWriter();
@@ -188,9 +189,9 @@ public class FileHandler
                 // Down grade to read-lock. This ensures the writer remains valid
                 // until the log message is written
                 writerLock.readLock().lock();
-            } finally {
-                writerLock.writeLock().unlock();
             }
+        } finally {
+            writerLock.writeLock().unlock();
         }
 
         try {
@@ -362,7 +363,12 @@ public class FileHandler
 
         // Create the directory if necessary
         File dir = new File(directory);
-        dir.mkdirs();
+        if (!dir.mkdirs()) {
+            reportError("Unable to create [" + dir + "]", null,
+                    ErrorManager.OPEN_FAILURE);
+            writer = null;
+            return;
+        }
 
         // Open the current log file
         writerLock.writeLock().lock();
@@ -371,7 +377,12 @@ public class FileHandler
                     + (rotatable ? date : "") + suffix);
             File parent = pathname.getParentFile();
             if (!parent.exists()) {
-                parent.mkdirs();
+                if (!parent.mkdirs()) {
+                    reportError("Unable to create [" + parent + "]", null,
+                            ErrorManager.OPEN_FAILURE);
+                    writer = null;
+                    return;
+                }
             }
             String encoding = getEncoding();
             FileOutputStream fos = new FileOutputStream(pathname, true);

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1154574&r1=1154573&r2=1154574&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Sat Aug  6 20:00:39 2011
@@ -52,6 +52,11 @@
     <Bug code="IS"/>
   </Match>
   <Match>
+    <Class name="org.apache.catalina.authenticator.DigestAuthenticator"/>
+    <Field name="cnonces"/>
+    <Bug code="IS"/>
+  </Match>
+  <Match>
     <Class name="org.apache.catalina.connector.CoyoteReader"/>
     <Method name="readLine"/>
     <Bug code="RR"/>

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1154574&r1=1154573&r2=1154574&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sat Aug  6 20:00:39 2011
@@ -293,6 +293,9 @@
         <bug>51621</bug>: Add additional required JARs to the deployer
         distribution. (markt) 
       </fix>
+      <fix>
+        Fix a small number of warnings reported by FindBugs. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message