summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Negrea <snegrea@redhat.com>2012-08-20 20:13:31 (GMT)
committerStefan Negrea <snegrea@redhat.com>2012-08-20 20:13:53 (GMT)
commitfd52d4706ff9f6d9b0048cc171168fc2018a96f7 (patch)
tree09d0ea87bb67e82aafb71e59e1091b5f6a0646ff
parent8d05d1b1c7452f0c2834f455d6e653f5cc9390e0 (diff)
downloadrhq-fd52d4706ff9f6d9b0048cc171168fc2018a96f7.zip
rhq-fd52d4706ff9f6d9b0048cc171168fc2018a96f7.tar.gz
rhq-fd52d4706ff9f6d9b0048cc171168fc2018a96f7.tar.xz
[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.
(cherry picked from commit 851461ab89dac1da41b9c85ae1d87eac54de2ef3) Conflicts: modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
-rw-r--r--modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java29
1 files changed, 17 insertions, 12 deletions
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 f1393f9..27d58c1 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
@@ -563,20 +563,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.getContentManager().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.");
}
}