ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant BuildException.java Main.java
Date Sun, 18 Jun 2000 02:22:23 GMT
conor       00/06/17 19:22:23

  Modified:    src/main/org/apache/tools/ant BuildException.java Main.java
  Log:
  Better reporting of errors when JAXP not present.
  
  Catch NoClassDefFoundError as well as NullPointerException and
  emit a more meaningful error message.
  
  Change BuildException to accept Errors as well as Exceptions
  as cause.
  
  Submitted by:	Stefan Bodewig <bodewig@bost.de>
  
  Revision  Changes    Path
  1.5       +6 -6      jakarta-ant/src/main/org/apache/tools/ant/BuildException.java
  
  Index: BuildException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/BuildException.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BuildException.java	2000/04/26 19:09:17	1.4
  +++ BuildException.java	2000/06/18 02:22:23	1.5
  @@ -63,7 +63,7 @@
   public class BuildException extends RuntimeException {
   
       /** Exception that might have caused this one. */
  -    private Exception cause;
  +    private Throwable cause;
   
       /** Location in the build file where the exception occured */
       private Location location = Location.UNKNOWN_LOCATION;
  @@ -89,10 +89,10 @@
        * Constructs an exception with the given message and exception as
        * a root cause.
        * @param msg Description of or information about the exception.
  -     * @param cause Exception that might have cause this one.
  +     * @param cause Throwable that might have cause this one.
        */
   
  -    public BuildException(String msg, Exception cause) {
  +    public BuildException(String msg, Throwable cause) {
   	super(msg);
   	this.cause = cause;
       }
  @@ -105,7 +105,7 @@
        * @param location Location in the project file where the error occured.
        */
   
  -    public BuildException(String msg, Exception cause, Location location) {
  +    public BuildException(String msg, Throwable cause, Location location) {
           this(msg, cause);
   	this.location = location;
       }
  @@ -115,7 +115,7 @@
        * @param cause Exception that might have caused this one.
        */
   
  -    public BuildException(Exception cause) {
  +    public BuildException(Throwable cause) {
   	super(cause.toString());
   	this.cause = cause;
       }
  @@ -135,7 +135,7 @@
       /**
        * Returns the nested exception.
        */
  -    public Exception getException() {
  +    public Throwable getException() {
           return cause;
       }
   
  
  
  
  1.7       +7 -2      jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Main.java	2000/04/26 19:09:17	1.6
  +++ Main.java	2000/06/18 02:22:23	1.7
  @@ -222,12 +222,17 @@
           try {
               try {
                   Class.forName("javax.xml.parsers.SAXParserFactory");
  +                ProjectHelper.configureProject(project, buildFile);
  +            } catch (NoClassDefFoundError ncdfe) {
  +                throw new BuildException("No JAXP compliant XML parser found. See http://java.sun.com/xml
for the\nreference implementation.", ncdfe);
               } catch (ClassNotFoundException cnfe) {
  -                throw new BuildException(cnfe);
  +                throw new BuildException("No JAXP compliant XML parser found. See http://java.sun.com/xml
for the\nreference implementation.", cnfe);
  +            } catch (NullPointerException npe) {
  +                throw new BuildException("No JAXP compliant XML parser found. See http://java.sun.com/xml
for the\nreference implementation.", npe);
               }
  -            ProjectHelper.configureProject(project, buildFile);
           } catch (BuildException be) {
               System.out.println("\nBUILD CONFIG ERROR\n");
  +            System.out.println(be.getMessage());
               if (be.getException() == null) {
                   System.out.println(be.toString());
               } else {
  
  
  

Mime
View raw message