Author: markt Date: Tue Jan 18 18:57:45 2011 New Revision: 1060538 URL: http://svn.apache.org/viewvc?rev=1060538&view=rev Log: Fix the last of the high priority FindBugs warnings
Modified: tomcat/trunk/java/org/apache/jasper/JspC.java tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java tomcat/trunk/java/org/apache/tomcat/util/buf/StringCache.java tomcat/trunk/res/findbugs/filter-false-positives.xml Modified: tomcat/trunk/java/org/apache/jasper/JspC.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=1060538&r1=1060537&r2=1060538&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/JspC.java (original) +++ tomcat/trunk/java/org/apache/jasper/JspC.java Tue Jan 18 18:57:45 2011 @@ -151,7 +151,6 @@ public class JspC implements Options { insertBefore.add("<ejb-local-ref>"); } - protected static int die; protected String classPath = null; protected URLClassLoader loader = null; protected boolean trimSpaces = false; @@ -251,8 +250,9 @@ public class JspC implements Options { if (arg.length == 0) { System.out.println(Localizer.getMessage("jspc.usage")); } else { + JspC jspc = null; try { - JspC jspc = new JspC(); + jspc = new JspC(); jspc.setArgs(arg); if (jspc.helpNeeded) { System.out.println(Localizer.getMessage("jspc.usage")); @@ -261,8 +261,8 @@ public class JspC implements Options { } } catch (JasperException je) { System.err.println(je); - if (die != NO_DIE_LEVEL) { - System.exit(die); + if (jspc != null && jspc.dieLevel != NO_DIE_LEVEL) { + System.exit(jspc.dieLevel); } } } @@ -279,7 +279,6 @@ public class JspC implements Options { String tok; dieLevel = NO_DIE_LEVEL; - die = dieLevel; while ((tok = nextArg()) != null) { if (tok.equals(SWITCH_VERBOSE)) { @@ -341,7 +340,6 @@ public class JspC implements Options { } catch (NumberFormatException nfe) { dieLevel = DEFAULT_DIE_LEVEL; } - die = dieLevel; } else if (tok.equals(SWITCH_HELP)) { helpNeeded = true; } else if (tok.equals(SWITCH_POOLING)) { @@ -804,8 +802,8 @@ public class JspC implements Options { * includes. */ public void setUriroot( String s ) { - if( s==null ) { - uriRoot = s; + if (s == null) { + uriRoot = null; return; } try { @@ -1097,8 +1095,12 @@ public class JspC implements Options { fis.close(); fos.close(); - webXml2.delete(); - (new File(webxmlFile)).delete(); + if(!webXml2.delete() && log.isDebugEnabled()) + log.debug(Localizer.getMessage("jspc.delete.fail", + webXml2.toString())); + + if (!(new File(webxmlFile)).delete() && log.isDebugEnabled()) + log.debug(Localizer.getMessage("jspc.delete.fail", webxmlFile)); } Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1060538&r1=1060537&r2=1060538&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Tue Jan 18 18:57:45 2011 @@ -296,6 +296,7 @@ jspc.error.jasperException=error-the fil jspc.error.generalException=ERROR-the file ''{0}'' generated the following general exception: jspc.error.fileDoesNotExist=The file argument ''{0}'' does not exist jspc.error.emptyWebApp=-webapp requires a trailing file argument +jspc.delete.fail=Failed to delete file [{0}] jsp.error.library.invalid=JSP page is invalid according to library {0}: {1} jsp.error.tlvclass.instantiation=Failed to load or instantiate TagLibraryValidator class: {0} jsp.error.tlv.invalid.page=Validation error messages from TagLibraryValidator for {0} in {1} Modified: tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java?rev=1060538&r1=1060537&r2=1060538&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java (original) +++ tomcat/trunk/java/org/apache/naming/factory/webservices/ServiceProxy.java Tue Jan 18 18:57:45 2011 @@ -75,9 +75,11 @@ public class ServiceProxy } /** - * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) + * @see InvocationHandler#invoke(Object, Method, Object[]) */ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + @Override + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { if (portQNameClass.equals(method)) { return getProxyPortQNameClass(args); @@ -99,6 +101,7 @@ public class ServiceProxy * @return Returns the correct Port * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL). */ + @SuppressWarnings("unchecked") private Object getProxyPortQNameClass(Object[] args) throws ServiceException { QName name = (QName) args[0]; Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/StringCache.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/StringCache.java?rev=1060538&r1=1060537&r2=1060538&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/StringCache.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/StringCache.java Tue Jan 18 18:57:45 2011 @@ -236,7 +236,7 @@ public class StringCache { for (Entry<ByteEntry,int[]> item : bcStats.entrySet()) { ByteEntry entry = item.getKey(); int[] countA = item.getValue(); - Integer count = new Integer(countA[0]); + Integer count = Integer.valueOf(countA[0]); // Add to the list for that count ArrayList<ByteEntry> list = tempMap.get(count); if (list == null) { @@ -353,7 +353,7 @@ public class StringCache { for (Entry<CharEntry,int[]> item : ccStats.entrySet()) { CharEntry entry = item.getKey(); int[] countA = item.getValue(); - Integer count = new Integer(countA[0]); + Integer count = Integer.valueOf(countA[0]); // Add to the list for that count ArrayList<CharEntry> list = tempMap.get(count); if (list == null) { @@ -518,7 +518,7 @@ public class StringCache { int i = 0; while (true) { - i = (b + a) / 2; + i = (b + a) >>> 1; int result = compare(name, array[i].name); if (result == 1) { a = i; @@ -612,7 +612,7 @@ public class StringCache { int i = 0; while (true) { - i = (b + a) / 2; + i = (b + a) >>> 1; int result = compare(name, array[i].name); if (result == 1) { a = i; Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1060538&r1=1060537&r2=1060538&view=diff ============================================================================== --- tomcat/trunk/res/findbugs/filter-false-positives.xml (original) +++ tomcat/trunk/res/findbugs/filter-false-positives.xml Tue Jan 18 18:57:45 2011 @@ -17,6 +17,11 @@ <FindBugsFilter> <!-- Considered to be false positives --> <Match> + <!-- JNI library can only be loaded once so statics are appropriate --> + <Class name="org.apache.catalina.core.AprLifecycleListener" /> + <Bug code="ST" /> + </Match> + <Match> <!-- Have to trigger GC for leak detection to work. Clearly documented --> <Class name="org.apache.catalina.core.StandardHost" /> <Method name="findReloadedContextMemoryLeaks" /> @@ -28,7 +33,7 @@ <Bug code="MSF" /> </Match> <Match> - <!-- Catalina isn'y used when embedding --> + <!-- Catalina isn't used when embedding --> <Class name="org.apache.catalina.startup.Catalina" /> <Method name="stopServer" /> <Bug code="Dm" /> @@ -60,6 +65,18 @@ <Bug code="NS"/> </Match> <Match> + <!-- JspC will not be used under a security manager --> + <Class name="org.apache.jasper.JspC"/> + <Method name="initClassLoader"/> + <Bug code="DP" /> + </Match> + <Match> + <!-- Parser config is static so statics are appropriate --> + <Class name="org.apache.jasper.JspC"/> + <Method name="setValidateXml"/> + <Bug code="ST" /> + </Match> + <Match> <!-- Simpler to catch Exception than to create dummy implementations of the necessary exception hierarchy --> <Class name="org.apache.naming.factory.SendMailFactory$1" /> @@ -67,6 +84,13 @@ <Bug code="DE" /> </Match> <Match> + <!-- Simpler to catch Exception than to create dummy implementations of the + necessary exception hierarchy --> + <Class name="org.apache.naming.factory.webservices.ServiceProxy" /> + <Method name="<init>"/> + <Bug code="ST" /> + </Match> + <Match> <!-- Class name needs to start with a lower case letter in this case --> <Class name="org.apache.naming.java.javaURLContextFactory" /> <Bug code="Nm" /> @@ -93,6 +117,12 @@ <Bug code="NP" /> </Match> <Match> + <!-- Whilst cache is global there may be multiple instances (one per --> + <!-- server so statics are appropriate --> + <Class name="org.apache.tomcat.util.buf.StringCache"/> + <Bug code="ST" /> + </Match> + <Match> <!-- Test really is for the same object rather than equality --> <Class name="org.apache.tomcat.util.digester.Digester"/> <Method name="updateBodyText"/> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org