Author: adietish
Date: 2010-12-16 13:30:07 -0500 (Thu, 16 Dec 2010)
New Revision: 27564
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
[JBIDE-7911] corrected: throws exceptions on error (internal server error, connection
error etc)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-16
18:28:43 UTC (rev 27563)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-16
18:30:07 UTC (rev 27564)
@@ -513,29 +513,6 @@
}
- /**
- * Tests the credentials defined in this DeltaCloud instance by connecting
- * to the server defined by the url in this instance. Returns
- * <code>true</code> if the credentials are valid,
<code>false</code>
- * otherwise.
- *
- * @return <code>true</code>, if successful
- * @throws DeltaCloudClientException
- * if any other error occurs while trying to connect to the
- * server
- */
- public boolean testCredentials() throws DeltaCloudClientException {
- String instanceId = "nonexistingInstance"; //$NON-NLS-1$
- try {
- client.listInstances(instanceId);
- return true;
- } catch (DeltaCloudNotFoundClientException e) {
- return true;
- } catch (DeltaCloudAuthException e) {
- return false;
- }
- }
-
public DeltaCloudRealm[] getRealms() throws DeltaCloudException {
ArrayList<DeltaCloudRealm> realms = new ArrayList<DeltaCloudRealm>();
try {
@@ -593,4 +570,30 @@
throw new DeltaCloudException("Could not determine the driver of the server on
url " + url, e);
}
}
+
+ /**
+ * Tests the credentials defined in this DeltaCloud instance by connecting
+ * to the server defined by the url in this instance. Returns
+ * <code>true</code> if the credentials are valid,
<code>false</code>
+ * otherwise.
+ *
+ * @return <code>true</code>, if successful
+ * @throws DeltaCloudClientException
+ * if any other error occurs while trying to connect to the
+ * server
+ */
+ public boolean testCredentials() throws DeltaCloudException {
+ String instanceId = "nonexistingInstance"; //$NON-NLS-1$
+ try {
+ client.listInstances(instanceId);
+ return true;
+ } catch (DeltaCloudNotFoundClientException e) {
+ return true;
+ } catch (DeltaCloudAuthException e) {
+ return false;
+ } catch(DeltaCloudClientException e){
+ throw new DeltaCloudException("Could not connection to ", e);
+ }
+
+ }
}