User: juhalindfors
Date: 01/03/25 08:39:36
Modified: src/main/org/jboss/deployment InstallerFactory.java
Log:
PATCH:
The InstallerFactory undeployed the wrong jar.
Patch submitted by Bill Burke.
Symptoms: deploying two jars
placement.jar ---> is deployed first
venueplacement.jar ---> is deployed second.
placement.jar deploys successfully, but when venueplacement.jar tries to
deploy it first undeploys placement.jar thinking that "venueplacement.jar"
is already deployed.
The line with:
if (_pattern.endsWith(files[i].getName())
will sometimes resolve incorrectly, if you plug in the above example
you'll get
if ("file://.../venueplacement.jar".endsWith("placement.jar"))
will always be true.
Revision Changes Path
1.3 +53 -21 jboss/src/main/org/jboss/deployment/InstallerFactory.java
Index: InstallerFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/InstallerFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InstallerFactory.java 2001/01/03 08:28:26 1.2
+++ InstallerFactory.java 2001/03/25 16:39:36 1.3
@@ -1,5 +1,5 @@
/*
- * jBoss, the OpenSource EJB server
+ * JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -57,7 +57,8 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a>
- * @version $Revision: 1.2 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
+ * @version $Revision: 1.3 $
*/
public class InstallerFactory
{
@@ -155,26 +156,57 @@
return null;
Deployment result = null;
+ String realPattern = null;
+ // First try to see if _pattern is a URL.
+ try
+ {
+ URL u = new URL(_pattern);
+ String realtmp = u.getFile();
+ File fp = new File(realtmp);
+ realPattern = fp.getName();
+ }
+ catch (MalformedURLException ex)
+ {
+ /* Ignore, this is ok. We're dealing with an actual file path */
+ }
+
+ if (realPattern == null)
+ {
+ // If it's not a URL maybe it is a file path
+ try
+ {
+ File fp = new File(_pattern);
+ realPattern = fp.getName();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ if (realPattern == null)
+ {
+ // REVISIT: Maybe we should log something here?
+ return result;
+ }
+
+ File[] files = baseDir.listFiles();
+ for (int i = 0, l = files.length; i<l; ++i)
+ {
+ if (realPattern.equals(files[i].getName()))
+ {
+ try
+ {
+ result = loadConfig(new File (files[i], J2eeDeployer.CONFIG));
+ break;
+ }
+ catch (IOException _ioe)
+ {
+ log.error("exception while searching deployment:
"+_ioe.getMessage());
+ }
+ }
+ }
- File[] files = baseDir.listFiles();
- for (int i = 0, l = files.length; i<l; ++i)
- {
- if (_pattern.endsWith (files[i].getName()))
- {
- try
- {
- result = loadConfig(new File (files[i],
J2eeDeployer.CONFIG));
- break;
- }
- catch (IOException _ioe)
- {
- log.error("exception while searching
deployment: "+_ioe.getMessage());
- }
- }
- }
- return result;
- }
-
+ return result;
+ }
/** Does some cleanup in the deployments. Intended to remove files that didnt
become removed
* in previous sessions because of the Win2k removal problems.
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development