Browse Source

touchups

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271384 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
3dd91d101c
1 changed files with 12 additions and 11 deletions
  1. +12
    -11
      proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java

+ 12
- 11
proposal/myrmidon/src/java/org/apache/antlib/xml/ValidatorErrorHandler.java View File

@@ -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 )
{
}
}


Loading…
Cancel
Save