You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2003/06/05 22:59:17 UTC
cvs commit: jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester TestXMLIntrospectorHelper.java
rdonkin 2003/06/05 13:59:16
Modified: betwixt/src/java/org/apache/commons/betwixt/digester
XMLIntrospectorHelper.java
betwixt/src/test/org/apache/commons/betwixt/digester
TestXMLIntrospectorHelper.java
Log:
Added check for null type passed into isLoopType method.
Revision Changes Path
1.21 +7 -2 jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/XMLIntrospectorHelper.java
Index: XMLIntrospectorHelper.java
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/XMLIntrospectorHelper.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XMLIntrospectorHelper.java 11 Apr 2003 21:27:41 -0000 1.20
+++ XMLIntrospectorHelper.java 5 Jun 2003 20:59:16 -0000 1.21
@@ -569,9 +569,14 @@
* Is this a loop type class?
*
* @param type is this <code>Class</code> a loop type?
- * @return true if the type is a loop type
+ * @return true if the type is a loop type, or if type is null
*/
public static boolean isLoopType(Class type) {
+ // check for NPEs
+ if (type == null) {
+ log.trace("isLoopType: type is null");
+ return false;
+ }
return type.isArray()
|| Map.class.isAssignableFrom( type )
|| Collection.class.isAssignableFrom( type )
1.3 +9 -5 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestXMLIntrospectorHelper.java
Index: TestXMLIntrospectorHelper.java
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestXMLIntrospectorHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestXMLIntrospectorHelper.java 30 Dec 2002 18:16:48 -0000 1.2
+++ TestXMLIntrospectorHelper.java 5 Jun 2003 20:59:16 -0000 1.3
@@ -114,6 +114,10 @@
assertNotNull("projectNames property not found", projectNamesProperty);
assertEquals("project names property", "project-names", projectNamesProperty.getLocalName());
}
+
+ public void testNullParameters() throws Exception {
+ XMLIntrospectorHelper.isLoopType(null);
+ }
/**
* Find the specified property and convert it into a descriptor.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org