parser crash resulting in note corruption while editing

Bug #1067604 reported by Olivier Bilodeau
54
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Tomdroid
Fix Released
Critical
Unassigned
Beta
Fix Released
Critical
Unassigned

Bug Description

This is a bug opened mostly for myself so I can reproduce and give better explanations later. Right now I'm in a rush release mode so I have no time to track this.

Stack trace:
10-17 05:04:46.815: V/NoteContentBuilder(539): parsing note Stuff to see
10-17 05:04:46.815: W/System.err(539): org.apache.harmony.xml.ExpatParser$ParseException: At line 3, column 48: not well-formed (invalid token)
10-17 05:04:46.855: W/System.err(539): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:499)
10-17 05:04:46.855: W/System.err(539): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:484)
10-17 05:04:46.855: W/System.err(539): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:309)
10-17 05:04:46.855: W/System.err(539): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:267)
10-17 05:04:46.855: W/System.err(539): at javax.xml.parsers.SAXParser.parse(SAXParser.java:390)
10-17 05:04:46.865: W/System.err(539): at org.tomdroid.util.NoteContentBuilder$1.run(NoteContentBuilder.java:103)
10-17 05:04:46.865: W/System.err(539): at java.lang.Thread.run(Thread.java:856)
10-17 05:04:46.865: E/NoteContentBuilder(539): There was an error parsing the note <note-content>
10-17 05:04:46.865: E/NoteContentBuilder(539): Pour Stéph:
10-17 05:04:46.865: E/NoteContentBuilder(539): <list><list-item dir="ltr">Surf's up</list-item dir="ltr"></list><list-item dir="ltr">

note: Stuff to see

I removed only a few clean ascii lines but had UI issues with the rich-editor in the emulator (only one backspace at a time). I feel it's an encoding issue or something closely related like tag corruption by the rich editor.

Revision history for this message
Stefan Hammer (j-4-deactivatedaccount) wrote :

I can confirm that this bug is always present, when you edit a note with bullets inside.
The note can be rendered when just displaying, but editing ruins the format somehow.

Changed in tomdroid:
milestone: none → 0.7.3
status: New → Triaged
Revision history for this message
Stefan Hammer (j-4-deactivatedaccount) wrote :

Must be somewhere in NoteXMLContentBuilder.java: starts at line 183

My testcase:
Created a note on tomboy
<note-content version="0.1">Hi
<list><list-item dir="ltr">Test me</list-item>
<list-item dir="ltr">more</list-item>
</list></note-content>

Open on tomdroid and add one line (no bullets, text is "Even more". Leads to this (and crash):

<note-content>
<list><list-item dir="ltr">Test me</list-item dir="ltr">
</list>
<list-item dir="ltr">more</list-item dir="ltr">
<list-item dir="ltr"></list-item dir="ltr">
<list-item dir="ltr">Even more</list-item dir="ltr">
</note-content>

So the main problem is, that the list is closed too early. Further, there is a empty list-item. My new line is added as a list-item.

Revision history for this message
NoahY (noahy) wrote :

I think I broke this getting nested tags to work. I guessed that would be the result, since lists are complicated. Too bad there isn't a standard java library for converting spannable text to xml. Anyway, good luck :)

Revision history for this message
Stefan Hammer (j-4-deactivatedaccount) wrote :

We should consider using this class instead of our selfmade editor:

https://android.googlesource.com/platform/frameworks/ex/+/master/common/java/com/android/ex/editstyledtext/EditStyledText.java

This thing looks powerful - we for sure can adopt it to our needs, can we?!

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.