[ 
https://issues.apache.org/jira/browse/JCLOUDS-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16746054#comment-16746054
 ] 

Biswa Ranjan Ray commented on JCLOUDS-1483:
-------------------------------------------

_Trial 1:_
 _b. Build failed because of testcase failure at line 117 of 
testReplaceManifestUnicodeUTF8() method in StaticLargeObjectApiMockTest class._

I could able to fix the build issue but I had to set UTF8 encoding in java and 
maven: 
 *set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8*
 *set MAVEN_OPTS=-Duser.language=en -Dfile.encoding=UTF-8*
 Shouldn't it be handle by pom?

_Trial 2:_
 _c. It still throws the same exception as reported earlier :_
 _com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: 
Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $_
 _This is very strange. Do you run your tests against OpenStack Swift or 
another implementation?_
  
 Putting the steps just to make sure if I'm doing right.
 Step 1. I forked the project from [jclouds|https://github.com/apache/jclouds] 
and cloned into my system.

Step 2. I modified 
[StaticLargeObjectApi|https://github.com/apache/jclouds/blob/master/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApi.java]
 by replacing the existing code at line at 117 with 
 *@QueryParams(keys = \{"format", "multipart-manifest"}, values = \{"json", 
"delete"})*

Step 3. Then Modified 
[StaticLargeObjectApiMockTest|https://github.com/apache/jclouds/blob/master/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java]
 by replacing the existing code at line 230 and 252 with 
 *assertRequest(server.takeRequest(), "DELETE", 
"/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?format=json&multipart-manifest=delete");*

Step 4. To ensure if my changes are taken into effect, I added a print stmt in 
removeBlob() method of RegionScopedSwiftBlobStore class to print the container 
name.

Step 5. Triggered a build on 
[openstack-swift|https://github.com/apache/jclouds/tree/master/apis/openstack-swift]
 project and added this to my project pom. Debugged and found the container 
name is printed when attempted to delete a blob.

It still throws: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
 Am I missing anything?

> Removing a blob from a Swift container using BlobStore.removeBlob fails.
> ------------------------------------------------------------------------
>
>                 Key: JCLOUDS-1483
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1483
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 2.1.1
>            Reporter: Biswa Ranjan Ray
>            Priority: Major
>              Labels: openstack-swift
>         Attachments: BuildException.txt, NullPointerException.txt, 
> StaticLargeObjectApiMockTest.html, stacktrace.txt
>
>
>  
> *Usecase*: Try to delete a blob (size ~ 107kb) from a swift container using 
> BlobStore.removBlob() api of jclouds.
> *Issue*: Following exception is found in console: 
> com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: 
> *Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $*.
> *Code*: Sharing the code snippet that I've used to delete a blob from a swift 
> container.
> BlobStore blobStore = getBlobStoreContext();              
> blobStore.removeBlob(containerName, fileName);
> {code:java}
> //To get the BlobStoreContext for OpenStack Swift
> private BlobStoreContext getBlobStoreContext() {
>  final Properties override = new Properties();
>  override.put(KeystoneProperties.KEYSTONE_VERSION, "3");
>  override.put(KeystoneProperties.SCOPE, "project:" + 
> swiftConfig.getProject());
>  
>  final String credential = swiftConfig.getPassword();
>  final String identity = swiftConfig.getUserDomain() + ":" + 
> swiftConfig.getUsername();
>  final String authUrl = swiftConfig.getAuthUrl();
>  
>  return ContextBuilder.newBuilder("openstack-swift")
>  .endpoint(authUrl+"/v3")
>  .credentials(identity,credential)
>  .overrides(override)
>  .buildApi(BlobStoreContext.class);
>  }
> {code}
>  *Debug:* Following are my observations after debugging the code.
>  # The type of the blobstore is found to be RegionScopedSwiftBlobStore.
>  # stepinto blobStore.*removeBlob*(containerName, fileName);                  
>                       at line 396 in *RegionScopedSwiftBlobStore* class, I 
> found it expects a response from *StaticLargeObjectApi* as shown in the below 
> code and this is where the exception occurs:                                  
>                    **                                                  
> DeleteStaticLargeObjectResponse response = 
> api.getStaticLargeObjectApi(regionId, container).delete(name); 
> *Analysis*: While the api BlobStore.removeBlob fails to delete a blob in a 
> Swift container, it works fine in AWS S3 and GCS container. I also observed 
> that if I use *ObjectApi.delete(objectName)* instead of 
> *BlobStore.removeBlob* then the blob gets deleted from the swift container 
> without any issue. As per the java doc of StaticLargeObjectApi, it is in beta 
> and still under evaluation. Is this api stable?
> Any help is highly appreciated.
> Thank you.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to