You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Eilon Yardeni <ey...@gmail.com> on 2011/02/07 21:35:17 UTC

[PATCH] vysper - suggested fix to the XMLTokenizer

Hi,

I have been working on an XMPP client based on the building blocks of the
vysper project
and noticed the following:
When the client receives a large Stanza response from the server, some of
the XML tokens
are not parsed properly. Specifically, tag names gets broken (i.e. instead
of "<item ...>" i see "<tem ...>").

I believe the reason is that the XMLTokenizer does not keep state between
two different IoBuffers
that the XMLParser is parsing during the stanza decoding process. It
currently keeps the last position
in the tokenized IoBuffer, but when a new IoBuffer is tokenized, the
previous partial token content
is lost.
The proposed patch fix that by buffering the on-going token chars, rather
than the last position in the current
tokenized IoBuffer.

Regards,
Eilon

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Feb 7, 2011 at 11:17 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> Did this go to trunk?

Thanks for catching that. Committed into trunk in rev 1068204.

/niklas

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Feb 7, 2011 at 10:55 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> Created https://issues.apache.org/jira/browse/VYSPER-265

Committed in rev 1068168. Thanks for the patch, keep em coming :-)

/niklas

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Eilon Yardeni <ey...@gmail.com>.
Created https://issues.apache.org/jira/browse/VYSPER-265

On Mon, Feb 7, 2011 at 4:22 PM, Niklas Gustavsson <ni...@protocol7.com>wrote:

> On Mon, Feb 7, 2011 at 9:55 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> > No test case in hand...
>
> No problem, I'll create one. Would you mind opening a JIRA issue and
> attaching the patch there? That ensures the legal stuff.
>
> /niklas
>

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Feb 7, 2011 at 9:55 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> No test case in hand...

No problem, I'll create one. Would you mind opening a JIRA issue and
attaching the patch there? That ensures the legal stuff.

/niklas

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Eilon Yardeni <ey...@gmail.com>.
No test case in hand...

This was found when receiving different GTalk roster sizes and noticing
that some of the roster contacts are missing, as my code was looking
for inner elements named "item" and some were not parsed correctly.

Thanks,
Eilon

On Mon, Feb 7, 2011 at 3:49 PM, Niklas Gustavsson <ni...@protocol7.com>wrote:

> On Mon, Feb 7, 2011 at 9:35 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> > I have been working on an XMPP client based on the building blocks of the
> > vysper project
>
> Cool, sounds interesting :-)
>
> [Snip]
> > The proposed patch fix that by buffering the on-going token chars, rather
> > than the last position in the current
> > tokenized IoBuffer.
>
> From a quick look, the patch looks great. I would like a test case for
> the bug, I'll write one up unless you already got one at hand?
>
> Anyways, thanks for the report and great work!
>
> /niklas
>

Re: [PATCH] vysper - suggested fix to the XMLTokenizer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Feb 7, 2011 at 9:35 PM, Eilon Yardeni <ey...@gmail.com> wrote:
> I have been working on an XMPP client based on the building blocks of the
> vysper project

Cool, sounds interesting :-)

[Snip]
> The proposed patch fix that by buffering the on-going token chars, rather
> than the last position in the current
> tokenized IoBuffer.

>From a quick look, the patch looks great. I would like a test case for
the bug, I'll write one up unless you already got one at hand?

Anyways, thanks for the report and great work!

/niklas