You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2006/03/17 08:08:23 UTC

svn commit: r386559 - /webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java

Author: ajith
Date: Thu Mar 16 23:08:21 2006
New Revision: 386559

URL: http://svn.apache.org/viewcvs?rev=386559&view=rev
Log:
1.Fixed a minor bug in handling relative file references. The code was picking the parent directory even when the context path is a directory (in which case the context dir should be the parent dir)

Modified:
    webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java

Modified: webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java?rev=386559&r1=386558&r2=386559&view=diff
==============================================================================
--- webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java (original)
+++ webservices/commons/modules/XmlSchema/src/org/apache/ws/commons/schema/SchemaBuilder.java Thu Mar 16 23:08:21 2006
@@ -1966,7 +1966,19 @@
             // the spec string to the end.
             String contextFileName = contextURL.getFile();
             URL parent = null;
-            File parentFile = new File(contextFileName).getParentFile();
+            //the logic for finding the parent file is this.
+            //1.if the contextURI represents a file then take the parent file
+            //of it
+            //2. If the contextURI represents a directory, then take that as
+            //the parent
+            File parentFile;
+            File contextFile = new File(contextFileName);
+            if (contextFile.isDirectory()){
+                parentFile = contextFile;
+            }else{
+                parentFile = contextFile.getParentFile();
+            }
+
             if (parentFile != null) {
                 parent = parentFile.toURL();
             }