Added line and column numbers to configuration parse exceptions
(request 714962).
This commit is contained in:
parent
e4a14e401a
commit
b59648d605
|
|
@ -127,6 +127,10 @@
|
|||
to "error" element of XMLLogger output
|
||||
(request 686336).</li>
|
||||
|
||||
<li class="body">Added line and column numbers
|
||||
to configuration parse exceptions
|
||||
(request 714962).</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p class="body">
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import com.puppycrawl.tools.checkstyle.api.Configuration;
|
|||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Loads a configuration from a standard configuration XML file.
|
||||
|
|
@ -221,6 +222,11 @@ public final class ConfigurationLoader
|
|||
throw new CheckstyleException(
|
||||
"unable to parse " + aConfig, e);
|
||||
}
|
||||
catch (SAXParseException e) {
|
||||
throw new CheckstyleException("unable to parse "
|
||||
+ aConfig + " - " + e.getMessage() + ":" + e.getLineNumber()
|
||||
+ ":" + e.getColumnNumber(), e);
|
||||
}
|
||||
catch (SAXException e) {
|
||||
throw new CheckstyleException("unable to parse "
|
||||
+ aConfig + " - " + e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ConfigurationLoaderTest extends TestCase
|
|||
assertTrue(
|
||||
ex.getMessage().endsWith(
|
||||
"Attribute \"name\" is required and must be specified "
|
||||
+ "for element type \"property\"."));
|
||||
+ "for element type \"property\".:8:41"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class ConfigurationLoaderTest extends TestCase
|
|||
assertTrue(
|
||||
ex.getMessage().endsWith(
|
||||
"Attribute \"value\" is required and must be specified "
|
||||
+ "for element type \"property\"."));
|
||||
+ "for element type \"property\".:8:41"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ public class ConfigurationLoaderTest extends TestCase
|
|||
assertTrue(
|
||||
ex.getMessage().endsWith(
|
||||
"Attribute \"name\" is required and must be specified "
|
||||
+ "for element type \"module\"."));
|
||||
+ "for element type \"module\".:7:23"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ public class ConfigurationLoaderTest extends TestCase
|
|||
assertTrue(
|
||||
ex.getMessage().endsWith(
|
||||
"Document root element \"property\", must match DOCTYPE "
|
||||
+ "root \"module\"."));
|
||||
+ "root \"module\".:7:38"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue