Error in retrived XML in Chucks using the getText()

View: New views
10 Messages — Rating Filter:   Alert me  

Error in retrived XML in Chucks using the getText()

by Tanveer Virani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When using the getTExt from the BasicStreamReader, I get the following error: com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even when asked to read up to 4000 at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599) at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967) at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006) at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758) at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993) at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344) at com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614) Calling code snippet: XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE); BasicStreamReader reader = (BasicStreamReader) factory.createXMLStreamReader(input); ... hexPrinter = new HexPrintWriter(temporaryFile); reader.getText(hexPrinter, false); hexPrinter.flush(); I get the first 8000 characters, but after that it breaks. The stream length is 1.4Mb. Any help would be appreciated. Tanveer

Re: Error in retrived XML in Chucks using the getText()

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmmh. What kind of a stream is it? Reading from network, file, or ... ?
Also: which Woodstox version are you using?

-+ Tatu +-

On Fri, Sep 4, 2009 at 1:10 PM, Tanveer
Virani<TanveerVirani@...> wrote:

> When using the getTExt from the BasicStreamReader, I get the following
> error: com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even
> when asked to read up to 4000 at
> com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599) at
> com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967) at
> com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006) at
> com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758) at
> com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993)
> at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344) at
> com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614)
> Calling code snippet: XMLInputFactory factory =
> XMLInputFactory.newInstance();
> factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
> factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
> factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
> BasicStreamReader reader = (BasicStreamReader)
> factory.createXMLStreamReader(input); ... hexPrinter = new
> HexPrintWriter(temporaryFile); reader.getText(hexPrinter, false);
> hexPrinter.flush(); I get the first 8000 characters, but after that it
> breaks. The stream length is 1.4Mb. Any help would be appreciated. Tanveer
> ________________________________
> View this message in context: Error in retrived XML in Chucks using the
> getText()
> Sent from the woodstox - user mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Error in retrived XML in Chucks using the getText()

by Tanveer Virani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The stream is coming from the network (Soap Service).

I'm using version 4.0.5 with the 1.6.12 JRE.

Tanveer

Tanveer Virani wrote:
When using the getTExt from the BasicStreamReader, I get the following error:

com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even when asked to read up to 4000
        at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006)
        at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758)
        at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993)
        at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344)
        at com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614)

Calling code snippet:
        XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
        BasicStreamReader reader = (BasicStreamReader) factory.createXMLStreamReader(input);
...
        hexPrinter = new HexPrintWriter(temporaryFile);
        reader.getText(hexPrinter, false);
        hexPrinter.flush();


I get the first 8000 characters, but after that it breaks. The stream length is 1.4Mb.

Any help would be appreciated.

Tanveer

Re: Error in retrived XML in Chucks using the getText()

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Sep 4, 2009 at 2:16 PM, Tanveer
Virani<TanveerVirani@...> wrote:
>
> The stream is coming from the network (Soap Service).

Ok. Do you know if it might be using Jakarta httpclient (3.1 or 4.0),
or JDK HttpURLConnection?
(might not make a big difference).
Or maybe some client library that wraps network connection.

> I'm using version 4.0.5 with the 1.6.12 JRE.

Thanks! I will try to see what could possibly cause InputStream.read()
to return 0, when non-zero number of bytes were requested (assuming
that is the problem, as suggested by error message).
This could be due to a broken input stream wrapper -- InputStream
javadocs clearly state that a stream has to try to read at least one
byte (or if not yet available, block). But it could just be a side
effect of some kind.

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Error in retrived XML in Chucks using the getText()

by Tanveer Virani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The connection is passed straight through from a tomcat webapp.

We do all processing internally for the SOAP request and envelope.

Tanveer

Tanveer Virani wrote:
When using the getTExt from the BasicStreamReader, I get the following error:

com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even when asked to read up to 4000
        at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006)
        at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758)
        at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993)
        at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344)
        at com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614)

Calling code snippet:
        XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
        BasicStreamReader reader = (BasicStreamReader) factory.createXMLStreamReader(input);
...
        hexPrinter = new HexPrintWriter(temporaryFile);
        reader.getText(hexPrinter, false);
        hexPrinter.flush();


I get the first 8000 characters, but after that it breaks. The stream length is 1.4Mb.

Any help would be appreciated.

Tanveer

Re: Error in retrived XML in Chucks using the getText()

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok. I don't know what exactly is the problem, but I did add bit more
debug info (class name of Reader being invoked) in sources (4.0 and
4.1 branches, trunk), which might help in figuring out what is
happening.
Would it be possible to try out jar included -- the only change from
4.0.5 is the change in exception being thrown (it's also
XMLStreamException directly, instead of being wrapped, which more
clearly shows the location)?

-+ Tatu +-

ps. Had to strip out debug info from jar (codehaus mailing list size
limitations...); might lose line numbers... but it's quite easy to see
which line throws the exception anyway

On Fri, Sep 4, 2009 at 2:43 PM, Tanveer
Virani<TanveerVirani@...> wrote:

>
> The connection is passed straight through from a tomcat webapp.
>
> We do all processing internally for the SOAP request and envelope.
>
> Tanveer
>
>
> Tanveer Virani wrote:
>>
>> When using the getTExt from the BasicStreamReader, I get the following
>> error:
>>
>> com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even when
>> asked to read up to 4000
>>       at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599)
>>       at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
>>       at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006)
>>       at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758)
>>       at
>> com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993)
>>       at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344)
>>       at
>> com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614)
>>
>> Calling code snippet:
>>       XMLInputFactory factory = XMLInputFactory.newInstance();
>>       factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
>>       factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
>>       factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
>>       BasicStreamReader reader = (BasicStreamReader)
>> factory.createXMLStreamReader(input);
>> ...
>>       hexPrinter = new HexPrintWriter(temporaryFile);
>>       reader.getText(hexPrinter, false);
>>       hexPrinter.flush();
>>
>>
>> I get the first 8000 characters, but after that it breaks. The stream
>> length is 1.4Mb.
>>
>> Any help would be appreciated.
>>
>> Tanveer
>>
>
> --
> View this message in context: http://www.nabble.com/Error-in-retrived-XML-in-Chucks-using-the-getText%28%29-tp25301114p25302455.html
> Sent from the woodstox - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

woodstox-core-asl-4.0.6.jar (461K) Download Attachment

Re: Error in retrived XML in Chucks using the getText()

by Tanveer Virani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dropped the new jar in, and reran.

Here's the stack trace:
com.ctc.wstx.exc.WstxException: Reader (of type com.ctc.wstx.io.MergedReader) returned 0 characters, even when asked to read up to 4000
 at [row,col {unknown-source}]: [1,1]
        at com.ctc.wstx.io.ReaderSource.readInto(Unknown Source)
        at com.ctc.wstx.io.BranchingReaderSource.readInto(Unknown Source)
        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
        at com.ctc.wstx.sr.StreamScanner.getNextChar(Unknown Source)
        at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(Unknown Source)
        at com.ctc.wstx.sr.BasicStreamReader.getText(Unknown Source)
        at com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:649)

thanks,
Tanveer

Cowtowncoder wrote:
Ok. I don't know what exactly is the problem, but I did add bit more
debug info (class name of Reader being invoked) in sources (4.0 and
4.1 branches, trunk), which might help in figuring out what is
happening.
Would it be possible to try out jar included -- the only change from
4.0.5 is the change in exception being thrown (it's also
XMLStreamException directly, instead of being wrapped, which more
clearly shows the location)?

-+ Tatu +-

ps. Had to strip out debug info from jar (codehaus mailing list size
limitations...); might lose line numbers... but it's quite easy to see
which line throws the exception anyway

On Fri, Sep 4, 2009 at 2:43 PM, Tanveer
Virani<TanveerVirani@elluminate.com> wrote:
>
> The connection is passed straight through from a tomcat webapp.
>
> We do all processing internally for the SOAP request and envelope.
>
> Tanveer
>
>
> Tanveer Virani wrote:
>>
>> When using the getTExt from the BasicStreamReader, I get the following
>> error:
>>
>> com.ctc.wstx.exc.WstxIOException: Reader returned 0 characters, even when
>> asked to read up to 4000
>>       at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:599)
>>       at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
>>       at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1006)
>>       at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:758)
>>       at
>> com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:4993)
>>       at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1344)
>>       at
>> com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:614)
>>
>> Calling code snippet:
>>       XMLInputFactory factory = XMLInputFactory.newInstance();
>>       factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
>>       factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
>>       factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
>>       BasicStreamReader reader = (BasicStreamReader)
>> factory.createXMLStreamReader(input);
>> ...
>>       hexPrinter = new HexPrintWriter(temporaryFile);
>>       reader.getText(hexPrinter, false);
>>       hexPrinter.flush();
>>
>>
>> I get the first 8000 characters, but after that it breaks. The stream
>> length is 1.4Mb.
>>
>> Any help would be appreciated.
>>
>> Tanveer
>>
>
> --
> View this message in context: http://www.nabble.com/Error-in-retrived-XML-in-Chucks-using-the-getText%28%29-tp25301114p25302455.html
> Sent from the woodstox - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

 
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Re: Error in retrived XML in Chucks using the getText()

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Sep 4, 2009 at 9:45 PM, Tanveer
Virani<TanveerVirani@...> wrote:

>
> Dropped the new jar in, and reran.
>
> Here's the stack trace:
> com.ctc.wstx.exc.WstxException: Reader (of type
> com.ctc.wstx.io.MergedReader) returned 0 characters, even when asked to read
> up to 4000
>  at [row,col {unknown-source}]: [1,1]
>        at com.ctc.wstx.io.ReaderSource.readInto(Unknown Source)
>        at com.ctc.wstx.io.BranchingReaderSource.readInto(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.getNextChar(Unknown Source)
>        at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(Unknown Source)
>        at com.ctc.wstx.sr.BasicStreamReader.getText(Unknown Source)
>        at
> com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:649)

Strange. I wonder if this could be due to merged reader getting
initialized with empty contents.
That could explain it... I'll need to figure out a test case for
reproducing the problem.

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Error in retrived XML in Chucks using the getText()

by Tanveer Virani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When I upgraded to Tomcat 6.0.20 from Tomcat 5.5.26, the problem when away. I'm thinking that it may have to do with Tomcat and the Velocity engine (1.6.2). I tryed writing the stream directly to a temp with using any XML parsing, and still wound up with only k.

Cowtowncoder wrote:
On Fri, Sep 4, 2009 at 9:45 PM, Tanveer
Virani<TanveerVirani@elluminate.com> wrote:
>
> Dropped the new jar in, and reran.
>
> Here's the stack trace:
> com.ctc.wstx.exc.WstxException: Reader (of type
> com.ctc.wstx.io.MergedReader) returned 0 characters, even when asked to read
> up to 4000
>  at [row,col {unknown-source}]: [1,1]
>        at com.ctc.wstx.io.ReaderSource.readInto(Unknown Source)
>        at com.ctc.wstx.io.BranchingReaderSource.readInto(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.loadMore(Unknown Source)
>        at com.ctc.wstx.sr.StreamScanner.getNextChar(Unknown Source)
>        at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(Unknown Source)
>        at com.ctc.wstx.sr.BasicStreamReader.getText(Unknown Source)
>        at
> com.elluminate.service.proxy.impl.WebServiceProxy.processStreamValue(WebServiceProxy.java:649)

Strange. I wonder if this could be due to merged reader getting
initialized with empty contents.
That could explain it... I'll need to figure out a test case for
reproducing the problem.

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Error in retrived XML in Chucks using the getText()

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 9, 2009 at 12:05 AM, Tanveer
Virani<TanveerVirani@...> wrote:
>
> When I upgraded to Tomcat 6.0.20 from Tomcat 5.5.26, the problem when away.
> I'm thinking that it may have to do with Tomcat and the Velocity engine
> (1.6.2). I tryed writing the stream directly to a temp with using any XML

Ok, I can google to see if there's anything indicating problems with
streams that can return 0 bytes/chars per read -- that would explain
problems Woodstox has. That is not the only possibility, just most
obvious.

> parsing, and still wound up with only k.

Interesting. I think what I will do is keep this in mind; and if I can
not reproduce this (I will add couple of unit tests for specific kinds
of constrainted streams, ones that only produce 1 byte/char per read),
wait to see if anyone else hits the same problem. I need to be able to
reproduce it before it can be fixed.

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email