Skip to content

Commit d1c47f5

Browse files
style: allow underscores in catch parameter naming and use _ for unused exceptions
1 parent 05cf611 commit d1c47f5

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
179179
</module>
180180
<module name="CatchParameterName">
181-
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
181+
<property name="format" value="^(_|[a-z]([a-z0-9][a-zA-Z0-9]*)?)$"/>
182182
<message key="name.invalidPattern"
183183
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
184184
</module>

src/main/java/com/itasocialacademy/oitassist/logfile/dao/FileSystemLogFileDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Optional<Path> downloadFile(String fileName) {
6363
return Optional.empty();
6464
}
6565
return Optional.of(filePath);
66-
} catch (NoSuchFileException exception) {
66+
} catch (NoSuchFileException _) {
6767
log.debug("Log file not found for download: {}", fileName);
6868

6969
return Optional.empty();
@@ -86,7 +86,7 @@ private Path resolveDownloadPath(String fileName) {
8686
}
8787

8888
return filePath;
89-
} catch (InvalidPathException exception) {
89+
} catch (InvalidPathException _) {
9090
throw new InvalidLogFileNameException();
9191
}
9292
}

src/main/java/com/itasocialacademy/oitassist/logfile/service/LogFileServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private Resource createDownloadResource(Path filePath) {
122122
LinkOption.NOFOLLOW_LINKS);
123123

124124
return new InputStreamResource(inputStream, "Log file " + filePath.getFileName());
125-
} catch (NoSuchFileException exception) {
125+
} catch (NoSuchFileException _) {
126126
throw new LogFileNotFoundException(filePath.getFileName().toString());
127127
} catch (IOException | SecurityException exception) {
128128
log.error("Failed to open log file for download: {}", filePath, exception);

0 commit comments

Comments
 (0)