File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
src/main/java/io/jenkins/plugins/util Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 6
6
import java .util .Set ;
7
7
import java .util .stream .Collectors ;
8
8
9
- import org .acegisecurity .AccessDeniedException ;
10
9
import org .apache .commons .lang3 .StringUtils ;
11
10
12
11
import org .kohsuke .stapler .Stapler ;
@@ -91,8 +90,12 @@ public boolean hasPermission(final Permission permission) {
91
90
try {
92
91
return Optional .ofNullable (getJenkins ().getItemByFullName (name , Job .class ));
93
92
}
94
- catch (AccessDeniedException ignore ) {
95
- return Optional .empty ();
93
+ catch (RuntimeException x ) { // TODO switch to simple catch (AccessDeniedException) when baseline includes Spring Security
94
+ if (x .getClass ().getSimpleName ().startsWith ("AccessDeniedException" )) {
95
+ return Optional .empty ();
96
+ } else {
97
+ throw x ;
98
+ }
96
99
}
97
100
}
98
101
@@ -108,10 +111,13 @@ public boolean hasPermission(final Permission permission) {
108
111
try {
109
112
return Optional .ofNullable (Run .fromExternalizableId (id ));
110
113
}
111
- catch (AccessDeniedException ignore ) {
112
- // ignore
114
+ catch (RuntimeException x ) { // TODO switch to simple catch (AccessDeniedException) when baseline includes Spring Security
115
+ if (x .getClass ().getSimpleName ().startsWith ("AccessDeniedException" )) {
116
+ return Optional .empty ();
117
+ } else {
118
+ throw x ;
119
+ }
113
120
}
114
- return Optional .empty ();
115
121
}
116
122
117
123
/**
You can’t perform that action at this time.
0 commit comments