List parsing is incorrect

Bug #483101 reported by Benoit Garret
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.

Revision history for this message
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
Revision history for this message
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..

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

Attached is my testcase for this bug.

Revision history for this message
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)
Changed in tomdroid:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.