Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-562

Listing objects with a space in the name with ObjectApi causes URISyntaxException

    XMLWordPrintableJSON

    Details

      Description

      1. Create a container.
      2. Upload an object with a space in the object name.
      3. Run code similar to what's below.

         private void listContainersAndObjects() {
            ContainerApi containerApi = swiftApi.containerApiInRegion("DFW");
      
            for (Container container: containerApi.list().toList()) {
               System.out.println(container.getName());
      
               ObjectApi objectApi = swiftApi.objectApiInRegionForContainer("DFW", container.getName());
      
               for (SwiftObject object: objectApi.list()) {
                  System.out.println("  " + object.getName());
               }
            }
         }
      

      It causes the URISyntaxException below.

      java.lang.IllegalArgumentException
        at java.net.URI.create(URI.java:841)
        at org.jclouds.openstack.swift.v1.functions.ParseObjectListFromResponse$ToSwiftObject.apply(ParseObjectListFromResponse.java:77)
        at org.jclouds.openstack.swift.v1.functions.ParseObjectListFromResponse$ToSwiftObject.apply(ParseObjectListFromResponse.java:68)
        at com.google.common.collect.Lists$TransformingRandomAccessList$1.transform(Lists.java:582)
        at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
        at com.rackspace.RCCCSolution.listContainersAndObjects(RCCCSolution.java:48)
        at com.rackspace.RCCCSolution.main(RCCCSolution.java:21)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.net.URISyntaxException: Illegal character in path at index 105: https://storage101.dfw1.clouddrive.com/v1/xxx/Trove/Open Cluster.txt
        at java.net.URI$Parser.fail(URI.java:2810)
        at java.net.URI$Parser.checkChars(URI.java:2983)
        at java.net.URI$Parser.parseHierarchical(URI.java:3067)
        at java.net.URI$Parser.parse(URI.java:3015)
        at java.net.URI.<init>(URI.java:577)
        at java.net.URI.create(URI.java:839)
        ... 11 more
      

        Attachments

          Activity

            People

            • Assignee:
              jdaggett Jeremy Daggett
              Reporter:
              everett-toews Everett Toews
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: