Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.1
-
Fix Version/s: 1.2.2
-
Component/s: Aegis Module
-
Labels:None
-
Number of attachments :
Description
JDOMReader has a problem with its getNextAttributeReader() method. Take the following example code:
Element root = new Element("root"); root.setAttribute("id", "foo"); JDOMReader reader = new JDOMReader(root); if (reader.hasMoreAttributeReaders()) { // This throws an IndexOutOfBoundsException MessageReader nextReader = reader.getNextAttributeReader(); }
The second line of getNextAttributeReader() is throwing an IndexOutOfBoundsException:
public MessageReader getNextAttributeReader() { currentAttribute++; Attribute att = (Attribute) element.getAttributes().get(currentAttribute); return new AttributeReader(new QName(att.getNamespaceURI(), att.getName()), att.getValue()); }
The attribute that should be retrieved is currentAttribute - 1 since currentAttribute is incremented first.
This is causing an IndexOutOfBoundsException to be thrown on the last (or in this case the only) attribute.
Good catch. Thanks, we'll fix this shortly.