Author: markt
Date: Sun Jan 16 20:33:40 2011
New Revision: 1059655

URL: http://svn.apache.org/viewvc?rev=1059655&view=rev
Log:
Fix FindBugs warnings

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java
    tomcat/trunk/res/findbugs/filter-false-positives.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1059655&r1=1059654&r2=1059655&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Sun Jan 16 
20:33:40 2011
@@ -491,7 +491,9 @@ public class Catalina {
             inputStream = new FileInputStream(file);
             inputSource = new InputSource("file://" + file.getAbsolutePath());
         } catch (Exception e) {
-            // Ignore
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("catalina.configFail", file), e);
+            }
         }
         if (inputStream == null) {
             try {
@@ -501,7 +503,10 @@ public class Catalina {
                     (getClass().getClassLoader()
                      .getResource(getConfigFile()).toString());
             } catch (Exception e) {
-                // Ignore
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("catalina.configFail",
+                            getConfigFile()), e);
+                }
             }
         }
 
@@ -510,20 +515,29 @@ public class Catalina {
         if( inputStream==null ) {
             try {
                 inputStream = getClass().getClassLoader()
-                .getResourceAsStream("server-embed.xml");
+                        .getResourceAsStream("server-embed.xml");
                 inputSource = new InputSource
                 (getClass().getClassLoader()
                         .getResource("server-embed.xml").toString());
             } catch (Exception e) {
-                // Ignore
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("catalina.configFail",
+                            "server-embed.xml"), e);
+                }
             }
         }
 
 
-        if ((inputStream == null) && (file != null)) {
-            log.warn("Can't load server.xml from " + file.getAbsolutePath());
-            if (file.exists() && !file.canRead()) {
-                log.warn("Permissions incorrect, read permission is not 
allowed on the file.");
+        if (inputStream == null || inputSource == null) {
+            if  (file == null) {
+                log.warn(sm.getString("catalina.configFail",
+                        getConfigFile() + "] or [server-embed.xml]"));
+            } else {
+                log.warn(sm.getString("catalina.configFail",
+                        file.getAbsolutePath()));
+                if (file.exists() && !file.canRead()) {
+                    log.warn("Permissions incorrect, read permission is not 
allowed on the file.");
+                }
             }
             return;
         }

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1059655&r1=1059654&r2=1059655&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Sun 
Jan 16 20:33:40 2011
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+catalina.configFail=Unable to load server configuration from [{0}]
 catalina.shutdownHookFail=The shutdown hook experienced an error while trying 
to stop the server
 catalina.stopServer=No shutdown port configured. Shut down server through OS 
signal. Server not shut down.
 contextConfig.altDDNotFound=alt-dd file {0} not found

Modified: tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java?rev=1059655&r1=1059654&r2=1059655&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java Sun Jan 16 
20:33:40 2011
@@ -909,6 +909,7 @@ final class CallMethodMultiRule extends 
         if (paramCount > 0) {
             parameters = (Object[]) digester.popParams();
         } else {
+            parameters = new Object[0];
             super.end(namespace, name);
         }
         

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1059655&r1=1059654&r2=1059655&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Sun Jan 16 20:33:40 
2011
@@ -28,6 +28,12 @@
     <Bug code="MSF" />
   </Match>
   <Match>
+    <!-- Catalina isn'y used when embedding -->
+    <Class name="org.apache.catalina.startup.Catalina" />
+    <Method name="stopServer" />
+    <Bug code="Dm" />
+  </Match>
+  <Match>
     <!-- Sleep is short, needs to keep lock -->
     <Class name="org.apache.catalina.startup.HostConfig" />
     <Method name="checkResources" />



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

Reply via email to