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 Set<Snapshot> snapshots = Sets.newLinkedHashSet();
|
||||||
private final SnapshotHandler snapshotHandler;
|
private final SnapshotHandler snapshotHandler;
|
||||||
|
private int itemDepth = 0;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DescribeSnapshotsResponseHandler(SnapshotHandler snapshotHandler) {
|
public DescribeSnapshotsResponseHandler(SnapshotHandler snapshotHandler) {
|
||||||
|
@ -50,13 +51,16 @@ public class DescribeSnapshotsResponseHandler extends ParseSax.HandlerWithResult
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String localName, String qName, Attributes attributes)
|
public void startElement(String uri, String localName, String qName, Attributes attributes)
|
||||||
throws SAXException {
|
throws SAXException {
|
||||||
|
itemDepth++;
|
||||||
snapshotHandler.startElement(uri, localName, qName, attributes);
|
snapshotHandler.startElement(uri, localName, qName, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||||
snapshotHandler.endElement(uri, localName, qName);
|
snapshotHandler.endElement(uri, localName, qName);
|
||||||
if (qName.equals("item")) {
|
itemDepth--;
|
||||||
|
|
||||||
|
if (qName.equals("item") && itemDepth == 2) {
|
||||||
this.snapshots.add(snapshotHandler.getResult());
|
this.snapshots.add(snapshotHandler.getResult());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
<ownerId>218213537122</ownerId>
|
<ownerId>218213537122</ownerId>
|
||||||
<volumeSize>10</volumeSize>
|
<volumeSize>10</volumeSize>
|
||||||
<description>Daily Backup</description>
|
<description>Daily Backup</description>
|
||||||
|
<tagSet>
|
||||||
|
<item>
|
||||||
|
<key>Name</key>
|
||||||
|
<value>example_name_tag</value>
|
||||||
|
</item>
|
||||||
|
</tagSet>
|
||||||
</item>
|
</item>
|
||||||
</snapshotSet>
|
</snapshotSet>
|
||||||
</DescribeSnapshotsResponse>
|
</DescribeSnapshotsResponse>
|
Loading…
Reference in New Issue