modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
| 3 ++-
modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
| 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
New commits:
commit f52524eb36fa6863d5500e35971b7e86d268f009
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Aug 25 10:50:12 2010 -0400
be defensive with entry.getSize() since it might return -1. this matches the same kind
of fix we did in commit d7f47571f3e41951eb97fd07c5890c59a938d88a
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
index c8111fc..2a4e99d 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
@@ -261,7 +261,8 @@ public class Deployer {
ZipUtil.walkZipFile(zipFile, new ZipEntryVisitor() {
public boolean visit(ZipEntry entry, ZipInputStream stream) throws
Exception {
if (!entry.isDirectory()) {
- diskUsage.increaseDiskUsage(entry.getSize());
+ final long size = entry.getSize();
+ diskUsage.increaseDiskUsage(size > 0 ? size : 0);
diskUsage.incrementFileCount();
}
return true;
diff --git
a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
index e9b82d2..4db9de9 100644
---
a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
+++
b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
@@ -211,7 +211,8 @@ public class BundleServerPluginComponent implements
ServerPluginComponent, Bundl
public boolean visit(ZipEntry entry, ZipInputStream stream) throws Exception {
if (this.recipeName.equalsIgnoreCase(entry.getName())) {
// this should be safe downcast, recipes are not that big
- ByteArrayOutputStream out = new ByteArrayOutputStream((int)
entry.getSize());
+ int contentSize = (int) entry.getSize();
+ ByteArrayOutputStream out = new ByteArrayOutputStream((contentSize >
0) ? contentSize : 32768);
StreamUtil.copy(stream, out, false);
this.recipe = new String(out.toByteArray());
out = null; // no need for this anymore, help out GC
Show replies by date