apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.62k stars 840 forks source link

Clean old temporary local maven index cache dir before scan #7586

Closed mbien closed 1 month ago

mbien commented 1 month ago

When the last local maven repo scan didn't clean up properly, for example when the JVM exits during scan, subsequent scans would throw java.io.IOException: Cannot create temporary directory.

This has a fairly low probability since local index scans finish fast - saw this during debugging.

exception:

java.io.IOException: Cannot create temporary directory: /home/mbien/NetBeansProjects/netbeans/nbbuild/testuserdir/var/cache/tmp-local
    at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.scan(NexusRepositoryIndexerImpl.java:813)
    at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.indexLoadedRepo(NexusRepositoryIndexerImpl.java:616)
[catch] at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.lambda$spawnIndexLoadedRepo$8(NexusRepositoryIndexerImpl.java:714)
    at org.netbeans.modules.openide.util.DefaultMutexImplementation.writeAccess(DefaultMutexImplementation.java:229)
    at org.openide.util.Mutex.writeAccess(Mutex.java:253)
    at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.lambda$spawnIndexLoadedRepo$9(NexusRepositoryIndexerImpl.java:707)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

how to simulate: create a tmp-local folder in your fresh cache folder, trigger initial local repo indexing, e.g by adding a dependency to a maven project.