8016500: Unlocalized warnigs
Reviewed-by: lancea
This commit is contained in:
parent
a45aa286f3
commit
a630fe0c72
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
package com.sun.org.apache.xerces.internal.jaxp;
|
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.SAXException;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
@ -30,6 +32,11 @@ import org.xml.sax.helpers.DefaultHandler;
|
|||||||
class DefaultValidationErrorHandler extends DefaultHandler {
|
class DefaultValidationErrorHandler extends DefaultHandler {
|
||||||
static private int ERROR_COUNT_LIMIT = 10;
|
static private int ERROR_COUNT_LIMIT = 10;
|
||||||
private int errorCount = 0;
|
private int errorCount = 0;
|
||||||
|
private Locale locale = Locale.getDefault();
|
||||||
|
|
||||||
|
public DefaultValidationErrorHandler(Locale locale) {
|
||||||
|
this.locale = locale;
|
||||||
|
}
|
||||||
|
|
||||||
// XXX Fix message i18n
|
// XXX Fix message i18n
|
||||||
public void error(SAXParseException e) throws SAXException {
|
public void error(SAXParseException e) throws SAXException {
|
||||||
@ -38,11 +45,8 @@ class DefaultValidationErrorHandler extends DefaultHandler {
|
|||||||
return;
|
return;
|
||||||
} else if (errorCount == 0) {
|
} else if (errorCount == 0) {
|
||||||
// Print a warning before the first error
|
// 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(SAXMessageFormatter.formatMessage(locale,
|
||||||
System.err.println("set, which is probably not what is desired. Parser will use a default");
|
"errorHandlerNotSet", new Object [] {errorCount}));
|
||||||
System.err.println("ErrorHandler to print the first " +
|
|
||||||
ERROR_COUNT_LIMIT + " errors. Please call");
|
|
||||||
System.err.println("the 'setErrorHandler' method to fix this.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String systemId = e.getSystemId();
|
String systemId = e.getSystemId();
|
||||||
|
@ -141,7 +141,7 @@ public class DocumentBuilderImpl extends DocumentBuilder
|
|||||||
// validation errors with a warning telling the user to set an
|
// validation errors with a warning telling the user to set an
|
||||||
// ErrorHandler
|
// ErrorHandler
|
||||||
if (dbf.isValidating()) {
|
if (dbf.isValidating()) {
|
||||||
fInitErrorHandler = new DefaultValidationErrorHandler();
|
fInitErrorHandler = new DefaultValidationErrorHandler(domParser.getXMLParserConfiguration().getLocale());
|
||||||
setErrorHandler(fInitErrorHandler);
|
setErrorHandler(fInitErrorHandler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -20,23 +20,14 @@
|
|||||||
|
|
||||||
package com.sun.org.apache.xerces.internal.jaxp;
|
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.Constants;
|
||||||
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
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.impl.xs.XMLSchemaValidator;
|
||||||
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
|
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.SAXMessageFormatter;
|
||||||
import com.sun.org.apache.xerces.internal.util.Status;
|
import com.sun.org.apache.xerces.internal.util.Status;
|
||||||
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.utils.XMLSecurityManager;
|
||||||
|
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||||
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
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.XMLComponent;
|
||||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||||
@ -46,6 +37,14 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
|||||||
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
|
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.ElementPSVI;
|
||||||
import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
|
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.EntityResolver;
|
||||||
import org.xml.sax.ErrorHandler;
|
import org.xml.sax.ErrorHandler;
|
||||||
import org.xml.sax.HandlerBase;
|
import org.xml.sax.HandlerBase;
|
||||||
@ -187,7 +186,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
|
|||||||
// validation errors with a warning telling the user to set an
|
// validation errors with a warning telling the user to set an
|
||||||
// ErrorHandler.
|
// ErrorHandler.
|
||||||
if (spf.isValidating()) {
|
if (spf.isValidating()) {
|
||||||
fInitErrorHandler = new DefaultValidationErrorHandler();
|
fInitErrorHandler = new DefaultValidationErrorHandler(xmlReader.getLocale());
|
||||||
xmlReader.setErrorHandler(fInitErrorHandler);
|
xmlReader.setErrorHandler(fInitErrorHandler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -686,6 +685,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
|
|||||||
return super.getProperty(name);
|
return super.getProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Locale getLocale() {
|
||||||
|
return fConfiguration.getLocale();
|
||||||
|
}
|
||||||
|
|
||||||
private void setSchemaValidatorFeature(String name, boolean value)
|
private void setSchemaValidatorFeature(String name, boolean value)
|
||||||
throws SAXNotRecognizedException, SAXNotSupportedException {
|
throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user