You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/10/19 01:22:09 UTC
svn commit: r326301 - in /xmlbeans/trunk/src:
store/org/apache/xmlbeans/impl/store/
typeimpl/org/apache/xmlbeans/impl/values/ xmlpublic/org/apache/xmlbeans/
Author: radup
Date: Tue Oct 18 16:22:00 2005
New Revision: 326301
URL: http://svn.apache.org/viewcvs?rev=326301&view=rev
Log:
Added messages to XmlValueNotSupportedException.
Modified:
xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotSupportedException.java
xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlErrorCodes.java
xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/message.properties
Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java?rev=326301&r1=326300&r2=326301&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java Tue Oct 18 16:22:00 2005
@@ -3197,7 +3197,7 @@
{
_context.bookmark(
new XmlLineNumber(_startLocator.getLineNumber(),
- _startLocator.getColumnNumber(), -1));
+ _startLocator.getColumnNumber() - 1, -1));
}
for (int i = 0, len = atts.getLength(); i < len; i++)
@@ -3264,7 +3264,7 @@
{
_context.bookmark(
new XmlLineNumber(_startLocator.getLineNumber(),
- _startLocator.getColumnNumber(), -1));
+ _startLocator.getColumnNumber() - 1, -1));
}
}
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java?rev=326301&r1=326300&r2=326301&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java Tue Oct 18 16:22:00 2005
@@ -54,6 +54,7 @@
import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
import org.apache.xmlbeans.impl.validator.Validator;
import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
+import org.apache.xmlbeans.XmlErrorCodes;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.SchemaAttributeModel;
import org.apache.xmlbeans.XmlAnySimpleType;
@@ -1356,7 +1357,8 @@
public double doubleValue()
{ BigDecimal bd = bigDecimalValue(); return bd == null ? 0.0 : bd.doubleValue(); }
public BigDecimal bigDecimalValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "numeric"}); }
// numerics: integral
public BigInteger bigIntegerValue()
@@ -1459,7 +1461,8 @@
// enums
public StringEnumAbstractBase enumValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "enum"}); }
// various
public String stringValue()
@@ -1559,23 +1562,32 @@
{ objectSet(obj); }
public byte[] byteArrayValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "byte[]"}); }
public boolean booleanValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "boolean"}); }
public GDate gDateValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "Date"}); }
public Date dateValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "Date"}); }
public Calendar calendarValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "Calendar"}); }
public GDuration gDurationValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "Duration"}); }
public QName qNameValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "QName"}); }
public List listValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "List"}); }
public List xlistValue()
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_S2J,
+ new Object[] {getPrimitiveTypeName(), "List"}); }
public Object objectValue()
{ return java_value(this); }
@@ -1952,9 +1964,11 @@
}
protected void set_list(List list)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"List", getPrimitiveTypeName() }); }
protected void set_boolean(boolean v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"boolean", getPrimitiveTypeName() }); }
protected void set_byte(byte v)
{ set_int((int) v); }
protected void set_short(short v)
@@ -1971,10 +1985,12 @@
{ set_BigDecimal(new BigDecimal(v)); }
protected void set_enum(StringEnumAbstractBase e)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"enum", getPrimitiveTypeName() }); }
protected void set_ByteArray(byte[] b)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"byte[]", getPrimitiveTypeName() }); }
protected void set_b64(byte[] b)
{ set_ByteArray(b); }
protected void set_hex(byte[] b)
@@ -1982,25 +1998,44 @@
protected void set_BigInteger(BigInteger v)
{ set(new BigDecimal(v)); }
protected void set_BigDecimal(BigDecimal v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"numeric", getPrimitiveTypeName() }); }
protected void set_Date(Date v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"Date", getPrimitiveTypeName() }); }
protected void set_Calendar(Calendar v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"Calendar", getPrimitiveTypeName() }); }
protected void set_GDate(GDateSpecification v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"Date", getPrimitiveTypeName() }); }
protected void set_GDuration(GDurationSpecification v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"Duration", getPrimitiveTypeName() }); }
protected void set_ComplexXml(XmlObject v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"complex content", getPrimitiveTypeName() }); }
protected void set_QName(QName v)
- { throw new XmlValueNotSupportedException(); }
+ { throw new XmlValueNotSupportedException(XmlErrorCodes.EXCEPTION_VALUE_NOT_SUPPORTED_J2S,
+ new Object[] {"QName", getPrimitiveTypeName() }); }
protected void set_notation(String v)
{ throw new XmlValueNotSupportedException(); }
protected void set_xmlanysimple(XmlAnySimpleType v)
{ set_String(v.getStringValue()); }
+
+ private final String getPrimitiveTypeName()
+ {
+ SchemaType type = schemaType();
+ if (type.isNoType())
+ return "unknown";
+ SchemaType t = type.getPrimitiveType();
+ if (t == null)
+ return "complex";
+ else
+ return t.getName().getLocalPart();
+ }
private final boolean comparable_value_spaces(SchemaType t1, SchemaType t2)
{
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotSupportedException.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotSupportedException.java?rev=326301&r1=326300&r2=326301&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotSupportedException.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotSupportedException.java Tue Oct 18 16:22:00 2005
@@ -15,8 +15,11 @@
package org.apache.xmlbeans.impl.values;
+import org.apache.xmlbeans.XmlError;
+
public class XmlValueNotSupportedException extends XmlValueOutOfRangeException
{
public XmlValueNotSupportedException() {}
public XmlValueNotSupportedException(String message) { super(message); }
+ public XmlValueNotSupportedException(String code, Object[] args) { super(XmlError.formattedMessage(code, args)); }
}
Modified: xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlErrorCodes.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlErrorCodes.java?rev=326301&r1=326300&r2=326301&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlErrorCodes.java (original)
+++ xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlErrorCodes.java Tue Oct 18 16:22:00 2005
@@ -66,6 +66,8 @@
public static final String INVALID_DOCUMENT_TYPE = "invalid.document.type";
public static final String CANNOT_LOAD_FILE = "cannot.load.file";
public static final String EXCEPTION_LOADING_URL = "exception.loading.url";
+ public static final String EXCEPTION_VALUE_NOT_SUPPORTED_J2S = "exception.value.not.supported.j2s";
+ public static final String EXCEPTION_VALUE_NOT_SUPPORTED_S2J = "exception.value.not.supported.s2j";
//
// xml errors
Modified: xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/message.properties
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/message.properties?rev=326301&r1=326300&r2=326301&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/message.properties (original)
+++ xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/message.properties Tue Oct 18 16:22:00 2005
@@ -35,6 +35,11 @@
exception.loading.url = \
{0} exception while trying to load {1}: {2}
+exception.value.not.supported.j2s = \
+Could not set Java {0} type to Schema {1} type
+
+exception.value.not.supported.s2j = \
+Could not get a Java {1} type from a Schema {0} type
#
# xml messages
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org