tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From violet...@apache.org
Subject svn commit: r1721447 - in /tomcat/trunk/java/org/apache: catalina/ant/jmx/ catalina/deploy/ catalina/ha/session/ catalina/loader/ catalina/manager/util/ catalina/valves/rewrite/ jasper/compiler/
Date Tue, 22 Dec 2015 19:16:33 GMT
Author: violetagg
Date: Tue Dec 22 19:16:32 2015
New Revision: 1721447

URL: http://svn.apache.org/viewvc?rev=1721447&view=rev
Log:
Variable cannot be null

Modified:
    tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
    tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
    tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
    tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
    tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java

Modified: tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java Tue Dec 22 19:16:32
2015
@@ -190,11 +190,9 @@ public class JMXAccessorSetTask extends
         String mattrType = null;
         MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
         MBeanAttributeInfo attrs[] = minfo.getAttributes();
-        if (attrs != null) {
-            for (int i = 0; mattrType == null && i < attrs.length; i++) {
-                if (attribute.equals(attrs[i].getName()))
-                    mattrType = attrs[i].getType();
-            }
+        for (int i = 0; mattrType == null && i < attrs.length; i++) {
+            if (attribute.equals(attrs[i].getName()))
+                mattrType = attrs[i].getType();
         }
         return mattrType;
     }

Modified: tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java Tue Dec 22 19:16:32
2015
@@ -1039,18 +1039,16 @@ public class NamingResourcesImpl extends
                     name, container, closeMethod));
             return;
         }
-        if (m != null) {
-            try {
-                m.invoke(resource, (Object[]) null);
-            } catch (IllegalArgumentException | IllegalAccessException e) {
-                log.warn(sm.getString("namingResources.cleanupCloseFailed",
-                        closeMethod, name, container), e);
-            } catch (InvocationTargetException e) {
-                Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
-                ExceptionUtils.handleThrowable(t);
-                log.warn(sm.getString("namingResources.cleanupCloseFailed",
-                        closeMethod, name, container), t);
-            }
+        try {
+            m.invoke(resource, (Object[]) null);
+        } catch (IllegalArgumentException | IllegalAccessException e) {
+            log.warn(sm.getString("namingResources.cleanupCloseFailed",
+                    closeMethod, name, container), e);
+        } catch (InvocationTargetException e) {
+            Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
+            ExceptionUtils.handleThrowable(t);
+            log.warn(sm.getString("namingResources.cleanupCloseFailed",
+                    closeMethod, name, container), t);
         }
     }
 

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Tue Dec 22 19:16:32
2015
@@ -1187,9 +1187,7 @@ public class DeltaManager extends Cluste
         try {
 
             ClassLoader[] loaders = getClassLoaders();
-            if ( loaders != null && loaders.length > 0) {
-                Thread.currentThread().setContextClassLoader(loaders[0]);
-            }
+            Thread.currentThread().setContextClassLoader(loaders[0]);
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("deltaManager.receiveMessage.eventType",
                         getName(), msg.getEventTypeString(), sender));

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Tue Dec 22 19:16:32 2015
@@ -650,7 +650,6 @@ public class WebappLoader extends Lifecy
             Method m=loader.getClass().getMethod("getClasspath", new Class[] {});
             if( log.isTraceEnabled())
                 log.trace("getClasspath " + m );
-            if( m==null ) return null;
             Object o=m.invoke( loader, new Object[] {} );
             if( log.isDebugEnabled() )
                 log.debug("gotClasspath " + o);

Modified: tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java Tue Dec 22 19:16:32
2015
@@ -122,12 +122,10 @@ public class SessionUtils {
                 if (null != probableEngine) {
                     try {
                         Method readMethod = probableEngine.getClass().getMethod("getLocale",
(Class<?>[])null);//$NON-NLS-1$
-                        if (null != readMethod) {
-                            // Call the property getter and return the value
-                            Object possibleLocale = readMethod.invoke(probableEngine, (Object[])
null);
-                            if (possibleLocale instanceof Locale) {
-                                locale = (Locale) possibleLocale;
-                            }
+                        // Call the property getter and return the value
+                        Object possibleLocale = readMethod.invoke(probableEngine, (Object[])
null);
+                        if (possibleLocale instanceof Locale) {
+                            locale = (Locale) possibleLocale;
                         }
                     } catch (Exception e) {
                         Throwable t = ExceptionUtils

Modified: tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java Tue Dec 22 19:16:32
2015
@@ -122,13 +122,11 @@ public class RewriteValve extends ValveB
             File file = new File(getConfigBase(), resourceName);
             try {
                 if (!file.exists()) {
-                    if (resourceName != null) {
-                        // Use getResource and getResourceAsStream
-                        is = getClass().getClassLoader()
-                            .getResourceAsStream(resourceName);
-                        if (is != null && container.getLogger().isDebugEnabled())
{
-                            container.getLogger().debug("Read configuration from CL at "
+ resourceName);
-                        }
+                    // Use getResource and getResourceAsStream
+                    is = getClass().getClassLoader()
+                        .getResourceAsStream(resourceName);
+                    if (is != null && container.getLogger().isDebugEnabled()) {
+                        container.getLogger().debug("Read configuration from CL at " + resourceName);
                     }
                 } else {
                     if (container.getLogger().isDebugEnabled()) {

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=1721447&r1=1721446&r2=1721447&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java Tue Dec 22 19:16:32 2015
@@ -361,15 +361,12 @@ public abstract class Compiler {
                 generateClass(smap);
                 // Fix for bugzilla 41606
                 // Set JspServletWrapper.servletClassLastModifiedTime after successful compile
-                String targetFileName = ctxt.getClassFileName();
-                if (targetFileName != null) {
-                    File targetFile = new File(targetFileName);
-                    if (targetFile.exists()) {
-                        targetFile.setLastModified(jspLastModified.longValue());
-                        if (jsw != null) {
-                            jsw.setServletClassLastModifiedTime(
-                                    jspLastModified.longValue());
-                        }
+                File targetFile = new File(ctxt.getClassFileName());
+                if (targetFile.exists()) {
+                    targetFile.setLastModified(jspLastModified.longValue());
+                    if (jsw != null) {
+                        jsw.setServletClassLastModifiedTime(
+                                jspLastModified.longValue());
                     }
                 }
             }
@@ -547,17 +544,14 @@ public abstract class Compiler {
         removeGeneratedClassFiles();
 
         try {
-            String javaFileName = ctxt.getServletJavaFileName();
-            if (javaFileName != null) {
-                File javaFile = new File(javaFileName);
-                if (log.isDebugEnabled())
-                    log.debug("Deleting " + javaFile);
-                if (javaFile.exists()) {
-                    if (!javaFile.delete()) {
-                        log.warn(Localizer.getMessage(
-                                "jsp.warning.compiler.javafile.delete.fail",
-                                javaFile.getAbsolutePath()));
-                    }
+            File javaFile = new File(ctxt.getServletJavaFileName());
+            if (log.isDebugEnabled())
+                log.debug("Deleting " + javaFile);
+            if (javaFile.exists()) {
+                if (!javaFile.delete()) {
+                    log.warn(Localizer.getMessage(
+                            "jsp.warning.compiler.javafile.delete.fail",
+                            javaFile.getAbsolutePath()));
                 }
             }
         } catch (Exception e) {
@@ -569,17 +563,14 @@ public abstract class Compiler {
 
     public void removeGeneratedClassFiles() {
         try {
-            String classFileName = ctxt.getClassFileName();
-            if (classFileName != null) {
-                File classFile = new File(classFileName);
-                if (log.isDebugEnabled())
-                    log.debug("Deleting " + classFile);
-                if (classFile.exists()) {
-                    if (!classFile.delete()) {
-                        log.warn(Localizer.getMessage(
-                                "jsp.warning.compiler.classfile.delete.fail",
-                                classFile.getAbsolutePath()));
-                    }
+            File classFile = new File(ctxt.getClassFileName());
+            if (log.isDebugEnabled())
+                log.debug("Deleting " + classFile);
+            if (classFile.exists()) {
+                if (!classFile.delete()) {
+                    log.warn(Localizer.getMessage(
+                            "jsp.warning.compiler.classfile.delete.fail",
+                            classFile.getAbsolutePath()));
                 }
             }
         } catch (Exception e) {



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


Mime
View raw message