modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
| 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit d7f47571f3e41951eb97fd07c5890c59a938d88a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Jul 26 15:42:16 2010 -0400
check for -1 returned by getSize
diff --git
a/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
b/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
index e4bc366..07fcad5 100644
---
a/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
+++
b/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
@@ -174,7 +174,8 @@ public class AntBundleServerPluginComponent implements
ServerPluginComponent, Bu
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