axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r376326 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
Date Thu, 09 Feb 2006 15:42:03 GMT
Author: dims
Date: Thu Feb  9 07:42:01 2006
New Revision: 376326

URL: http://svn.apache.org/viewcvs?rev=376326&view=rev
Log:
fix NPE

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=376326&r1=376325&r2=376326&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
Thu Feb  9 07:42:01 2006
@@ -34,6 +34,7 @@
 import java.util.List;
 import java.util.Map;
 import java.net.URI;
+import java.net.MalformedURLException;
 import java.io.File;
 
 public class CodeGenerationEngine {
@@ -197,14 +198,16 @@
      */
     private String getBaseURI(String currentURI){
         String baseURI= null;
-        if(currentURI.startsWith("http://")){
-           // current URI is a remote one
-           String uriFrag = currentURI.substring(0,currentURI.lastIndexOf("/"));
-        baseURI = uriFrag + (uriFrag.endsWith("/") ? "" : "/");
-        }else{
-           // the uri should be a file
-          baseURI =  new File(currentURI).getParentFile().getAbsolutePath();
+        if (!currentURI.startsWith("http://")) {
+            // the uri should be a file
+            try {
+                currentURI = new File(currentURI).toURL().toString();
+            } catch (MalformedURLException e) {
+                throw new RuntimeException("Cannot find baseuri for :" + currentURI);
+            }
         }
+        String uriFrag = currentURI.substring(0, currentURI.lastIndexOf("/"));
+        baseURI = uriFrag + (uriFrag.endsWith("/") ? "" : "/");
         return baseURI;
     }
 }



Mime
View raw message