Skip to content

Corrupted library_index.json prevents IDE from starting #7937

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

Closed
PaulStoffregen opened this issue Aug 27, 2018 · 1 comment
Closed

Corrupted library_index.json prevents IDE from starting #7937

PaulStoffregen opened this issue Aug 27, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@PaulStoffregen
Copy link
Contributor

If library_index.json becomes corrupted, the IDE can't start up and throws a NullPointerException.

Error parsing library.index:Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: (FileInputStream); line: 1, column: 2]
java.lang.NullPointerException
        at cc.arduino.contributions.libraries.LibrariesIndexer.rescanLibraries(LibrariesIndexer.java:140)
        at cc.arduino.contributions.libraries.LibrariesIndexer.setLibrariesFolders(LibrariesIndexer.java:109)
        at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:715)
        at processing.app.Base.onBoardOrPortChange(Base.java:1313)
        at processing.app.Base$12.actionPerformed(Base.java:1540)
        at processing.app.Base.filterVisibilityOfSubsequentBoardMenus(Base.java:1579)
        at processing.app.Base.access$000(Base.java:83)
        at processing.app.Base$11.actionPerformed(Base.java:1512)
        at processing.app.Base.rebuildBoardsMenu(Base.java:1490)
        at processing.app.Base.<init>(Base.java:267)
        at processing.app.Base.main(Base.java:145)

To reproduce this problem, just edit ~/.arduino15/library_index.json (or similar location on Mac & Windows) and change the first character from '{' to '<'. Restart the IDE will give the NullPointerException.

This problem came today for a user on the forum.

https://forum.arduino.cc/index.php?topic=565681

@PaulStoffregen
Copy link
Contributor Author

PaulStoffregen commented Aug 27, 2018

Quick followup, I got 2 similar NPE start failures if the change the permissions on the file and the directory.

chmod 000 ~/.arduino15/library_index.json

Picked up JAVA_TOOL_OPTIONS: 
Invalid version found: 9bab0782d313679bb0bfb634e6e87c757b8d5503
Error parsing library.index:/home/paul/.arduino15/library_index.json (Permission denied)
java.lang.NullPointerException
    at cc.arduino.contributions.libraries.LibrariesIndexer.rescanLibraries(LibrariesIndexer.java:140)
    at cc.arduino.contributions.libraries.LibrariesIndexer.setLibrariesFolders(LibrariesIndexer.java:109)
    at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:715)
    at processing.app.Base.onBoardOrPortChange(Base.java:1313)
    at processing.app.Base$12.actionPerformed(Base.java:1540)
    at processing.app.Base.filterVisibilityOfSubsequentBoardMenus(Base.java:1579)
    at processing.app.Base.access$000(Base.java:83)
    at processing.app.Base$11.actionPerformed(Base.java:1512)
    at processing.app.Base.rebuildBoardsMenu(Base.java:1490)
    at processing.app.Base.<init>(Base.java:267)
    at processing.app.Base.main(Base.java:145)

chmod 000 ~/.arduino15/

Picked up JAVA_TOOL_OPTIONS: 
java.lang.NullPointerException
    at cc.arduino.contributions.packages.ContributionsIndexer.parseIndex(ContributionsIndexer.java:103)
    at processing.app.BaseNoGui.initPackages(BaseNoGui.java:504)
    at processing.app.Base.<init>(Base.java:262)
    at processing.app.Base.main(Base.java:145)

On this forum thread, a user reported a similar "java.io.IOException: The file or directory is corrupted and unreadable" error. I was trying to recreate this, but perhaps is requires Windows and unsafe media removal?

In any case, it seems the IDE startup fails with NPE in a variety of ways if library_index.json can't be accessed.

@facchinm facchinm added this to the Release 1.8.7 milestone Aug 28, 2018
cmaglie added a commit to cmaglie/Arduino that referenced this issue Sep 3, 2018
cmaglie added a commit to cmaglie/Arduino that referenced this issue Sep 3, 2018
cmaglie added a commit to cmaglie/Arduino that referenced this issue Sep 3, 2018
@cmaglie cmaglie closed this as completed in 6ed7934 Sep 6, 2018
cmaglie added a commit that referenced this issue Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants