Skip to main content

FastInfosetException: Illegal state when decoding identifying string on fir

5 replies [Last post]
cnirrad
Offline
Joined: 2004-09-27

Hello,

I am taking my first look at FastInfoset, and have run into a problem when trying to encode an XML file into a FastInfoset, and then back to XML. Going to the FI works fine, but I get an exception when trying to convert back to XML. My test driver uses the code examples from https://fi.dev.java.net/how-to-use.html.

Here is the full stack trace, please advise:

org.jvnet.fastinfoset.FastInfosetException: Illegal state when decoding identifying string on first bit
at com.sun.xml.fastinfoset.Decoder.decodeIdentifyingNonEmptyStringOnFirstBit(Decoder.java:764)
at com.sun.xml.fastinfoset.Decoder.decodeLiteralQualifiedName(Decoder.java:533)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.processDII(SAXDocumentParser.java:407)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:345)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:307)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:282)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at FastInfosetTest.FI2XML(FastInfosetTest.java:57)
at FastInfosetTest.main(FastInfosetTest.java:44)
ERROR: 'Illegal state when decoding identifying string on first bit'
javax.xml.transform.TransformerException: org.jvnet.fastinfoset.FastInfosetException: Illegal state when decoding identifying string on first bit
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at FastInfosetTest.FI2XML(FastInfosetTest.java:57)
at FastInfosetTest.main(FastInfosetTest.java:44)
Caused by: org.jvnet.fastinfoset.FastInfosetException: Illegal state when decoding identifying string on first bit
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:286)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
... 4 more
---------
org.jvnet.fastinfoset.FastInfosetException: Illegal state when decoding identifying string on first bit
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:286)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at FastInfosetTest.FI2XML(FastInfosetTest.java:57)
at FastInfosetTest.main(FastInfosetTest.java:44)
---------
org.jvnet.fastinfoset.FastInfosetException: Illegal state when decoding identifying string on first bit
at com.sun.xml.fastinfoset.Decoder.decodeIdentifyingNonEmptyStringOnFirstBit(Decoder.java:764)
at com.sun.xml.fastinfoset.Decoder.decodeLiteralQualifiedName(Decoder.java:533)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.processDII(SAXDocumentParser.java:407)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:345)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:307)
at com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:282)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at FastInfosetTest.FI2XML(FastInfosetTest.java:57)
at FastInfosetTest.main(FastInfosetTest.java:44)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aldobrucale
Offline
Joined: 2003-06-12

I'm trying to use FastInfoset to serialize my data, but I'm getting the same exception 'Illegal state when decoding identifying string on first bit'.
My document is created by a SaxDeviceWriter using the org.xml.sax.ContentHandler interface, and parsed back via the same interface. I guess that setting the "namespaceAware" property in the SAXParserFactory in the previous example has some effect on the way the writer is used. What should I do to get a valid FastInfoset document?

oleksiys
Offline
Joined: 2006-01-25

Hello,

can you pls. share your code (just part, which uses FI), and may be simple document you're working with.

Thanks.

sandoz
Offline
Joined: 2003-06-20

I have updated the documentation for the conversion of an XML document to a Fast Infoset document.

This fragment has been added for the creation of the SAXParser:

// Instantiate JAXP SAX parser factory
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
/* Set parser to be namespace aware
* Very important to do otherwise invalid FI documents will be
* created by the SAXDocumentSerializer
*/
saxParserFactory.setNamespaceAware(true);
// Instantiate the JAXP SAX parser
SAXParser saxParser = saxParserFactory.newSAXParser();

Thanks again for finding this issue,
Paul.

cnirrad
Offline
Joined: 2004-09-27

That worked.

Thanks!

sandoz
Offline
Joined: 2003-06-20

> Hello,
>
> I am taking my first look at FastInfoset, and have
> run into a problem when trying to encode an XML file
> into a FastInfoset, and then back to XML. Going to
> the FI works fine, but I get an exception when trying
> to convert back to XML. My test driver uses the code
> examples from
> https://fi.dev.java.net/how-to-use.html.
>

Thanks for finding this, doh! i forgot to present code to set up the SAX parser factory to support namespaces.

I will update the documentation.

Paul.