You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2005/10/03 04:03:23 UTC

svn commit: r293204 - in /ibatis/trunk/java/mapper/mapper2/src/com/ibatis: dao/engine/builder/xml/DaoClasspathEntityResolver.java sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java

Author: cbegin
Date: Sun Oct  2 19:03:18 2005
New Revision: 293204

URL: http://svn.apache.org/viewcvs?rev=293204&view=rev
Log:
Fixed IBATIS-185 SqlMapClasspathEntityResolver - Offline public ID resolution value ignored

Modified:
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/DaoClasspathEntityResolver.java
    ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/DaoClasspathEntityResolver.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/DaoClasspathEntityResolver.java?rev=293204&r1=293203&r2=293204&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/DaoClasspathEntityResolver.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/DaoClasspathEntityResolver.java Sun Oct  2 19:03:18 2005
@@ -53,20 +53,28 @@
 
     try {
       String path = (String) doctypeMap.get(publicId);
-      path = (String) doctypeMap.get(systemId);
-      if (path != null) {
-        InputStream in = null;
-        try {
-          in = Resources.getResourceAsStream(path);
-          source = new InputSource(in);
-        } catch (IOException e) {
-          // ignore, null is ok
-        }
+      source = getInputSource(path, source);
+      if (source == null) {
+        path = (String) doctypeMap.get(systemId);
+        source = getInputSource(path, source);
       }
     } catch (Exception e) {
       throw new SAXException(e.toString());
     }
 
+    return source;
+  }
+
+  private InputSource getInputSource(String path, InputSource source) {
+    if (path != null) {
+      InputStream in = null;
+      try {
+        in = Resources.getResourceAsStream(path);
+        source = new InputSource(in);
+      } catch (IOException e) {
+        // ignore, null is ok
+      }
+    }
     return source;
   }
 

Modified: ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java
URL: http://svn.apache.org/viewcvs/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java?rev=293204&r1=293203&r2=293204&view=diff
==============================================================================
--- ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java (original)
+++ ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/builder/xml/SqlMapClasspathEntityResolver.java Sun Oct  2 19:03:18 2005
@@ -60,18 +60,26 @@
     InputSource source = null;
     try {
       String path = (String) doctypeMap.get(publicId);
-      path = (String) doctypeMap.get(systemId);
-      if (path != null) {
-        InputStream in = null;
-        try {
-          in = Resources.getResourceAsStream(path);
-          source = new InputSource(in);
-        } catch (IOException e) {
-          // ignore, null is ok
-        }
+      source = getInputSource(path, source);      
+      if (source == null) {
+        path = (String) doctypeMap.get(systemId);
+        source = getInputSource(path, source);
       }
     } catch (Exception e) {
       throw new SAXException(e.toString());
+    }
+    return source;
+  }
+
+  private InputSource getInputSource(String path, InputSource source) {
+    if (path != null) {
+      InputStream in = null;
+      try {
+        in = Resources.getResourceAsStream(path);
+        source = new InputSource(in);
+      } catch (IOException e) {
+        // ignore, null is ok
+      }
     }
     return source;
   }