You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/06/06 13:06:45 UTC

svn commit: r1833024 - in /tomcat/trunk/java/org/apache: jasper/resources/ jasper/runtime/ tomcat/util/modeler/

Author: markt
Date: Wed Jun  6 13:06:45 2018
New Revision: 1833024

URL: http://svn.apache.org/viewvc?rev=1833024&view=rev
Log:
SpotBugs: Remove unreachable code
A little format clean-up

Modified:
    tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
    tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_fr.properties
    tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_ja.properties
    tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java

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=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Wed Jun  6 13:06:45 2018
@@ -83,7 +83,6 @@ jsp.error.file.not.registered=file [{0}]
 jsp.error.quotes.unterminated=Unterminated quotes
 jsp.error.attr.quoted=Attribute value should be quoted
 jsp.error.beans.nullbean=Attempted a bean operation on a null object.
-jsp.error.beans.nobeaninfo=No BeanInfo for the bean of type [{0}] could be found, the class likely does not exist.
 jsp.error.beans.nomethod=Cannot find a method to read property [{0}] in a bean of type [{1}]
 jsp.error.beans.nomethod.setproperty=Can''t find a method to write property [{0}] of type [{1}] in a bean of type [{2}]
 jsp.error.beans.noproperty=Cannot find any information on property [{0}] in a bean of type [{1}]

Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_es.properties?rev=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_es.properties Wed Jun  6 13:06:45 2018
@@ -80,7 +80,6 @@ jsp.error.file.not.registered = Archivo
 jsp.error.quotes.unterminated = Comillas no terminadas
 jsp.error.attr.quoted = El valor del atributo deber\u00EDa ir entre comillas
 jsp.error.beans.nullbean = Se ha intentado una operaci\u00F3n de bean en un objeto nulo
-jsp.error.beans.nobeaninfo = No se puede encontrar BeanInfo para el bean  [{0}] seguramente la clase no existe
 jsp.error.beans.nomethod = No puedo encontrar un m\u00E9todo para leer la propiedad [{0}] en un bean del tipo [{1}]
 jsp.error.beans.nomethod.setproperty = No puedo encontrar un m\u00E9todo para escribir la propiedad [{0}] en un bean del tipo [{2}]
 jsp.error.beans.noproperty = No puedo encontrar informaci\u00F3n de la propiedad [{0}] en un bean del tipo [{1}]

Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_fr.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_fr.properties?rev=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_fr.properties (original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_fr.properties Wed Jun  6 13:06:45 2018
@@ -54,7 +54,6 @@ jsp.error.file.not.registered=Le fichier
 jsp.error.quotes.unterminated=guillemets non termin\u00e9s
 jsp.error.attr.quoted=La valeur de l''attribute doit \u00eatre entre guillemets
 jsp.error.beans.nullbean=Tentative d''op\u00e9ration bean sur un objet nul.
-jsp.error.beans.nobeaninfo=Pas d''information bean (BeanInfo) pour le bean de type [{0}] n''a pu \u00eatre trouv\u00e9e, la classe n''existe probablement pas.
 jsp.error.beans.nomethod=Impossible de trouver une m\u00e9thode pour lire la propri\u00e9t\u00e9 [{0}] dans le bean de type [{1}]
 jsp.error.beans.nomethod.setproperty=Impossible de trouver une m\u00e9thode pour mettre \u00e0 jour la propri\u00e9t\u00e9 [{0}] de type [{1}]dans le bean de type [{2}]
 jsp.error.beans.noproperty==Impossible de trouver de l''information sur la propri\u00e9t\u00e9 [{0}] dans le bean de type [{1}]

Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_ja.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_ja.properties?rev=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_ja.properties (original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings_ja.properties Wed Jun  6 13:06:45 2018
@@ -74,7 +74,6 @@ jsp.error.file.not.registered=include\u5
 jsp.error.quotes.unterminated=\u5f15\u7528\u7b26\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u305b\u3093
 jsp.error.attr.quoted=\u5c5e\u6027\u5024\u306f\u5f15\u7528\u7b26\u3067\u56f2\u308f\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093
 jsp.error.beans.nullbean=null\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306bBean\u64cd\u4f5c\u3092\u304a\u3053\u306a\u304a\u3046\u3068\u3057\u307e\u3057\u305f
-jsp.error.beans.nobeaninfo=\u30bf\u30a4\u30d7 [{0}] \u306eBean\u306bBeanInfo\u304c\u306a\u3044\u306e\u3092\u691c\u51fa\u3057\u307e\u3057\u305f, \u30af\u30e9\u30b9\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093
 jsp.error.beans.nomethod=\u30bf\u30a4\u30d7 [{1}] \u306eBean\u4e2d\u306e\u5c5e\u6027 [{0}] \u3092\u8aad\u307f\u8fbc\u3080\u30e1\u30bd\u30c3\u30c9\u3092\u767a\u898b\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
 jsp.error.beans.nomethod.setproperty=\u30bf\u30a4\u30d7[{2}]\u306eBean\u306e\u30bf\u30a4\u30d7 [{1}] \u306e\u5c5e\u6027 [{0}] \u3092\u66f8\u304d\u8fbc\u3080\u30e1\u30bd\u30c3\u30c9\u3092\u767a\u898b\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
 jsp.error.beans.noproperty=\u30bf\u30a4\u30d7 [{1}] \u306ebean\u4e2d\u306e\u5c5e\u6027 [{0}] \u306e\u60c5\u5831\u3092\u767a\u898b\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java?rev=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java Wed Jun  6 13:06:45 2018
@@ -692,39 +692,26 @@ public class JspRuntimeLibrary {
         Method method = null;
         Class<?> type = null;
         try {
-            java.beans.BeanInfo info
-                = java.beans.Introspector.getBeanInfo(beanClass);
-            if ( info != null ) {
-                java.beans.PropertyDescriptor pd[]
-                    = info.getPropertyDescriptors();
-                for (int i = 0 ; i < pd.length ; i++) {
-                    if ( pd[i].getName().equals(prop) ) {
-                        method = pd[i].getWriteMethod();
-                        type   = pd[i].getPropertyType();
-                        break;
-                    }
+            java.beans.BeanInfo info = java.beans.Introspector.getBeanInfo(beanClass);
+            java.beans.PropertyDescriptor pd[] = info.getPropertyDescriptors();
+            for (int i = 0 ; i < pd.length ; i++) {
+                if ( pd[i].getName().equals(prop) ) {
+                    method = pd[i].getWriteMethod();
+                    type = pd[i].getPropertyType();
+                    break;
                 }
-            } else {
-                // just in case introspection silently fails.
-                throw new JasperException(
-                    Localizer.getMessage("jsp.error.beans.nobeaninfo",
-                                         beanClass.getName()));
             }
         } catch (Exception ex) {
             throw new JasperException (ex);
         }
         if (method == null) {
             if (type == null) {
-                throw new JasperException(
-                        Localizer.getMessage("jsp.error.beans.noproperty",
-                                             prop,
-                                             beanClass.getName()));
+                throw new JasperException(Localizer.getMessage(
+                        "jsp.error.beans.noproperty", prop, beanClass.getName()));
             } else {
-                throw new JasperException(
-                    Localizer.getMessage("jsp.error.beans.nomethod.setproperty",
-                                         prop,
-                                         type.getName(),
-                                         beanClass.getName()));
+                throw new JasperException(Localizer.getMessage(
+                        "jsp.error.beans.nomethod.setproperty",
+                        prop, type.getName(), beanClass.getName()));
             }
         }
         return method;
@@ -736,36 +723,25 @@ public class JspRuntimeLibrary {
         Method method = null;
         Class<?> type = null;
         try {
-            java.beans.BeanInfo info
-                = java.beans.Introspector.getBeanInfo(beanClass);
-            if ( info != null ) {
-                java.beans.PropertyDescriptor pd[]
-                    = info.getPropertyDescriptors();
-                for (int i = 0 ; i < pd.length ; i++) {
-                    if ( pd[i].getName().equals(prop) ) {
-                        method = pd[i].getReadMethod();
-                        type   = pd[i].getPropertyType();
-                        break;
-                    }
+            java.beans.BeanInfo info = java.beans.Introspector.getBeanInfo(beanClass);
+            java.beans.PropertyDescriptor pd[] = info.getPropertyDescriptors();
+            for (int i = 0 ; i < pd.length ; i++) {
+                if (pd[i].getName().equals(prop)) {
+                    method = pd[i].getReadMethod();
+                    type = pd[i].getPropertyType();
+                    break;
                 }
-            } else {
-                // just in case introspection silently fails.
-                throw new JasperException(
-                    Localizer.getMessage("jsp.error.beans.nobeaninfo",
-                                         beanClass.getName()));
             }
         } catch (Exception ex) {
             throw new JasperException (ex);
         }
         if (method == null) {
             if (type == null) {
-                throw new JasperException(
-                    Localizer.getMessage("jsp.error.beans.noproperty", prop,
-                                         beanClass.getName()));
+                throw new JasperException(Localizer.getMessage(
+                        "jsp.error.beans.noproperty", prop, beanClass.getName()));
             } else {
-                throw new JasperException(
-                    Localizer.getMessage("jsp.error.beans.nomethod", prop,
-                                         beanClass.getName()));
+                throw new JasperException(Localizer.getMessage(
+                        "jsp.error.beans.nomethod", prop, beanClass.getName()));
             }
         }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java?rev=1833024&r1=1833023&r2=1833024&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java Wed Jun  6 13:06:45 2018
@@ -434,8 +434,6 @@ public class ManagedBean implements java
             throw new AttributeNotFoundException(" Cannot find attribute " + aname + " for " + resource);
 
         String getMethod = attrInfo.getGetMethod();
-        if (getMethod == null)
-            throw new AttributeNotFoundException("Cannot find attribute " + aname + " get method name");
 
         Object object = null;
         NoSuchMethodException exception = null;
@@ -445,7 +443,7 @@ public class ManagedBean implements java
         } catch (NoSuchMethodException e) {
             exception = e;
         }
-        if (m== null && resource != null) {
+        if (m == null && resource != null) {
             try {
                 object = resource;
                 m = object.getClass().getMethod(getMethod, NO_ARGS_PARAM_SIG);
@@ -454,9 +452,10 @@ public class ManagedBean implements java
                 exception = e;
             }
         }
-        if (exception != null)
+        if (exception != null) {
             throw new ReflectionException(exception,
                                           "Cannot find getter method " + getMethod);
+        }
 
         return m;
     }



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