Author: stevel Date: Tue Dec 27 15:41:41 2005 New Revision: 359325 URL: http://svn.apache.org/viewcvs?rev=359325&view=rev Log: xml nameserver check
Modified: ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java?rev=359325&r1=359324&r2=359325&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java Tue Dec 27 15:41:41 2005 @@ -18,7 +18,9 @@ import org.apache.tools.ant.util.LoaderUtils; import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.JAXPUtils; import org.apache.tools.ant.launch.Launcher; +import org.xml.sax.XMLReader; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParser; @@ -92,6 +94,7 @@ } } catch (ClassNotFoundException e) { // ignore + ignoreThrowable(e); } } @@ -176,6 +179,7 @@ saxParser = saxParserFactory.newSAXParser(); } catch (Exception e) { // ignore + ignoreThrowable(e); } return saxParser; } @@ -194,6 +198,37 @@ return location; } + private static String getNamespaceParserName() { + try { + XMLReader reader = JAXPUtils.getNamespaceXMLReader(); + return reader.getClass().getName(); + } catch (BuildException e) { + //ignore + ignoreThrowable(e); + return null; + } + } + + private static String getNamespaceParserLocation() { + try { + XMLReader reader = JAXPUtils.getNamespaceXMLReader(); + return getClassLocation(reader.getClass()); + } catch (BuildException e) { + //ignore + ignoreThrowable(e); + return null; + } + } + + /** + * ignore exceptions. This is to allow future + * implementations to log at a verbose level + * @param thrown + */ + private static void ignoreThrowable(Throwable thrown) { + + } + /** * get the location of a class. Stolen from axis/webapps/happyaxis.jsp * @param clazz @@ -223,6 +258,7 @@ out.println("optional tasks : " + getImplementationVersion(optional)); } catch (ClassNotFoundException e) { + ignoreThrowable(e); out.println("optional tasks : not available"); } @@ -269,6 +305,7 @@ try { sysprops = System.getProperties(); } catch (SecurityException e) { + ignoreThrowable(e); out.println("Access to System.getProperties() blocked " + "by a security manager"); } @@ -400,14 +437,24 @@ private static void doReportParserInfo(PrintStream out) { String parserName = getXmlParserName(); String parserLocation = getXMLParserLocation(); + printParserInfo(out, "XML Parser", parserName, parserLocation); + printParserInfo(out, "Namespace-aware parser", + getNamespaceParserName(), + getNamespaceParserLocation()); + } + + private static void printParserInfo(PrintStream out, + String parserType, + String parserName, + String parserLocation) { if (parserName == null) { parserName = "unknown"; } if (parserLocation == null) { parserLocation = "unknown"; } - out.println("XML Parser : " + parserName); - out.println("XML Parser Location: " + parserLocation); + out.println(parserType +" : " + parserName); + out.println(parserType +" Location: " + parserLocation); } /** @@ -452,6 +499,7 @@ out.println("Warning: big clock drift -maybe a network filesystem"); } } catch (IOException e) { + ignoreThrowable(e); out.println("Failed to create a temporary file in the temp dir " + tempdir); out.println("File " + tempFile + " could not be created/written to"); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]