History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-636
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Jonny Miller
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

JDOMReader.getNextAttributeReader() throws exception in some instances when hasMoreAttributeReaders() returns true

Created: 11/Sep/06 01:06 PM   Updated: 15/Sep/06 01:47 PM
Component/s: Aegis Module
Affects Version/s: 1.2.1
Fix Version/s: 1.2.2

Time Tracking:
Not Specified


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 11/Sep/06 04:52 PM
Good catch. Thanks, we'll fix this shortly.

Dan Diephouse - 15/Sep/06 01:47 PM