List parsing is incorrect

Bug #483101 reported by Benoit Garret on 2009-11-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Tomdroid
Fix Released
Medium
Olivier Bilodeau

Bug Description

The note parsing code is incorrect.

The "characters" method in a org.xml.sax.helpers.DefaultHandler class is not guaranteed to return the whole string between two tags (eg. if there is a newline in the string).

This means that something like this (hope it won't get too mangled by launchpad):

list
   list-item Test newline newline end-list-item
end-list

will get two bullets, one before the "Test" string and another before an empty line.

Olivier Bilodeau (plaxx) wrote :

related to bug #364850

in this bug, the parser does send the special & character in another call to characters() so reading this bug description showed me the right way

I'll use StringBuilder for every element parsed by NoteHandler and NoteContentHandler.

Changed in tomdroid:
assignee: nobody → Olivier Bilodeau (plaxx)
importance: Undecided → Medium
status: New → Confirmed
Olivier Bilodeau (plaxx) wrote :

forget what I said about the StringBuilder, this will only work for little meta tags (like title), it won't apply to the note-content since i'm already adding pieces of string to a builder.

What I'm trying to do right now is to keep some basic state in characters() and do the setSpan() in endElement(). I haven't figured the right thing to do with lists yet but the rest is dealt with.

Still, I'm afraid that this will introduce bugs I haven't thought of..

Olivier Bilodeau (plaxx) wrote :

Attached is my testcase for this bug.

Olivier Bilodeau (plaxx) wrote :

Just committed a fix for this issue in main/. It worked for the test note attached to this bug and a bunch of my most complicated personal notes.

To be clear: not only list parsing was affected. I modified the handing on all tags and like I said in the commit message, I'm afraid I have introduced regression on weird notes. The ones from tomboy don't stress me that much but anything custom, like coming from snowy or other clients could be more at risk since I don't have test notes for them.

Please bang on it if you have a development environment as this is as close as 0.3 as one will get.

Changed in tomdroid:
milestone: none → 0.3
status: Confirmed → Fix Committed
Olivier Bilodeau (plaxx) on 2010-02-11
Changed in tomdroid:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments