ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
Date Sun, 21 Apr 2002 13:42:03 GMT
conor       02/04/21 06:42:03

  Modified:    src/main/org/apache/tools/ant Main.java ProjectHelper.java
               src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
  Log:
  Improve XML parser issue reporting
  
  Revision  Changes    Path
  1.62      +1 -15     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.61
  retrieving revision 1.62
  diff -u -w -u -r1.61 -r1.62
  --- Main.java	9 Apr 2002 15:27:07 -0000	1.61
  +++ Main.java	21 Apr 2002 13:42:02 -0000	1.62
  @@ -565,21 +565,7 @@
                   project.setUserProperty("ant.file",
                       buildFile.getAbsolutePath());
   
  -                // first use the ProjectHelper to create the project object
  -                // from the given build file.
  -                String noParserMessage = "No JAXP compliant XML parser found. "
  -                    + "Please visit http://xml.apache.org "
  -                    + "for a suitable parser";
  -                try {
  -                    Class.forName("javax.xml.parsers.SAXParserFactory");
                       ProjectHelper.configureProject(project, buildFile);
  -                } catch (NoClassDefFoundError ncdfe) {
  -                    throw new BuildException(noParserMessage, ncdfe);
  -                } catch (ClassNotFoundException cnfe) {
  -                    throw new BuildException(noParserMessage, cnfe);
  -                } catch (NullPointerException npe) {
  -                    throw new BuildException(noParserMessage, npe);
  -                }
   
                   if (projectHelp) {
                       printDescription(project);
  
  
  
  1.86      +15 -7     jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -w -u -r1.85 -r1.86
  --- ProjectHelper.java	16 Apr 2002 09:26:36 -0000	1.85
  +++ ProjectHelper.java	21 Apr 2002 13:42:03 -0000	1.86
  @@ -159,14 +159,15 @@
           ProjectHelper helper = null;
           
           // First, try the system property
  -        try {
               String helperClass = System.getProperty(HELPER_PROPERTY);
  +        try {
               if (helperClass != null) {
                   helper = newHelper(helperClass);
               }
           } catch (SecurityException e) {
  -            // It's ok, we'll try next option
  -            ;
  +            System.out.println("Unable to load ProjectHelper class \"" 
  +                + helperClass + " specified in system property " 
  +                + HELPER_PROPERTY);
           }
   
           // A JDK1.3 'service' ( like in JAXP ). That will plug a helper
  @@ -203,15 +204,22 @@
                       }
                   }
               } catch (Exception ex) {
  -                ;
  +                System.out.println("Unable to load ProjectHelper " 
  +                    + "from service \"" + SERVICE_ID); 
               }
           }
   
           if (helper != null) {
               return helper;
           } else {
  +            try {
               // Default
               return new ProjectHelperImpl();
  +            } catch (Throwable e) {
  +                String message = "Unable to load default ProjectHelper due to "
  +                    + e.getClass().getName() + ": " + e.getMessage();
  +                throw new BuildException(message, e);
  +            }
           }
       }
   
  
  
  
  1.6       +4 -1      jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
  
  Index: ProjectHelperImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- ProjectHelperImpl.java	20 Apr 2002 06:21:17 -0000	1.5
  +++ ProjectHelperImpl.java	21 Apr 2002 13:42:03 -0000	1.6
  @@ -71,7 +71,7 @@
   import javax.xml.parsers.SAXParserFactory;
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.ParserConfigurationException;
  -
  +import javax.xml.parsers.FactoryConfigurationError;
   import org.apache.tools.ant.ProjectHelper;
   import org.apache.tools.ant.UnknownElement;
   import org.apache.tools.ant.Project;
  @@ -165,6 +165,9 @@
               parser.parse(inputSource);
           } catch (ParserConfigurationException exc) {
               throw new BuildException("Parser has not been configured correctly", exc);
  +        } catch (FactoryConfigurationError e) {
  +            throw new BuildException("XML parser has not been configured " 
  +                + "correctly: " + e.getMessage(), e);
           } catch (SAXParseException exc) {
               Location location =
                   new Location(buildFile.toString(), exc.getLineNumber(),
  
  
  

--
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