You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by GitBox <gi...@apache.org> on 2021/04/04 01:56:40 UTC

[GitHub] [jclouds] gaul commented on a change in pull request #103: Do not assume Owner ID comes first in XML for S3

gaul commented on a change in pull request #103:
URL: https://github.com/apache/jclouds/pull/103#discussion_r606733441



##########
File path: apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java
##########
@@ -56,9 +57,18 @@ public ListAllMyBucketsHandler(DateService dateParser) {
 
    public void endElement(String uri, String name, String qName) {
       if (qName.equals("ID")) { // owner stuff
-         currentOwner = new CanonicalUser(currentOrNull(currentText));
+         if (currentDisplayName == null) {
+            currentOwner = new CanonicalUser(currentOrNull(currentText));
+         } else {
+            currentOwner = new CanonicalUser(
+               currentOrNull(currentText), currentDisplayName);
+         }
       } else if (qName.equals("DisplayName")) {
-         currentOwner.setDisplayName(currentOrNull(currentText));
+         if (currentOwner == null) {
+            currentDisplayName = currentOrNull(currentText);
+         } else {
+            currentOwner.setDisplayName(currentOrNull(currentText));

Review comment:
       The original code is wrong here.  Instead what I think would improve it is storing `id` and `displayName` as `String`s then putting this conditional in the Bucket clause.  Note that you will want to set these fields to `null` as well.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org