ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/types XMLCatalogBuildFileTest.java XMLCatalogTest.java
Date Mon, 03 Jun 2002 17:57:37 GMT
ehatcher    2002/06/03 10:57:37

  Modified:    .        Tag: ANT_15_BRANCH build.xml
               src/main/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        XMLCatalog.java
               src/testcases/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        XMLCatalogTest.java
  Added:       src/etc/testcases/types Tag: ANT_15_BRANCH quote1.xml
                        quote2.xml xmlcatalog.xml xmlcatalog.xsl
                        xmlcatalog1.xml xmlcatalog2.xml
               src/testcases/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        XMLCatalogBuildFileTest.java
  Log:
  apply patch sent by Craeg Strong
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.304.2.15 +4 -0      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.304.2.14
  retrieving revision 1.304.2.15
  diff -u -r1.304.2.14 -r1.304.2.15
  --- build.xml	31 May 2002 23:01:29 -0000	1.304.2.14
  +++ build.xml	3 Jun 2002 17:57:36 -0000	1.304.2.15
  @@ -184,6 +184,8 @@
                unless="trax.present"/>
       <exclude name="${optional.package}/XsltTest.java"
                unless="trax.present"/>
  +    <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
  +             unless="trax.present"/>
     </patternset>
     <patternset id="needs.xalan1">
       <exclude name="${optional.package}/XalanLiaison*.java"
  @@ -1286,6 +1288,8 @@
             <exclude name="${optional.package}/TraXLiaisonTest.java"
                      unless="trax.impl.present"/>
             <exclude name="${optional.package}/XsltTest.java"
  +                   unless="trax.impl.present"/>
  +          <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
                      unless="trax.impl.present"/>
   
             <!-- needs BSF to work -->
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +9 -0      jakarta-ant/src/etc/testcases/types/Attic/quote1.xml
  
  
  
  
  1.1.2.1   +10 -0     jakarta-ant/src/etc/testcases/types/Attic/quote2.xml
  
  
  
  
  1.1.2.1   +134 -0    jakarta-ant/src/etc/testcases/types/Attic/xmlcatalog.xml
  
  
  
  
  1.1.2.1   +31 -0     jakarta-ant/src/etc/testcases/types/Attic/xmlcatalog.xsl
  
  
  
  
  1.1.2.1   +14 -0     jakarta-ant/src/etc/testcases/types/Attic/xmlcatalog1.xml
  
  
  
  
  1.1.2.1   +11 -0     jakarta-ant/src/etc/testcases/types/Attic/xmlcatalog2.xml
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.5   +18 -4     jakarta-ant/src/main/org/apache/tools/ant/types/XMLCatalog.java
  
  Index: XMLCatalog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/XMLCatalog.java,v
  retrieving revision 1.9.2.4
  retrieving revision 1.9.2.5
  diff -u -r1.9.2.4 -r1.9.2.5
  --- XMLCatalog.java	24 May 2002 19:57:01 -0000	1.9.2.4
  +++ XMLCatalog.java	3 Jun 2002 17:57:36 -0000	1.9.2.5
  @@ -138,7 +138,7 @@
    * @author dIon Gillard
    * @author Erik Hatcher
    * @author <a href="mailto:cstrong@arielpartners.com">Craeg Strong</a>
  - * @version $Id: XMLCatalog.java,v 1.9.2.4 2002/05/24 19:57:01 ehatcher Exp $
  + * @version $Id: XMLCatalog.java,v 1.9.2.5 2002/06/03 17:57:36 ehatcher Exp $
    */
   public class XMLCatalog extends DataType implements Cloneable, EntityResolver, URIResolver
{
       /** File utilities instance */
  @@ -386,11 +386,25 @@
           if (source == null) {
               log("No matching catalog entry found, parser will use: '" +
                   href + "'", Project.MSG_DEBUG);
  -        }
  -        else {
  -            setEntityResolver(source);
  +            //
  +            // Cannot return a null source, because we have to call
  +            // setEntityResolver (see setEntityResolver javadoc comment)
  +            // 
  +            source = new SAXSource();
  +            try
  +            {
  +                URL baseURL = new URL(base);
  +                URL url = (uri.length() == 0 ? baseURL : new URL(baseURL, uri));
  +                source.setInputSource(new InputSource(url.toString()));
  +            }
  +            catch (MalformedURLException ex) {
  +                // At this point we are probably in failure mode, but
  +                // try to use the bare URI as a last gasp
  +                source.setInputSource(new InputSource(uri));
  +            }
           }
   
  +        setEntityResolver(source);
           return source;
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +10 -5     jakarta-ant/src/testcases/org/apache/tools/ant/types/XMLCatalogTest.java
  
  Index: XMLCatalogTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/types/XMLCatalogTest.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- XMLCatalogTest.java	26 May 2002 01:03:58 -0000	1.1.2.2
  +++ XMLCatalogTest.java	3 Jun 2002 17:57:36 -0000	1.1.2.3
  @@ -74,8 +74,10 @@
   /**
    * JUnit testcases for org.apache.tools.ant.types.XMLCatalog
    *
  + * @see org.apache.tools.ant.types.XMLCatalogBuildFileTest
  + *
    * @author <a href="mailto:cstrong@arielpartners.com">Craeg Strong</a> 
  - * @version $Id: XMLCatalogTest.java,v 1.1.2.2 2002/05/26 01:03:58 ehatcher Exp $
  + * @version $Id: XMLCatalogTest.java,v 1.1.2.3 2002/06/03 17:57:36 ehatcher Exp $
    */
   public class XMLCatalogTest extends TestCase {
   
  @@ -90,7 +92,7 @@
       }
   
       private String toURLString(File file) throws MalformedURLException {
  -		  return fileUtils.getFileURL(file).toString();
  +        return fileUtils.getFileURL(file).toString();
       }
   
       public XMLCatalogTest(String name) {
  @@ -122,14 +124,15 @@
          try {
              InputSource result = catalog.resolveEntity("PUBLIC ID ONE", 
                                                         "i/dont/exist.dtd");
  -           assertNull("Empty catalog should return null", result);
  +           assertNull("Empty catalog should return null entity", result);
          } catch (Exception e) {
              fail("resolveEntity() failed!" + e.toString());
          }
   
          try {
              Source result = catalog.resolve("i/dont/exist.dtd", null);
  -           assertNull("Empty catalog should return null", result);
  +           assertEquals("Empty catalog should resolve to input uri", 
  +                        "i/dont/exist.dtd", result.getSystemId());
          } catch (Exception e) {
              fail("resolve() failed!" + e.toString());
          }
  @@ -151,7 +154,9 @@
   
           try {
               Source result = catalog.resolve("i/dont/exist.dtd", null);
  -            assertNull("Nonexistent Catalog entry should not be returned", result);
  +            assertEquals("Catalog with non-existent entry should" +
  +                         " give up and resolve to input uri", 
  +                         "i/dont/exist.dtd", result.getSystemId());
           } catch (Exception e) {
               fail("resolve() failed!" + e.toString());
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +139 -0    jakarta-ant/src/testcases/org/apache/tools/ant/types/Attic/XMLCatalogBuildFileTest.java
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message