Reputation: 9452
This was reported to me at a production site. We have a database table for messages and the objects inside are stored as XML using the standard Java XMLEncoder. When we process the message we decode the objects from the field in the database.
Sometimes the client gets this error logged.
ERROR Dec 15 17:19:49 services.ScheduleRunner - 0 occurred processing
message 4183439 java.lang.ArrayIndexOutOfBoundsException: 0
at com.sun.beans.ObjectHandler.dequeueResult(Unknown Source)
at java.beans.XMLDecoder.readObject(Unknown Source)
at com.hl7.services.ScheduleRunner.run(ScheduleRunner.java:116)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
They sent me the XML and I tried it myself and it works for me. Any idea why this would fail? They currently run Java 6_22 and I have Java 6_26.
It's also wierd that it shows "Unknown Source". Isn't the Java source deployed with the runtime? The other weird thing is that my source file does not have anything at line 116.
TIA
Upvotes: 1
Views: 1813
Reputation: 171
Use encoder = new XMLDecoder( org.apache.commons.io.IOUtils.toInputStream(stringfromdatabase));
for creating an InputStream
from database.
Upvotes: 1
Reputation: 21
Probably is the reason of the special characters.
< <
> >
& &
' '
" "
Upvotes: 2