You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/10/11 19:13:03 UTC
svn commit: r462861 - in /xerces/java/trunk/src/org/apache/xerces/impl:
msg/XMLSchemaMessages.properties xs/XMLSchemaLoader.java
Author: mrglavas
Date: Wed Oct 11 10:13:02 2006
New Revision: 462861
URL: http://svn.apache.org/viewvc?view=rev&rev=462861
Log:
Localize schemaSource error messages.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?view=diff&rev=462861&r1=462860&r2=462861
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Wed Oct 11 10:13:02 2006
@@ -286,3 +286,10 @@
TargetNamespace.2 = TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of ''{1}''.
UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' is not declared.
UndeclaredPrefix = UndeclaredPrefix: Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
+
+# JAXP 1.2 schema source property errors
+
+ jaxp12-schema-source-type.1 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have a value of type ''{0}''. Possible types of the value supported are String, File, InputStream, InputSource or an array of these types.
+ jaxp12-schema-source-type.2 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have an array value of type ''{0}''. Possible types of the array supported are Object, String, File, InputStream and InputSource.
+ jaxp12-schema-source-ns = When using an array of Objects as the value of the 'http://java.sun.com/xml/jaxp/properties/schemaSource' property, it is illegal to have two schemas that share the same target namespace.
+
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?view=diff&rev=462861&r1=462860&r2=462861
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java Wed Oct 11 10:13:02 2006
@@ -45,6 +45,7 @@
import org.apache.xerces.util.DOMEntityResolverWrapper;
import org.apache.xerces.util.DOMErrorHandlerWrapper;
import org.apache.xerces.util.DefaultErrorHandler;
+import org.apache.xerces.util.MessageFormatter;
import org.apache.xerces.util.ParserConfigurationSettings;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.util.XMLSymbols;
@@ -736,11 +737,11 @@
!InputSource.class.isAssignableFrom(componentType)
) {
// Not an Object[], String[], File[], InputStream[], InputSource[]
+ MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
throw new XMLConfigurationException(
- XMLConfigurationException.NOT_SUPPORTED, "\""+JAXP_SCHEMA_SOURCE+
- "\" property cannot have an array of type {"+componentType.getName()+
- "}. Possible types of the array supported are Object, String, File, "+
- "InputStream, InputSource.");
+ XMLConfigurationException.NOT_SUPPORTED,
+ mf.formatMessage(fErrorReporter.getLocale(), "jaxp12-schema-source-type.2",
+ new Object [] {componentType.getName()}));
}
// JAXP spec. allow []s of type String, File, InputStream,
@@ -749,7 +750,7 @@
// make local vector for storing target namespaces of schemasources specified in object arrays.
ArrayList jaxpSchemaSourceNamespaces = new ArrayList();
for (int i = 0; i < objArr.length; i++) {
- if(objArr[i] instanceof InputStream ||
+ if (objArr[i] instanceof InputStream ||
objArr[i] instanceof InputSource) {
SchemaGrammar g = (SchemaGrammar)fJAXPCache.get(objArr[i]);
if (g != null) {
@@ -777,10 +778,10 @@
if (grammar != null) {
targetNamespace = grammar.getTargetNamespace();
if (jaxpSchemaSourceNamespaces.contains(targetNamespace)) {
- //when an array of objects is passed it is illegal to have two schemas that share same namespace.
- throw new java.lang.IllegalArgumentException(
- " When using array of Objects as the value of SCHEMA_SOURCE property , " +
- "no two Schemas should share the same targetNamespace. " );
+ // when an array of objects is passed it is illegal to have two schemas that share same namespace.
+ MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
+ throw new java.lang.IllegalArgumentException(mf.formatMessage(fErrorReporter.getLocale(),
+ "jaxp12-schema-source-ns", null));
}
else {
jaxpSchemaSourceNamespaces.add(targetNamespace) ;
@@ -797,9 +798,7 @@
}
}//processJAXPSchemaSource
- private XMLInputSource xsdToXMLInputSource(
- Object val)
- {
+ private XMLInputSource xsdToXMLInputSource(Object val) {
if (val instanceof String) {
// String value is treated as a URI that is passed through the
// EntityResolver
@@ -809,7 +808,8 @@
XMLInputSource xis = null;
try {
xis = fEntityManager.resolveEntity(fXSDDescription);
- } catch (IOException ex) {
+ }
+ catch (IOException ex) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"schema_reference.4",
new Object[] { loc }, XMLErrorReporter.SEVERITY_ERROR);
@@ -820,12 +820,15 @@
return new XMLInputSource(null, loc, null);
}
return xis;
- } else if (val instanceof InputSource) {
+ }
+ else if (val instanceof InputSource) {
return saxToXMLInputSource((InputSource) val);
- } else if (val instanceof InputStream) {
+ }
+ else if (val instanceof InputStream) {
return new XMLInputSource(null, null, null,
(InputStream) val, null);
- } else if (val instanceof File) {
+ }
+ else if (val instanceof File) {
File file = (File) val;
InputStream is = null;
try {
@@ -837,11 +840,11 @@
}
return new XMLInputSource(null, null, null, is, null);
}
+ MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
throw new XMLConfigurationException(
- XMLConfigurationException.NOT_SUPPORTED, "\""+JAXP_SCHEMA_SOURCE+
- "\" property cannot have a value of type {"+val.getClass().getName()+
- "}. Possible types of the value supported are String, File, InputStream, "+
- "InputSource OR an array of these types.");
+ XMLConfigurationException.NOT_SUPPORTED,
+ mf.formatMessage(fErrorReporter.getLocale(), "jaxp12-schema-source-type.1",
+ new Object [] {val != null ? val.getClass().getName() : "null"}));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org