struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tur...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html BaseHandlerTag.java
Date Sun, 05 Jan 2003 01:44:08 GMT
turner      2003/01/04 17:44:08

  Modified:    src/share/org/apache/struts/taglib/html BaseHandlerTag.java
  Log:
  Couple of tweaks suggested by Martin C.
  
  Revision  Changes    Path
  1.23      +32 -12    jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java
  
  Index: BaseHandlerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseHandlerTag.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- BaseHandlerTag.java	5 Jan 2003 01:40:44 -0000	1.22
  +++ BaseHandlerTag.java	5 Jan 2003 01:44:08 -0000	1.23
  @@ -72,6 +72,8 @@
   import org.apache.struts.util.RequestUtils;
   import java.lang.reflect.Method;
   import java.lang.reflect.InvocationTargetException;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   /**
    * Base class for tags that render form elements capable of including JavaScript
  @@ -86,6 +88,11 @@
   
   public abstract class BaseHandlerTag extends BodyTagSupport {
   
  +    /**
  +     * Commons Logging instance.
  +     */
  +    private static Log log = LogFactory.getLog(BaseHandlerTag.class);
  +
       // ----------------------------------------------------- Instance Variables
   
       /**
  @@ -585,30 +592,43 @@
   	    triedJstlInit = true;
   	    try {
   		loopTagSupportClass = 
  -		    Class.forName("javax.servlet.jsp.jstl.core.LoopTagSupport");
  +		    RequestUtils.applicationClass("javax.servlet.jsp.jstl.core.LoopTagSupport");
   		loopTagSupportGetStatus = 
   		    loopTagSupportClass.getDeclaredMethod("getLoopStatus", null);
   		loopTagStatusClass =
  -		    Class.forName("javax.servlet.jsp.jstl.core.LoopTagStatus");
  +		    RequestUtils.applicationClass("javax.servlet.jsp.jstl.core.LoopTagStatus");
   		loopTagStatusGetIndex = 
   		    loopTagStatusClass.getDeclaredMethod("getIndex", null);
   		triedJstlSuccess = true;
   	    }
  +	    // These just mean that JSTL isn't loaded, so ignore
   	    catch (ClassNotFoundException ex) {}
   	    catch (NoSuchMethodException ex) {}
   	}
   	if (triedJstlSuccess) {
   	    try {
   		Object loopTag = findAncestorWithClass(this, loopTagSupportClass);
  -		if (loopTag == null)  return null;
  +		if (loopTag == null)  {
  +		    return null;
  +		}
   		Object status = loopTagSupportGetStatus.invoke(loopTag, null);
   		return (Integer) loopTagStatusGetIndex.invoke(status, null);
   	    } 
  -	    catch (IllegalAccessException ex) {}
  -	    catch (IllegalArgumentException ex) {}
  -	    catch (InvocationTargetException ex) {}
  -	    catch (NullPointerException ex) {}
  -	    catch (ExceptionInInitializerError ex) {}
  +	    catch (IllegalAccessException ex) {
  +		log.error(ex.getMessage(), ex);
  +	    }
  +	    catch (IllegalArgumentException ex) {
  +		log.error(ex.getMessage(), ex);
  +	    }
  +	    catch (InvocationTargetException ex) {
  +		log.error(ex.getMessage(), ex);
  +	    }
  +	    catch (NullPointerException ex) {
  +		log.error(ex.getMessage(), ex);
  +	    }
  +	    catch (ExceptionInInitializerError ex) {
  +		log.error(ex.getMessage(), ex);
  +	    }
   	}
   	return null;
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message