You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/03/20 04:39:35 UTC

svn commit: r1458622 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd

Author: ningjiang
Date: Wed Mar 20 03:39:34 2013
New Revision: 1458622

URL: http://svn.apache.org/r1458622
Log:
CAMEL-5837 fixed the issue of schema imports in camel-validator

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java
    camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java?rev=1458622&r1=1458621&r2=1458622&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java Wed Mar 20 03:39:34 2013
@@ -62,22 +62,23 @@ public class DefaultLSResourceResolver i
             throw new IllegalArgumentException(String.format("Resource: %s refers an invalid resource without SystemId."
                     + " Invalid resource has type: %s, namespaceURI: %s, publicId: %s, systemId: %s, baseURI: %s", resourceUri, type, namespaceURI, publicId, systemId, baseURI));
         }
-        String relatedPath = null;
+        String resourceURI = null;
         // Build up the relative path for using relatedURI and baseURI
         if (baseURI == null) {
             relatedURI = getUri(systemId);
-            relatedPath = relatedURI.intern();
+            resourceURI = relatedURI.intern();
         } else {
-            relatedPath = relatedURIMap.get(baseURI);
+            String relatedPath = relatedURIMap.get(baseURI);
             if (relatedPath == null) {
+                relatedPath = FileUtil.onlyPath(relatedURI).intern();
                 relatedURI = FileUtil.onlyPath(relatedURI) + "/" + systemId;
-                relatedPath = relatedURI.intern();
+                resourceURI = relatedURI.intern();
                 relatedURIMap.put(baseURI, relatedPath);
-            } else { // build the related path with same relatedURI
-                relatedPath = FileUtil.onlyPath(relatedPath) + "/" + systemId;
+            } else { 
+                resourceURI = relatedPath + "/" + systemId;
             }
         }
-        return new DefaultLSInput(publicId, systemId, baseURI, relatedPath);
+        return new DefaultLSInput(publicId, systemId, baseURI, resourceURI);
     }
     
     private final class DefaultLSInput implements LSInput {

Modified: camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd?rev=1458622&r1=1458621&r2=1458622&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd (original)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/component/validator/xsds/health/type1.xsd Wed Mar 20 03:39:34 2013
@@ -5,5 +5,6 @@
     targetNamespace="org.health.check.type1">
     
     <xs:import schemaLocation="../type2.xsd" namespace="org.health.check.type2"/>
+    <xs:import schemaLocation="common/common.xsd" namespace="org.health.check.common"/>
     
 </xs:schema>
\ No newline at end of file