From: markt Date: Sun, 16 Jan 2011 20:33:40 +0000 (+0000) Subject: Fix FindBugs warnings X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d9135b8035ea2b73cc8d750591b2be7e100ec09a;p=tomcat7.0 Fix FindBugs warnings git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1059655 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/startup/Catalina.java b/java/org/apache/catalina/startup/Catalina.java index f164ca45e..751bbb6c9 100644 --- a/java/org/apache/catalina/startup/Catalina.java +++ b/java/org/apache/catalina/startup/Catalina.java @@ -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; } diff --git a/java/org/apache/catalina/startup/LocalStrings.properties b/java/org/apache/catalina/startup/LocalStrings.properties index cac771b69..b2912b96f 100644 --- a/java/org/apache/catalina/startup/LocalStrings.properties +++ b/java/org/apache/catalina/startup/LocalStrings.properties @@ -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 diff --git a/java/org/apache/catalina/startup/WebRuleSet.java b/java/org/apache/catalina/startup/WebRuleSet.java index fda97db3a..9561765f5 100644 --- a/java/org/apache/catalina/startup/WebRuleSet.java +++ b/java/org/apache/catalina/startup/WebRuleSet.java @@ -909,6 +909,7 @@ final class CallMethodMultiRule extends CallMethodRule { if (paramCount > 0) { parameters = (Object[]) digester.popParams(); } else { + parameters = new Object[0]; super.end(namespace, name); } diff --git a/res/findbugs/filter-false-positives.xml b/res/findbugs/filter-false-positives.xml index 5476ec0ac..b69278a1b 100644 --- a/res/findbugs/filter-false-positives.xml +++ b/res/findbugs/filter-false-positives.xml @@ -28,6 +28,12 @@ + + + + + +