XmlValueOutOfRangeException
---------------------------
Key: XBEAN-116
URL: https://issues.apache.org/jira/browse/XBEAN-116
Project: XBean
Issue Type: Bug
Affects Versions: 2.4
Environment: Windows XP, Java 1.5.0_12, Xbean 2.4, Eclipse 3.4
Reporter: Ashish Gupta
Priority: Critical
Hi,
In our project, we are creating the xml messages using XMLBeans on the wire &
send it back to the client.
Snippet of code which creates the xml messages using XmlBeans is given below.
Bold text is the place where I got the error. The String value of Enum which I
am setting up is "duplicateMessageID" (required as per business norms).
If I use string value as "invalidMessageID" the XmlBeans doesn't complaint. Is
there any length constrainst in setting up the string value.
*******************************************************************
cuppsIlType.setMessageName(MessageNameT.STREAM_ERROR_BODY_REQUEST);
StreamErrorBodyRequestT respType = cuppsIlType.addNewStreamErrorBodyRequest();
respType.setExpectedLength("00");
respType.setStringValue(CuppsResultXT.DUPLICATE_MESSAGE_ID.toString());
message.getTCPReceiver().write(document.toString());
*******************************************************************
NOTE: Error which I obtained is given below in red. The error which I got is
XmlValueOutOfRangeException, I checked for different postings on internet about
it. On one posting I find out that guy name Lawrence Jones mentioned about
"JavaBase64Holder.lex() simply converts the String to UTF-8 bytes and then
passes those bytes into Base64.decode() which must be returning null for you to
see this error". So I created a simple test case shown below
String temp ="duplicateMessageID";
byte[] utf8Bytes = temp.getBytes("UTF8");
String value = org.apache.xerces.impl.dv.util.Base64.encode(utf8Bytes);
System.out.println(" The value is "+value);
It produces the result : The value is ZHVwbGljYXRlTWVzc2FnZUlE
Which shows that string is coming correct but somehow XmlBeans is not
liking something in string.
Can you please let me know is this a Bug or I am soing something wrong in the
code. I would really appreciate if I get any reply asap.
org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid value: not
encoded properly
at
org.apache.xmlbeans.impl.values.XmlObjectBase$ValueOutOfRangeValidationContext.invalid(XmlObjectBase.java:314)
at
org.apache.xmlbeans.impl.values.JavaBase64Holder.lex(JavaBase64Holder.java:77)
at
org.apache.xmlbeans.impl.values.JavaBase64HolderEx.set_text(JavaBase64HolderEx.java:46)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1166)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.set_String(XmlObjectBase.java:1111)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.setStringValue(XmlObjectBase.java:1711)
at
com.arinc.afd.cupps.application.AppSocketHoldingPin.dispatchCuppsMessage(AppSocketHoldingPin.java:280)
at
com.arinc.afd.cupps.application.AppSocketHoldingPin.dispatchMessage(AppSocketHoldingPin.java:157)
at
com.arinc.afd.cupps.shared.net.TCPReceiver$SocketThread.run(TCPReceiver.java:221)
Thanks & Regards,
Ashish
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.