User: vharcq
Date: 02/05/24 13:07:53
Modified: modules/ejb/src/xdoclet/modules/ejb/entity Tag:
MODULE_REFACTORING_BRANCH PkTagsHandler.java
Log:
Avoid a NPE when a PrimKeyField is defined but no getter method correspond to it
Revision Changes Path
No revision
No revision
1.1.2.5 +20 -29
xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/Attic/PkTagsHandler.java
Index: PkTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/Attic/PkTagsHandler.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -w -r1.1.2.4 -r1.1.2.5
--- PkTagsHandler.java 12 May 2002 13:53:28 -0000 1.1.2.4
+++ PkTagsHandler.java 24 May 2002 20:07:53 -0000 1.1.2.5
@@ -34,18 +34,16 @@
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Oct 16, 2001
* @xdoclet:taghandler namespace="EjbPk"
- * @version $Revision: 1.1.2.4 $
+ * @version $Revision: 1.1.2.5 $
*/
public class PkTagsHandler extends EjbTagsHandler
{
/**
* @param clazz The class to look into
- * @return The value of the ejb:bean primkey-field
- * parameter
+ * @return The value of the ejb:bean primkey-field
parameter
* @exception XDocletException
- * @throws xdoclet.XDocletException if the class doesn't have a
- * primkey-field
+ * @throws xdoclet.XDocletException if the class doesn't have a primkey-field
*/
public static String getPrimkeyFieldFor(XClass clazz) throws XDocletException
{
@@ -58,8 +56,7 @@
/**
* @param clazz The class to look into
* @param method The method to check for primkey-field
- * @return true if the method is a getter or
- * setter for the primkey-field
+ * @return true if the method is a getter or setter
for the primkey-field
* @exception XDocletException
* @throws xdoclet.XDocletException
*/
@@ -147,6 +144,10 @@
String getter = "get" + fieldName.substring(0, 1).toUpperCase() +
fieldName.substring(1);
XMethod method = PropertyTagsHandler.getXMethodForMethodName(getter);
+ if (method == null) {
+ throw new XDocletException("Could not find method " + getter + "
that is supposed to return the PrimKeyField.");
+ }
+
return method.returnType().toString();
}
@@ -216,12 +217,10 @@
/**
- * Returns true if the clazz has a primkey-field defined on the ejb:bean tag
- * (opposed to having a separate PK class)
+ * Returns true if the clazz has a primkey-field defined on the ejb:bean tag
(opposed to having a separate PK class)
*
* @param clazz The class to look into.
- * @return true if the class has a defined
- * primkey-field
+ * @return true if the class has a defined
primkey-field
* @exception XDocletException
* @throws xdoclet.XDocletException
*/
@@ -289,8 +288,7 @@
/**
- * Process the tag body if the current method is a getter or setter for the
- * primkey-field
+ * Process the tag body if the current method is a getter or setter for the
primkey-field
*
* @param template
* @param attributes
@@ -307,8 +305,7 @@
/**
- * Process the tag body if the current method is not a getter or setter for
- * the primkey-field
+ * Process the tag body if the current method is not a getter or setter for the
primkey-field
*
* @param template
* @param attributes
@@ -326,8 +323,7 @@
/**
- * Process the tag body if the current class doesn't have a defined
- * primkey-field
+ * Process the tag body if the current class doesn't have a defined
primkey-field
*
* @param template
* @param attributes
@@ -347,8 +343,7 @@
* Returns the primkey-field defined for the current class
*
* @param attributes
- * @return The value of the ejb:bean primkey-field
- * parameter
+ * @return The value of the ejb:bean primkey-field
parameter
* @exception XDocletException
* @doc:tag type="content"
*/
@@ -390,8 +385,7 @@
/**
- * Process the tag body if the current class has defined a setter for the
- * primkey-field.
+ * Process the tag body if the current class has defined a setter for the
primkey-field.
*
* @param template
* @param attributes
@@ -453,11 +447,9 @@
/**
- * Returns a string containing comma-separated list of primary key fields
- * with their types.
+ * Returns a string containing comma-separated list of primary key fields with
their types.
*
- * @return A string containing comma-separated list of
- * primary key fields without their types.
+ * @return A string containing comma-separated list of
primary key fields without their types.
* @exception XDocletException
* @see
src.xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String)
* @doc:tag type="content"
@@ -469,12 +461,11 @@
/**
- * Returns a string containing comma-separated list of primary key fields
- * getting from an object specified as parameter.
+ * Returns a string containing comma-separated list of primary key fields
getting from an object specified as
+ * parameter.
*
* @param attributes
- * @return A string containing comma-separated list of
- * primary key fields without their types.
+ * @return A string containing comma-separated list of
primary key fields without their types.
* @exception XDocletException
* @see
src.xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String)
* @doc:tag type="content"
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel