You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by le...@apache.org on 2003/09/25 01:03:08 UTC
cvs commit: jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes AttributeUtil.java
leosutic 2003/09/24 16:03:08
Modified: attributes/api/src/java/org/apache/commons/attributes
AttributeUtil.java
Log:
Fixed bug pointed out to me by Dan Diephouse:
I found a bug in AttributeUtil in the method
"getObjectsWithAttributeType". Looks like a cut and paste error.
Basically, it isn't filtering out the objects correctly, but it is
instead returning classes... It is the exact same code as
"getClassesWithAttributeType" - which doesn't seem right.
Revision Changes Path
1.2 +5 -4 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/AttributeUtil.java
Index: AttributeUtil.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/AttributeUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AttributeUtil.java 24 Aug 2003 17:47:59 -0000 1.1
+++ AttributeUtil.java 24 Sep 2003 23:03:08 -0000 1.2
@@ -92,19 +92,20 @@
}
/**
- * Filters a collection objects. The returned collection
+ * Filters a collection of objects. The returned collection
* only contains those objects that have an attribute of the specified type.
*/
public static Collection getObjectsWithAttributeType (Collection objects, Class attributeClass) {
ArrayList result = new ArrayList ();
Iterator iter = objects.iterator ();
while (iter.hasNext ()) {
- Class clazz = (Class) iter.next ().getClass ();
+ Object object = iter.next ();
+ Class clazz = object.getClass ();
if (Attributes.hasAttributeType (clazz, attributeClass)) {
- result.add (clazz);
+ result.add (object);
}
}
- return result;
+ return result;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org