User: tobyallsopp
Date: 01/05/05 00:12:46
Modified: src/main/org/jboss/resource RARDeployer.java
Log:
Fixed the RAR redployment bug (#415516) thanks to a patch from Claudio Vesco.
Revision Changes Path
1.3 +22 -9 jbosscx/src/main/org/jboss/resource/RARDeployer.java
Index: RARDeployer.java
===================================================================
RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RARDeployer.java 2001/04/15 04:31:39 1.2
+++ RARDeployer.java 2001/05/05 07:12:46 1.3
@@ -48,7 +48,7 @@
* <code>ConnectionFactoryLoader</code> service.
*
* @author Toby Allsopp ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*
* @see org.jboss.resource.ConnectionFactoryLoader
*/
@@ -140,7 +140,8 @@
// included JARs for classloading (I don't think URLClassLoader
// deals with JARs within JARs).
- File unpackedDir = new File(rarTmpDir, generateUniqueDirName(url));
+ String unpackedDirName = generateUniqueDirName(url);
+ File unpackedDir = new File(rarTmpDir, unpackedDirName);
if (unpackedDir.exists())
{
throw new DeploymentException("The application at URL '" + url + "' " +
@@ -162,8 +163,21 @@
}
else
{
- // this is a .rar file somewhere
- inflateJar(url, unpackedDir);
+ // this is a .rar file somewhere so we copy it to the temp
+ // dir because otherwise we run into problems when we try to
+ // open it again later
+ File copyFile = new File(rarTmpDir, "copy" + unpackedDirName);
+ InputStream input = url.openStream();
+ try
+ {
+ OutputStream output = new FileOutputStream(copyFile);
+ try
+ {
+ copy(input, output);
+ } finally { output.close(); }
+ } finally { input.close(); }
+ // then we can inflate the copy without fear of retribution
+ inflateJar(copyFile.toURL(), unpackedDir);
}
// Right, now we can forget about URLs and just use the file
@@ -214,15 +228,14 @@
}
};
Collection jarFiles = recursiveFind(unpackedDir, filter);
+ log.debug("Adding the following URLs to classpath:");
for (Iterator i = jarFiles.iterator(); i.hasNext(); )
{
File file = (File) i.next();
- jars.add(file.toURL());
+ URL jarUrl = file.toURL();
+ jars.add(jarUrl);
+ log.debug(jarUrl.toString());
}
-
- log.debug("Adding the following URLs to classpath:");
- for (Iterator i = jars.iterator(); i.hasNext(); )
- log.debug(((URL) i.next()).toString());
// Ok, now we have the URLs of the JARs contained in the RAR we
// can create a classloader that loads classes from them
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development