From user-return-2847-archive-asf-public=cust-asf.ponee.io@jclouds.apache.org Wed Aug 22 11:34:10 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E53A4180662 for ; Wed, 22 Aug 2018 11:34:09 +0200 (CEST) Received: (qmail 56104 invoked by uid 500); 22 Aug 2018 09:34:08 -0000 Mailing-List: contact user-help@jclouds.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@jclouds.apache.org Delivered-To: mailing list user@jclouds.apache.org Received: (qmail 56094 invoked by uid 99); 22 Aug 2018 09:34:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Aug 2018 09:34:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 5D300C1358 for ; Wed, 22 Aug 2018 09:34:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.97 X-Spam-Level: * X-Spam-Status: No, score=1.97 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_DKIMWL_WL_MED=-0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=byjean-eu.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id YqV9CA4f_dzP for ; Wed, 22 Aug 2018 09:34:06 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id CEA405F2C5 for ; Wed, 22 Aug 2018 09:34:05 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id y2-v6so1403042wma.1 for ; Wed, 22 Aug 2018 02:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=byjean-eu.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=7lqvEbKDK+ygXcOQlQSMVJCV2zx+/q7x6f0fPe/k2ug=; b=s+eE5e1Vim5kK/oGUy94cTf7cyY+r7W3wX1DcXDUFDT29wnlqJCliLd0j62yRTmtTq 29e+Y77k5rSPX1tK9gST+fFef4q8jzHLSzNmammAN1j4bjaGQhl+FWilZC46FnR5a9Tx 9bZPb6kUbYcvfZF24wS4ktz1qn/9Db6EcXyJvRB3B13ZSAZpeXZaelN/nYcCvhkIW2xT LEz/SzMnvayUGL4fevIDqEtakI8He2cZQ7GhsAjKRvG2dq7yNsXQkwidH9jB8w9XLGrr SZxN+8YyYG9S6HaxEJRPlWcGxSNsdQIkVMHbfhOQD+h9ABLddyqPg3I6fdXv2/R2Ekb5 MoSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7lqvEbKDK+ygXcOQlQSMVJCV2zx+/q7x6f0fPe/k2ug=; b=aMveDB4UzegoImlQaImzmS2tQ7VdImu/v4l0NgojLGAivmil1MuM7sqB+4R3VnlyxQ VzL/ZPec4REduaKlQ84y4OKdDpmvWYIO/YGfwe8UkldltVF/sncJtFnzluqoVRy509DR LJFg2TgVI5tzTNu0dlp5g+IXtwqOsD8OEJp1W4ph+B7BpFKBZTZYAQYIJUxfC5PnjmV1 ktbY6eHHjSaxWzX5du/D4uE29tT7IL7LKuqHxRjFCcR/6/xSdhGYbJCe52FMoC9Ot/p1 VsClyyjvF3Mm4M8k1quuaKoROoNSbSAu6ngUVNvsxQU+x0WGX5S8ZyF8ACEQDhm+J2p8 GhLA== X-Gm-Message-State: APzg51A9OLawWea36M9lTNv5mLoOgfDLkGsTvPPLCHxxACW2hhX/sHg1 8XzOFl5wHJGfNT+oIimaB4mLQwgGnPTqpL3VqDzjqj73 X-Google-Smtp-Source: ANB0Vdb/kbF01KlhUXAhiwobe6sdZADRh9tyw8E9wYywN+XxErfEoJGlxmbaJ4qeFSej1FyBvmPJWD1l2zRTac4W9yU= X-Received: by 2002:a1c:7ed3:: with SMTP id z202-v6mr1832470wmc.139.1534930439256; Wed, 22 Aug 2018 02:33:59 -0700 (PDT) MIME-Version: 1.0 From: Jean Helou Date: Wed, 22 Aug 2018 11:33:48 +0200 Message-ID: Subject: NullPointer in BlobStore#streamBlob using RegionScopedSwiftBlobStore (2.1.1) To: user@jclouds.apache.org Content-Type: multipart/alternative; boundary="000000000000964f37057402d7d7" --000000000000964f37057402d7d7 Content-Type: text/plain; charset="UTF-8" Hello, I am currently working on integrating JClouds to create a blobstore storage for apache james. I noticed that using blobStore.streamBlob("container", "wrongid"); yields a NullPointerException when trying to access a blob which doesn't exist. The NPE is raised in RegionScopedSwiftBlobStore when the streamBlob method tries to read the blob metadata. I think it should null check and return null or an empty inputstream but not raise an NPE see https://github.com/jclouds/jclouds /blob/46759f8bda00f86ef934345846e22e2bd2b0d7ae/apis/openstack-swift/src/main/java/org/ jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java#L691 for now I work around by using blobStore.getBlob("container","id"); doing the nullcheck myself and then getting the inputstream from the blob's payload. best regards, jean --000000000000964f37057402d7d7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,=C2=A0

I am currently working = on integrating=C2=A0JClouds=C2=A0to create a blobstore storage for apa= che james. I noticed that using=C2=A0

=C2=A0 =C2=A0 blobStore.stream= Blob("container", "wrongid");

yields a NullPoint= erException when trying to access a blob which doesn't exist. The NPE i= s raised in RegionScopedSwiftBlobStore when the streamBlob method tries to = read the blob metadata.=C2=A0

I think it should null check and retur= n null or an empty inputstream but not raise an NPE

see=C2=A0https://github.com/jclouds/jclouds/blob/46759f8bda00f86ef934345846e22e2bd2b0d7ae/apis/open= stack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/Reg= ionScopedSwiftBlobStore.java#L691

for now I work around by using= =C2=A0 =C2=A0 =C2=A0=C2=A0

=C2=A0 =C2=A0 blobStore.getBlob("con= tainer","id");

doing the nullcheck myself and then ge= tting the inputstream from the blob's payload.

best regards,
= jean

--000000000000964f37057402d7d7--