apache / apache/lucene

Null exception occured when click on Luke desktop browser button

Open
#13,345 1 comment 0 reactions 0 assignees View on GitHub
module:luke type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

When I have set my share folder (luncene data) on window,I found that Luke desktop's path browser button occurd null exception.
like path \\xxx.xxx.xx.xx\trace . Finally I debug the source code and repair this bug as follow:
java file:OpenIndexDialogFactory.java
function:getLastOpenedDirectory

error:path.getParent()

repair:
```
private File getLastOpenedDirectory() {
List history = prefs.getHistory();
if (!history.isEmpty()) {
Path path = Paths.get(history.get(0));
if (Files.exists(path)) {
if(path.getParent() != null) {
return path.getParent().toAbsolutePath().toFile();
}else {
return path.toAbsolutePath().toFile();
}
}
}
return null;
}
```

### Version and environment details

Luncene 8.11.2 and I have check the newest version code has the same problem.

Contributor guide

Open the contributing guide

Research direction

Open OpenIndexDialogFactory.java and inspect getLastOpenedDirectory, especially the path.getParent() handling for the reported network share path. Reproduce the Luke desktop browser-button flow with a path like \\xxx.xxx.xx.xx\trace, then run the relevant Luke tests if available. Done means the button no longer raises a null exception and still returns a usable directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.