axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl Wsdl2javaAntTask.java
Date Sat, 15 Dec 2001 21:37:53 GMT
rubys       01/12/15 13:37:53

  Modified:    java/test/wsdl Wsdl2javaAntTask.java
  Log:
  Don't mark wsdl2java tests as failures if the wsdl is from an external
  site and either an error occurs while trying to retrive the document,
  or the document returned is not well formed XML.
  
  This is to permit disconnected execution of the tests.
  
  Revision  Changes    Path
  1.10      +24 -1     xml-axis/java/test/wsdl/Wsdl2javaAntTask.java
  
  Index: Wsdl2javaAntTask.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaAntTask.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Wsdl2javaAntTask.java	2001/12/11 15:08:48	1.9
  +++ Wsdl2javaAntTask.java	2001/12/15 21:37:53	1.10
  @@ -53,6 +53,8 @@
    */
   package test.wsdl;
   
  +import org.apache.axis.utils.XMLUtils;
  +
   import org.apache.axis.wsdl.toJava.Emitter;
   import org.apache.axis.wsdl.toJava.JavaWriterFactory;
   
  @@ -60,6 +62,9 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   
  +import org.w3c.dom.Document;
  +import org.xml.sax.SAXException;
  +
   import java.util.HashMap;
   
   /**
  @@ -119,7 +124,25 @@
               emitter.setOutputDir(output);
               emitter.generateSkeleton(skeleton);
               emitter.verbose(verbose);
  -            emitter.emit(url);
  +
  +            Document doc;
  +
  +            try {
  +                doc = XMLUtils.newDocument(url);
  +                doc.getDocumentElement().getTagName();
  +            } catch (Throwable e) {
  +                if (url.startsWith("http://")) {
  +                    // What we have is either a network error or invalid XML -
  +                    // the latter most likely an HTML error page.  This makes
  +                    // it impossible to continue with the test, so issue
  +                    // a warning, and return without reporting a fatal error.
  +                    log(e.toString(), Project.MSG_WARN);
  +                    return;
  +                }
  +                throw e;
  +            }
  +
  +            emitter.emit(doc);
           } catch (Throwable t) {
               throw new BuildException("Error while running " + getClass().getName(), t);

           }
  
  
  

Mime
View raw message