Merge pull request #751 from richardcloudsoft/issue-1033

DescribeSnapshotsResponseHandler bug parsing tags
This commit is contained in:
Adrian Cole 2012-07-25 10:13:28 -07:00
commit 899034097e
2 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public class DescribeSnapshotsResponseHandler extends ParseSax.HandlerWithResult
private Set<Snapshot> snapshots = Sets.newLinkedHashSet();
private final SnapshotHandler snapshotHandler;
private int itemDepth = 0;
@Inject
public DescribeSnapshotsResponseHandler(SnapshotHandler snapshotHandler) {
@ -50,13 +51,16 @@ public class DescribeSnapshotsResponseHandler extends ParseSax.HandlerWithResult
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
itemDepth++;
snapshotHandler.startElement(uri, localName, qName, attributes);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
snapshotHandler.endElement(uri, localName, qName);
if (qName.equals("item")) {
itemDepth--;
if (qName.equals("item") && itemDepth == 2) {
this.snapshots.add(snapshotHandler.getResult());
}
}

View File

@ -9,6 +9,12 @@
<ownerId>218213537122</ownerId>
<volumeSize>10</volumeSize>
<description>Daily Backup</description>
<tagSet>
<item>
<key>Name</key>
<value>example_name_tag</value>
</item>
</tagSet>
</item>
</snapshotSet>
</DescribeSnapshotsResponse>