You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2009/05/04 12:40:09 UTC
svn commit: r771265 -
/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
Author: woonsan
Date: Mon May 4 10:40:09 2009
New Revision: 771265
URL: http://svn.apache.org/viewvc?rev=771265&view=rev
Log:
Fixing a problematic code which can cause an availability issue. (It could be potentially critical because this class is a *utility* class.)
commons-io's IOUtils.copy() method uses buffering internally with proper buffer size. I've also tested exporting after deployment.
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java?rev=771265&r1=771264&r2=771265&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java Mon May 4 10:40:09 2009
@@ -23,6 +23,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import org.apache.commons.io.IOUtils;
import org.apache.jetspeed.exception.JetspeedException;
import org.apache.jetspeed.om.folder.Folder;
import org.apache.jetspeed.om.page.Link;
@@ -33,7 +34,7 @@
/**
* @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
- * @version $Id:
+ * @version $Id$
*/
public class PortalSiteManagerUtil
{
@@ -115,12 +116,10 @@
{
String strAbsPath = cpFile.getAbsolutePath();
String strZipEntryName = strAbsPath.substring(sourcePath.length() + 1, strAbsPath.length());
- byte[] b = new byte[(int) (cpFile.length())];
cpFileInputStream = new FileInputStream(cpFile);
- int i = cpFileInputStream.read(b, 0, (int) cpFile.length());
ZipEntry cpZipEntry = new ZipEntry(strZipEntryName);
cpZipOutputStream.putNextEntry(cpZipEntry);
- cpZipOutputStream.write(b, 0, (int) cpFile.length());
+ IOUtils.copy(cpFileInputStream, cpZipOutputStream);
cpZipOutputStream.closeEntry();
}
catch (Exception e)
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org