[rhq] modules/enterprise

snegrea snegrea at fedoraproject.org
Mon Aug 20 19:42:38 UTC 2012


 modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java |   28 ++++++----
 1 file changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 851461ab89dac1da41b9c85ae1d87eac54de2ef3
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Mon Aug 20 14:42:06 2012 -0500

    [BZ 830841] Added a descriptive error message for cases where content is not available for a resource. The user is asked to try again in a few minutes if content was deployed recently since the deploy and discovery process might still be running.

diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 0199c77..7361fe8 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -576,19 +576,25 @@ public class ResourceClientProxy {
 
             InstalledPackage installedPackage = getBackingContent();
 
-            if (fileName == null )
-                fileName = installedPackage.getPackageVersion().getFileName();
-            
-            File file = new File(fileName);
+            if (installedPackage != null) {
+                if (fileName == null) {
+                    fileName = installedPackage.getPackageVersion().getFileName();
+                }
 
-            byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
-                            remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+                File file = new File(fileName);
 
-            FileOutputStream fos = new FileOutputStream(file);
-            try {
-                fos.write(data);
-            } finally {
-                fos.close();
+                byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
+                    remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+
+                FileOutputStream fos = new FileOutputStream(file);
+                try {
+                    fos.write(data);
+                } finally {
+                    fos.close();
+                }
+            } else {
+                throw new RuntimeException(
+                    "Content not available in the content repository. If you recently deployed content to this resource, then the content repository has not yet received the content or content information. The content for a resource is available only after the deployment and discovery process completes. Please try again in a few minutes.");
             }
         }
 




More information about the rhq-commits mailing list