geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r1211759 - /geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Date Thu, 08 Dec 2011 05:23:02 GMT
Author: xiaming
Date: Thu Dec  8 05:23:02 2011
New Revision: 1211759

URL: http://svn.apache.org/viewvc?rev=1211759&view=rev
Log:
GERONIMO-6225 Check in to 3.0-beta branch to ensure URI is valid before resolving a path string.
And add logger to Module.java to log URI related exceptions as warnings

Modified:
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java

Modified: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?rev=1211759&r1=1211758&r2=1211759&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Thu Dec  8 05:23:02 2011
@@ -17,6 +17,7 @@
 package org.apache.geronimo.j2ee.deployment;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -38,11 +39,14 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xbean.finder.AbstractFinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public abstract class Module<T, U> {
+	private static final Logger log = LoggerFactory.getLogger(Module.class);
     private final boolean standAlone;
 
     private final AbstractName moduleName;
@@ -183,7 +187,21 @@ public abstract class Module<T, U> {
     }
 
     public URI resolve(String path) {
-        return targetPathURI.resolve(path);
+    	URI resultURI = null;
+    	try {
+    		resultURI = targetPathURI.resolve(path);
+    	} catch (Exception e) {
+    		log.warn("Exception=" + e + "; Cause=" + e.getCause()); 
+    		if (e instanceof java.lang.IllegalArgumentException) {    			
+    			try {
+    			URI substr = new URI(null, path, null);
+    			resultURI = targetPathURI.resolve(substr);
+    			} catch (Exception ex) {
+    				throw new RuntimeException("Exception=" + ex + "; Cause=" + ex.getCause());
+    			}
+    		}
+    	}    	
+        return resultURI;
     }
 
     public URI resolve(URI path) {



Mime
View raw message