You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Chris Snow <Ch...@scisys.co.uk> on 2008/03/19 11:01:41 UTC
java.lang.IllegalStateException: Cursor has been disposed
I have a message that is throwing java.lang.IllegalStateException:
Cursor has been disposed
I can't see what I am doing wrong. Any help would be most appreciated.
Thanks in advance ...
public Instruction fromMessage(Message msg) throws
MessageConversionException {
TextMessage textMessage = (TextMessage)msg;
Instruction instruction = null;
MainInstructionWrapperDocument
instructionDocument = null;
try {
System.out.println(
"InstructionRequestConverterImpl: fromMessage()" );
//System.out.println(
textMessage.getText() );
XmlOptions options = new
XmlOptions();
options.setSaveOuter();
ArrayList validationErrors = new
ArrayList();
XmlOptions validationOptions = new
XmlOptions();
validationOptions.setErrorListener(validationErrors);
instructionDocument =
MainInstructionWrapperDocument.Factory.parse( textMessage.getText() );
boolean isValid =
instructionDocument.validate(validationOptions);
if (!isValid)
{
Iterator iter =
validationErrors.iterator();
while (iter.hasNext())
{
System.out.println(">> " +
iter.next() + "\n");
}
}
// The next line throws:
// java.lang.IllegalStateException:
Cursor has been disposed
Instruction[] instructionArray =
(Instruction[])instructionDocument.getMainInstructionWrapper().selectPat
h( instructionXpath );
instruction = instructionArray[0];
// only one child instruction per wrapper
}
catch (Exception e) {
// TODO: log
e.printStackTrace();
throw new
MessageConversionException(e.getMessage());
}
return instruction;
}
RE: java.lang.IllegalStateException: Cursor has been disposed
Posted by Chris Snow <Ch...@scisys.co.uk>.
I've found it...
selectPath( instructionXpath );
returns void!
________________________________
From: Chris Snow [mailto:Chris.Snow@scisys.co.uk]
Sent: 19 March 2008 10:02
To: user@xmlbeans.apache.org
Subject: java.lang.IllegalStateException: Cursor has been disposed
I have a message that is throwing java.lang.IllegalStateException:
Cursor has been disposed
I can't see what I am doing wrong. Any help would be most appreciated.
Thanks in advance ...
public Instruction fromMessage(Message msg) throws
MessageConversionException {
TextMessage textMessage = (TextMessage)msg;
Instruction instruction = null;
MainInstructionWrapperDocument
instructionDocument = null;
try {
System.out.println(
"InstructionRequestConverterImpl: fromMessage()" );
//System.out.println(
textMessage.getText() );
XmlOptions options = new
XmlOptions();
options.setSaveOuter();
ArrayList validationErrors = new
ArrayList();
XmlOptions validationOptions = new
XmlOptions();
validationOptions.setErrorListener(validationErrors);
instructionDocument =
MainInstructionWrapperDocument.Factory.parse( textMessage.getText() );
boolean isValid =
instructionDocument.validate(validationOptions);
if (!isValid)
{
Iterator iter =
validationErrors.iterator();
while (iter.hasNext())
{
System.out.println(">> " +
iter.next() + "\n");
}
}
// The next line throws:
// java.lang.IllegalStateException:
Cursor has been disposed
Instruction[] instructionArray =
(Instruction[])instructionDocument.getMainInstructionWrapper().selectPat
h( instructionXpath );
instruction = instructionArray[0];
// only one child instruction per wrapper
}
catch (Exception e) {
// TODO: log
e.printStackTrace();
throw new
MessageConversionException(e.getMessage());
}
return instruction;
}