User: schulze
Date: 00/11/02 18:19:06
Modified: src/main/org/jboss/deployment URLWizzard.java
J2eeDeployer.java
Log:
changed that deployment in case of failing while deleting the localCopy file is
continued (but should never happen now)
finetuning for URLWizzard
Revision Changes Path
1.4 +22 -25 jboss/src/main/org/jboss/deployment/URLWizzard.java
Index: URLWizzard.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/deployment/URLWizzard.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- URLWizzard.java 2000/11/03 02:02:02 1.3
+++ URLWizzard.java 2000/11/03 02:19:05 1.4
@@ -33,7 +33,7 @@
* Very scratchy! Any improvements are welcome!
*
* @author Daniel Schulze <[EMAIL PROTECTED]>
-* @version $Revision: 1.3 $
+* @version $Revision: 1.4 $
*/
public class URLWizzard
{
@@ -77,18 +77,8 @@
_destDirectory, _prefix and _suffix */
public static URL downloadTemporary (URL _src, URL _destDirectory, String
_prefix, String _suffix) throws IOException
{
- File f = new File (_destDirectory.getFile ());
- if (!f.exists ())
- f.mkdirs ();
- File file;
- do
- {
- file = new File (f, _prefix + getId () + _suffix);
- }
- while (!file.createNewFile ());
-
- return download (_src, file.toURL ());
+ return download (_src, createTempFile (_destDirectory, _prefix, _suffix));
}
@@ -148,25 +138,15 @@
InputStream in;
OutputStream out;
-
- File f = new File (_destDir.getFile ());
- if (!f.exists ())
- f.mkdirs ();
- File file;
- do
- {
- file = new File (f, _prefix + getId () + _suffix);
- }
- while (!file.createNewFile ());
-
- JarOutputStream jout = new JarOutputStream (new FileOutputStream (file));
+ File dest = new File (createTempFile (_destDir, _prefix, _suffix).getFile
());
+ JarOutputStream jout = new JarOutputStream (new FileOutputStream (dest));
// put all into the jar...
add (jout, new File (_src.getFile()), "");
jout.close ();
- return f.toURL ();
+ return dest.toURL ();
}
@@ -245,6 +225,23 @@
private static String getId ()
{
return String.valueOf (++id);
+ }
+
+ /** creates a temporary file like File.createTempFile() */
+ public static URL createTempFile (URL _baseDir, String _prefix, String _suffix)
throws IOException
+ {
+ File f = new File (_baseDir.getFile ());
+ if (!f.exists ())
+ f.mkdirs ();
+
+ File file;
+ do
+ {
+ file = new File (f, _prefix + getId () + _suffix);
+ }
+ while (!file.createNewFile ());
+
+ return file.toURL ();
}
1.6 +10 -2 jboss/src/main/org/jboss/deployment/J2eeDeployer.java
Index: J2eeDeployer.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/deployment/J2eeDeployer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- J2eeDeployer.java 2000/11/02 22:43:53 1.5
+++ J2eeDeployer.java 2000/11/03 02:19:05 1.6
@@ -54,7 +54,7 @@
* (ContainerFactory for jBoss and EmbededTomcatService for Tomcat).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a>
-* @version $Revision: 1.5 $
+* @version $Revision: 1.6 $
*/
public class J2eeDeployer
extends ServiceMBeanSupport
@@ -365,7 +365,15 @@
// dont need it anymore...
cl = null;
- URLWizzard.deleteTree(localCopy);
+ try
+ {
+ URLWizzard.deleteTree(localCopy);
+ }
+ catch (IOException _ioe)
+ {
+ // dont abort just give a note...
+ log.log ("could not delete temporary file: "+localCopy.getFile ());
+ }
if (root == null)
{