From 3dd91d101c74df4f4f1f9b574f3a4f6dd1d8a0a4 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 17 Feb 2002 10:02:37 +0000 Subject: [PATCH] touchups git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271384 13f79535-47bb-0310-9956-ffa450edef68 --- .../antlib/xml/ValidatorErrorHandler.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java b/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java index 1f52ee038..8d5cddfa8 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java @@ -7,12 +7,12 @@ */ package org.apache.antlib.xml; -import java.io.File; import java.net.MalformedURLException; import java.net.URL; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXParseException; +import javax.xml.transform.ErrorListener; /* * ValidatorErrorHandler role : @@ -25,9 +25,8 @@ final class ValidatorErrorHandler extends AbstractLogEnabled implements ErrorHandler { - private File m_file; - private boolean m_failed; private final boolean m_warn; + private boolean m_failed; protected ValidatorErrorHandler( final boolean warn ) { @@ -56,9 +55,8 @@ final class ValidatorErrorHandler } } - protected void init( final File file ) + protected void reset() { - m_file = file; m_failed = false; } @@ -70,19 +68,22 @@ final class ValidatorErrorHandler private String getMessage( final SAXParseException spe ) { - final String sysID = spe.getSystemId(); - if( sysID != null ) + final String systemID = spe.getSystemId(); + if( null != systemID ) { + final int line = spe.getLineNumber(); + final int col = spe.getColumnNumber(); + try { - final int line = spe.getLineNumber(); - final int col = spe.getColumnNumber(); - return new URL( sysID ).getFile() + + //Build a message using standard compiler + //error format + return new URL( systemID ).getFile() + ( line == -1 ? "" : ( ":" + line + ( col == -1 ? "" : ( ":" + col ) ) ) ) + ": " + spe.getMessage(); } - catch( MalformedURLException mfue ) + catch( final MalformedURLException mue ) { } }