FGCP: throw IAE instead of AuthorizationException when pem can't be parsed
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/449c095f Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/449c095f Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/449c095f Branch: refs/heads/master Commit: 449c095fd7a3f590b5122bda8cd71fdb586d977d Parents: d3a180e Author: Dies Koper <[email protected]> Authored: Wed May 22 15:25:33 2013 +1000 Committer: Andrew Gaul <[email protected]> Committed: Thu May 23 16:21:51 2013 -0700 ---------------------------------------------------------------------- .../fgcp/suppliers/FGCPCredentialsSupplier.java | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/449c095f/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/suppliers/FGCPCredentialsSupplier.java ---------------------------------------------------------------------- diff --git a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/suppliers/FGCPCredentialsSupplier.java b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/suppliers/FGCPCredentialsSupplier.java index 59d99ed..af09422 100644 --- a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/suppliers/FGCPCredentialsSupplier.java +++ b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/suppliers/FGCPCredentialsSupplier.java @@ -35,7 +35,6 @@ import org.jclouds.domain.Credentials; import org.jclouds.fujitsu.fgcp.FGCPCredentials; import org.jclouds.io.Payloads; import org.jclouds.location.Provider; -import org.jclouds.rest.AuthorizationException; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Charsets; @@ -90,9 +89,9 @@ public class FGCPCredentialsSupplier implements Supplier<FGCPCredentials> { } catch (IOException e) { throw Throwables.propagate(e); } catch (GeneralSecurityException e) { - throw new AuthorizationException("security exception parsing pem. " + e.getMessage(), e); + throw new IllegalArgumentException("security exception parsing pem. " + e.getMessage(), e); } catch (IllegalArgumentException e) { - throw new AuthorizationException("cannot parse pk. " + e.getMessage(), e); + throw new IllegalArgumentException("not a valid pem: cannot parse pk. " + e.getMessage(), e); } } @@ -148,7 +147,7 @@ public class FGCPCredentialsSupplier implements Supplier<FGCPCredentials> { try { return keyCache.getUnchecked(checkNotNull(creds.get(), "credential supplier returned null")); } catch (UncheckedExecutionException e) { - throw new AuthorizationException(e.getCause()); + throw Throwables.propagate(e.getCause()); } }
