--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DefaultValidationErrorHandler.java Thu Oct 17 15:45:23 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DefaultValidationErrorHandler.java Thu Oct 17 17:48:51 2013 -0700
@@ -20,6 +20,8 @@
package com.sun.org.apache.xerces.internal.jaxp;
+import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
+import java.util.Locale;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
@@ -30,6 +32,11 @@
class DefaultValidationErrorHandler extends DefaultHandler {
static private int ERROR_COUNT_LIMIT = 10;
private int errorCount = 0;
+ private Locale locale = Locale.getDefault();
+
+ public DefaultValidationErrorHandler(Locale locale) {
+ this.locale = locale;
+ }
// XXX Fix message i18n
public void error(SAXParseException e) throws SAXException {
@@ -38,11 +45,8 @@
return;
} else if (errorCount == 0) {
// Print a warning before the first error
- System.err.println("Warning: validation was turned on but an org.xml.sax.ErrorHandler was not");
- System.err.println("set, which is probably not what is desired. Parser will use a default");
- System.err.println("ErrorHandler to print the first " +
- ERROR_COUNT_LIMIT + " errors. Please call");
- System.err.println("the 'setErrorHandler' method to fix this.");
+ System.err.println(SAXMessageFormatter.formatMessage(locale,
+ "errorHandlerNotSet", new Object [] {errorCount}));
}
String systemId = e.getSystemId();
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java Thu Oct 17 15:45:23 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java Thu Oct 17 17:48:51 2013 -0700
@@ -141,7 +141,7 @@
// validation errors with a warning telling the user to set an
// ErrorHandler
if (dbf.isValidating()) {
- fInitErrorHandler = new DefaultValidationErrorHandler();
+ fInitErrorHandler = new DefaultValidationErrorHandler(domParser.getXMLParserConfiguration().getLocale());
setErrorHandler(fInitErrorHandler);
}
else {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java Thu Oct 17 15:45:23 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java Thu Oct 17 17:48:51 2013 -0700
@@ -20,23 +20,14 @@
package com.sun.org.apache.xerces.internal.jaxp;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.validation.Schema;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
import com.sun.org.apache.xerces.internal.util.Status;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
@@ -46,6 +37,14 @@
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import javax.xml.XMLConstants;
+import javax.xml.validation.Schema;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.HandlerBase;
@@ -187,7 +186,7 @@
// validation errors with a warning telling the user to set an
// ErrorHandler.
if (spf.isValidating()) {
- fInitErrorHandler = new DefaultValidationErrorHandler();
+ fInitErrorHandler = new DefaultValidationErrorHandler(xmlReader.getLocale());
xmlReader.setErrorHandler(fInitErrorHandler);
}
else {
@@ -686,6 +685,10 @@
return super.getProperty(name);
}
+ Locale getLocale() {
+ return fConfiguration.getLocale();
+ }
+
private void setSchemaValidatorFeature(String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
try {