apache / apache/lucene

SimpleFSLockFactory should catch+box IOException (not FileAlreadyExistsException | AccessDeniedException) [LUCENE-7961]

Open
#9,010 4 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

SimpleFSLockFactory will only convert `FileAlreadyExistsException | AccessDeniedException` from Files.createFile() into LockObtainFailedException. Neither of these are guaranteed from the API, only `IOException`.

I think SimpleFSLockFactory should box any IOException from Files.createFile() into a LockObtainFailedException instead of just these two optional ones. It is simpler and more consistent behavior, even if its just theoretical problem for some FileSystem impl that doesn't throw these.

---
Migrated from [LUCENE-7961](https://issues.apache.org/jira/browse/LUCENE-7961) by Robert Muir (@rmuir), 1 vote, updated Sep 09 2017
Attachments: [LUCENE-7961.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7961/LUCENE-7961.patch) (versions: 2)

Contributor guide

Open the contributing guide

Research direction

Locate SimpleFSLockFactory and inspect the Files.createFile() call and its current exception handling. Change the behavior so any IOException from that call is boxed into LockObtainFailedException, then verify the relevant lock tests and exception behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.