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

BlobStore.blobExists throws exception when blob does not exist

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 1.7.1, 1.9.1
    • Fix Version/s: None
    • Component/s: jclouds-blobstore
    • Labels:
    • Environment:
      Operating System Version: Ubuntu 14.04
      Cloud and API Version: Ceph 0.94, Rados 0.94
      java version "1.7.0_91"

      Description

      I get exeption when I try to call blobExits(container, name) with valid container and invalid name. Jclouds javadoc does not document this behavior.

      stacktrace:

      org.jclouds.http.HttpResponseException: request: HEAD http://swift.ceph.myhost/swift/v1/gkikolashvili-2016-01-12/1cfeb96cccc6569703dcdba64354ee5a-fb66d02f-f2a4-4a4b-90a9-1106b66a014aa HTTP/1.1 failed with response: HTTP/1.1 404 Not Found
      	at org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse.handleError(ParseSwiftErrorFromHttpResponse.java:55)
      	at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:67)
      	at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:180)
      	at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:150)
      	at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:129)
      	at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:95)
      	at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:56)
      	at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
      	at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
      	at com.sun.proxy.$Proxy132.objectExists(Unknown Source)
      	at org.jclouds.openstack.swift.blobstore.SwiftBlobStore.blobExists(SwiftBlobStore.java:163)
      	at nbs.core.SwiftClient.blobExits(SwiftClient.java:97)
      	at nbs.core.SwiftClient.get(SwiftClient.java:58)
      	at nbs.service.v3.BlobService.download(BlobService.java:50)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
      	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
      	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
      	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      

      Wireshark:

      HEAD /swift/v1/2016-01-12/1cfeb96cccc6569703dcdba64354ee5a-fb66d02f-f2a4-4a4b-90a9-1106b66a014aa HTTP/1.1
      Accept: */*
      X-Auth-Token: AUTH_rgwtk13000000676b696b6f6c61736876696c693a737769667487e0fb02ef37dc8cab09965672c6bb337e5dac95895f55a146d11c6c17faeaa0b302c3e9
      User-Agent: jclouds/1.9.1 java/1.7.0_91
      Cache-Control: no-cache
      Pragma: no-cache
      Host: swift.ceph.myhost
      Connection: keep-alive
      
      HTTP/1.1 404 Not Found
      X-Trans-Id: tx000000000000000e5d2d5-005694b940-2a7d634-main
      Content-Length: 9
      Accept-Ranges: bytes
      Content-type: text/plain; charset=utf-8
      Date: Tue, 12 Jan 2016 08:28:48 GMT
      Connection: Keep-Alive
      

      maven dependency:

      <dependency>
          <groupId>org.apache.jclouds</groupId>
          <artifactId>jclouds-allblobstore</artifactId>
          <version>1.9.1</version>
      </dependency>
      

      workaround:

      // workaround to blobExits method throwing exception when blob does not exit
          private boolean blobExits(BlobStore blobStore, String container, String name) {
              try {
                  blobStore.blobExists(container, name);
              } catch (Exception e) {
                  e.printStackTrace();
                  return false;
              }
              return true;
          }
      

        Attachments

          Activity

            People

            • Assignee:
              zack-s Zack Shoylev
              Reporter:
              gkiko Giorgi Kikolashvili
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: