summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Negrea <snegrea@redhat.com>2012-08-20 19:42:06 (GMT)
committerStefan Negrea <snegrea@redhat.com>2012-08-20 19:42:06 (GMT)
commit851461ab89dac1da41b9c85ae1d87eac54de2ef3 (patch)
tree57182e02abc1fe612c159017ddac6fd2ba45c8a8
parent414ccdf3fd964dc6d64abe511ec02f4e9170aa40 (diff)
downloadrhq-851461ab89dac1da41b9c85ae1d87eac54de2ef3.zip
rhq-851461ab89dac1da41b9c85ae1d87eac54de2ef3.tar.gz
rhq-851461ab89dac1da41b9c85ae1d87eac54de2ef3.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.
-rw-r--r--modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java28
1 files changed, 17 insertions, 11 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 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.");
}
}