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

notesCloudObject is null #25

Closed
lhagan opened this issue Apr 7, 2023 · 3 comments
Closed

notesCloudObject is null #25

lhagan opened this issue Apr 7, 2023 · 3 comments

Comments

@lhagan
Copy link

lhagan commented Apr 7, 2023

I'm getting the following error when I run the jar:

Cannot invoke "de.hamburgchimps.apple.notes.liberator.entity.NotesCloudObject.getzTypeUti()" because "notesCloudObject" is null

apple-notes-liberator appears to have found the correct database since it copied notes.sqlite into the liberated-notes folder. I manually queried that database using the following command:

sqlite3 notes.sqlite "SELECT writefile('note_data.gz', zdata) FROM zicnotedata WHERE znote = 100"

The extracted data includes the text of one of my notes, so I don't think the problem is with the source data.

My configuration:

  • macOS 13.2.1
  • java "20" 2023-03-21
  • apple-notes-liberator release 1.0.3

Here's some additional information from the log:

ERROR [de.ham.app.not.lib.dat.Table] (main) Failed to parse table: java.lang.RuntimeException: no data to parse

Any ideas of what might be tripping it up?

alexkolson added a commit that referenced this issue Apr 7, 2023
@alexkolson
Copy link
Contributor

alexkolson commented Apr 7, 2023

Hi @lhagan, sorry you are facing this issue! I have just released a potential fix! Could you try v1.0.4 and let me know if it works for you?

In case you are interested in more detailed information: The (potential) fix checks to make sure the particular notes object that the application is attempting to parse is not null before attempting to determine what type it is. My suspicion is that the particular notes object that the application is attempting to parse is deleted but still lingering around as an attachment in the note data itself. My general impression is that deleted note objects and references to deleted note objects can still linger around in the Notes.app database for quite some time, and apple-notes-liberator doesn't handle such cases as well as it should. Hopefully with this change though, it should no longer attempt to determine the type of a deleted notes object and thus not throw a NullPointerException.

Of course I could be wrong and the problem could be something else entirely! I am curious to see if v1.0.4 works for you.

Long-term, I would like to be able to have better tests for deleted notes cases, but right now my test case is "manually run against my Notes.app database that contains deleted notes and see if it works", which I know is not great. Perhaps I can seed some test sqlite databases with data representing different scenarios and use them to write some automated tests. But anyway, I digress. :)

Thank you for taking the time to make an issue and I hope to hear back from you!

@lhagan
Copy link
Author

lhagan commented Apr 7, 2023

Wow -- thanks for the quick solution! v1.0.4 fixed this issue.

@lhagan lhagan closed this as completed Apr 7, 2023
@alexkolson
Copy link
Contributor

Awesome! Glad to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants