mirror of https://github.com/apache/jclouds.git
Merge pull request #751 from richardcloudsoft/issue-1033
DescribeSnapshotsResponseHandler bug parsing tags
This commit is contained in:
commit
899034097e
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue