Update of /cvsroot/displaytag/display09/src/org/displaytag/util
In directory sc8-pr-cvs1:/tmp/cvs-serv23353/src/org/displaytag/util
Modified Files:
LookupUtil.java
Log Message:
updated to throw ObjectLookupException instead of JspException
Index: LookupUtil.java
===================================================================
RCS file: /cvsroot/displaytag/display09/src/org/displaytag/util/LookupUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LookupUtil.java 21 Jun 2003 12:34:50 -0000 1.1
--- LookupUtil.java 22 Jun 2003 16:13:02 -0000 1.2
***************
*** 3,7 ****
import java.lang.reflect.InvocationTargetException;
- import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
--- 3,6 ----
***************
*** 9,14 ****
--- 8,15 ----
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+ import org.displaytag.exception.ObjectLookupException;
/**
+ * <p>Utility class with methods for object & properties retrieving</p>
* @author fgiust
* @version $Revision$ ($Author$)
***************
*** 23,27 ****
/**
! * Constructor for LookupUtil
*/
private LookupUtil()
--- 24,28 ----
/**
! * don't instantiate a LookupUtil
*/
private LookupUtil()
***************
*** 29,38 ****
}
-
/**
! * Legge un attrubuto dal pageContext con lo scope specificato.
* @param pPageContext PageContext
! * @param pBeanAndPropertyName String nome del Bean pi� eventuali attributi
! * @param pScope Pu� assumere i valori:
* <ul>
* <li>PageContext.PAGE_SCOPE</li>
--- 30,38 ----
}
/**
! * Read an object from the pagecontext with the specified scope and eventually
lookup a property in it
* @param pPageContext PageContext
! * @param pBeanAndPropertyName String expression with bean name and attributes
! * @param pScope One of the following values:
* <ul>
* <li>PageContext.PAGE_SCOPE</li>
***************
*** 42,49 ****
* </ul>
* @return Object
! * @throws JspException in caso di errori durante il lookup della propriet�
del bean
*/
public static Object getBeanValue(PageContext pPageContext, String
pBeanAndPropertyName, int pScope)
! throws JspException
{
--- 42,49 ----
* </ul>
* @return Object
! * @throws ObjectLookupException for errors while retrieving a property in the
bean
*/
public static Object getBeanValue(PageContext pPageContext, String
pBeanAndPropertyName, int pScope)
! throws ObjectLookupException
{
***************
*** 71,90 ****
// go get the property
! try
! {
! return PropertyUtils.getProperty(lBeanObject,
lBeanProperty);
! }
! catch (IllegalAccessException e)
! {
! throw new JspException(e.getMessage());
! }
! catch (InvocationTargetException e)
! {
! throw new JspException(e.getMessage());
! }
! catch (NoSuchMethodException e)
! {
! throw new JspException(e.getMessage());
! }
}
--- 71,75 ----
// go get the property
! return getBeanProperty(lBeanObject, lBeanProperty);
}
***************
*** 100,103 ****
--- 85,117 ----
return pPageContext.getAttribute(pBeanAndPropertyName, pScope);
}
+ }
+
+ /**
+ * Returns the value of a property in the given bean
+ * @param pBean javabean
+ * @param pPropertyName name of the property to read from the javabean
+ * @return Object
+ * @throws ObjectLookupException for errors while retrieving a property in the
bean
+ */
+ public static Object getBeanProperty(Object pBean, String pPropertyName)
throws ObjectLookupException
+ {
+
+ try
+ {
+ return PropertyUtils.getProperty(pBean, pPropertyName);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ObjectLookupException(LookupUtil.class, pBean,
pPropertyName, e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new ObjectLookupException(LookupUtil.class, pBean,
pPropertyName, e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new ObjectLookupException(LookupUtil.class, pBean,
pPropertyName, e);
+ }
+
}
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel