Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser crash resulting in note corruption while editing #37

Closed
obilodeau opened this issue Aug 23, 2016 · 4 comments
Closed

parser crash resulting in note corruption while editing #37

obilodeau opened this issue Aug 23, 2016 · 4 comments

Comments

@obilodeau
Copy link
Member

obilodeau commented Aug 23, 2016

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
10-17 05:04:46.865: E/NoteContentBuilder(539): Pour Stéph:
10-17 05:04:46.865: E/NoteContentBuilder(539): Surf's up</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.


Imported from Launchpad using lp2gh.

@obilodeau
Copy link
Member Author

(by j-4)
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.

@obilodeau
Copy link
Member Author

(by j-4)
Must be somewhere in NoteXMLContentBuilder.java: starts at line 183

My testcase:
Created a note on tomboy
Hi
Test me
more

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

Test me more Even more

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.

@obilodeau
Copy link
Member Author

(by noahy)
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 :)

@obilodeau
Copy link
Member Author

(by j-4)
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?!

@obilodeau obilodeau added this to the 0.7.3 milestone Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant