Skip to content

Commit 086e1a2

Browse files
committed
Add warnings suppression.
1 parent 16b32bc commit 086e1a2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/io/jenkins/plugins/util/JenkinsFacade.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,16 @@ public boolean hasPermission(final Permission permission) {
8585
*
8686
* @return the selected job, if it exists under the given full name and if it is accessible
8787
*/
88-
@SuppressWarnings("unchecked")
88+
@SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
8989
public Optional<Job<?, ?>> getJob(final String name) {
9090
try {
9191
return Optional.ofNullable(getJenkins().getItemByFullName(name, Job.class));
9292
}
9393
catch (RuntimeException x) { // TODO switch to simple catch (AccessDeniedException) when baseline includes Spring Security
9494
if (x.getClass().getSimpleName().startsWith("AccessDeniedException")) {
9595
return Optional.empty();
96-
} else {
96+
}
97+
else {
9798
throw x;
9899
}
99100
}
@@ -107,14 +108,16 @@ public boolean hasPermission(final Permission permission) {
107108
*
108109
* @return the selected build, if it exists with the given ID and if it is accessible
109110
*/
111+
@SuppressWarnings("checkstyle:IllegalCatch")
110112
public Optional<Run<?, ?>> getBuild(final String id) {
111113
try {
112114
return Optional.ofNullable(Run.fromExternalizableId(id));
113115
}
114116
catch (RuntimeException x) { // TODO switch to simple catch (AccessDeniedException) when baseline includes Spring Security
115117
if (x.getClass().getSimpleName().startsWith("AccessDeniedException")) {
116118
return Optional.empty();
117-
} else {
119+
}
120+
else {
118121
throw x;
119122
}
120123
}

0 commit comments

Comments
 (0)