1
1
package io .jenkins .plugins .folderauth ;
2
2
3
3
import com .cloudbees .hudson .plugins .folder .AbstractFolder ;
4
+ import edu .umd .cs .findbugs .annotations .CheckForNull ;
5
+ import edu .umd .cs .findbugs .annotations .NonNull ;
4
6
import hudson .Extension ;
5
7
import hudson .model .AbstractItem ;
6
8
import hudson .model .Api ;
23
25
import io .jenkins .plugins .folderauth .roles .AgentRole ;
24
26
import io .jenkins .plugins .folderauth .roles .FolderRole ;
25
27
import io .jenkins .plugins .folderauth .roles .GlobalRole ;
26
- import jenkins .model .Jenkins ;
27
- import net .sf .json .JSONArray ;
28
- import org .kohsuke .accmod .Restricted ;
29
- import org .kohsuke .accmod .restrictions .NoExternalUse ;
30
- import org .kohsuke .stapler .QueryParameter ;
31
- import org .kohsuke .stapler .Stapler ;
32
- import org .kohsuke .stapler .export .ExportedBean ;
33
- import org .kohsuke .stapler .interceptor .RequirePOST ;
34
- import org .kohsuke .stapler .json .JsonBody ;
35
- import org .kohsuke .stapler .verb .GET ;
36
-
37
- import javax .annotation .CheckForNull ;
38
- import javax .annotation .Nonnull ;
39
- import javax .annotation .ParametersAreNonnullByDefault ;
40
- import javax .servlet .ServletException ;
28
+ import jakarta .servlet .ServletException ;
41
29
import java .io .IOException ;
42
30
import java .util .Arrays ;
43
31
import java .util .HashSet ;
48
36
import java .util .logging .Level ;
49
37
import java .util .logging .Logger ;
50
38
import java .util .stream .Collectors ;
39
+ import javax .annotation .ParametersAreNonnullByDefault ;
40
+ import jenkins .model .Jenkins ;
41
+ import net .sf .json .JSONArray ;
42
+ import org .kohsuke .accmod .Restricted ;
43
+ import org .kohsuke .accmod .restrictions .NoExternalUse ;
44
+ import org .kohsuke .stapler .QueryParameter ;
45
+ import org .kohsuke .stapler .Stapler ;
46
+ import org .kohsuke .stapler .export .ExportedBean ;
47
+ import org .kohsuke .stapler .interceptor .RequirePOST ;
48
+ import org .kohsuke .stapler .json .JsonBody ;
49
+ import org .kohsuke .stapler .verb .GET ;
51
50
52
51
@ Extension
53
52
@ ExportedBean
@@ -65,7 +64,7 @@ public String getIconFileName() {
65
64
/**
66
65
* {@inheritDoc}
67
66
*/
68
- @ Nonnull
67
+ @ NonNull
69
68
@ Override
70
69
public String getDescription () {
71
70
return Messages .FolderBasedAuthorizationStrategy_Description ();
@@ -96,7 +95,7 @@ public String getCategoryName() {
96
95
return "SECURITY" ;
97
96
}
98
97
99
- @ Nonnull
98
+ @ NonNull
100
99
@ Restricted (NoExternalUse .class )
101
100
@ SuppressWarnings ("unused" ) // used by index.jelly
102
101
public Set <Permission > getGlobalPermissions () {
@@ -105,7 +104,7 @@ public Set<Permission> getGlobalPermissions() {
105
104
return getSafePermissions (groups );
106
105
}
107
106
108
- @ Nonnull
107
+ @ NonNull
109
108
@ Restricted (NoExternalUse .class )
110
109
@ SuppressWarnings ("unused" ) // used by index.jelly
111
110
public Set <Permission > getFolderPermissions () {
@@ -116,7 +115,7 @@ public Set<Permission> getFolderPermissions() {
116
115
return getSafePermissions (groups );
117
116
}
118
117
119
- @ Nonnull
118
+ @ NonNull
120
119
@ Restricted (NoExternalUse .class )
121
120
@ SuppressWarnings ("unused" ) // used by index.jelly
122
121
public Set <Permission > getAgentPermissions () {
@@ -245,13 +244,13 @@ public void doAssignSidToAgentRole(@QueryParameter(required = true) String roleN
245
244
*/
246
245
private void redirect () {
247
246
try {
248
- Stapler .getCurrentResponse ().forwardToPreviousPage (Stapler .getCurrentRequest ());
247
+ Stapler .getCurrentResponse2 ().forwardToPreviousPage (Stapler .getCurrentRequest2 ());
249
248
} catch (ServletException | IOException e ) {
250
249
LOGGER .log (Level .WARNING , "Unable to redirect to previous page." );
251
250
}
252
251
}
253
252
254
- @ Nonnull
253
+ @ NonNull
255
254
@ Restricted (NoExternalUse .class )
256
255
@ SuppressWarnings ("unused" ) // used by index.jelly
257
256
public SortedSet <GlobalRole > getGlobalRoles () {
@@ -269,7 +268,7 @@ public SortedSet<GlobalRole> getGlobalRoles() {
269
268
* @return full names of all {@link AbstractFolder}s in the system
270
269
*/
271
270
@ GET
272
- @ Nonnull
271
+ @ NonNull
273
272
@ Restricted (NoExternalUse .class )
274
273
public JSONArray doGetAllFolders () {
275
274
Jenkins jenkins = Jenkins .get ();
@@ -288,7 +287,7 @@ public JSONArray doGetAllFolders() {
288
287
*
289
288
* @return all Computers in the system
290
289
*/
291
- @ Nonnull
290
+ @ NonNull
292
291
@ Restricted (NoExternalUse .class )
293
292
@ SuppressWarnings ("unused" ) // used by index.jelly
294
293
public List <Computer > getAllComputers () {
@@ -310,7 +309,7 @@ public List<Computer> getAllComputers() {
310
309
* @throws IllegalStateException when {@link Jenkins#getAuthorizationStrategy()} is
311
310
* not {@link FolderBasedAuthorizationStrategy}
312
311
*/
313
- @ Nonnull
312
+ @ NonNull
314
313
@ Restricted (NoExternalUse .class )
315
314
@ SuppressWarnings ("unused" ) // used by index.jelly
316
315
public SortedSet <FolderRole > getFolderRoles () {
@@ -322,7 +321,7 @@ public SortedSet<FolderRole> getFolderRoles() {
322
321
}
323
322
}
324
323
325
- @ Nonnull
324
+ @ NonNull
326
325
@ Restricted (NoExternalUse .class )
327
326
@ SuppressWarnings ("unused" ) // used by index.jelly
328
327
public SortedSet <AgentRole > getAgentRoles () {
@@ -383,7 +382,7 @@ public void doDeleteAgentRole(@QueryParameter(required = true) String roleName)
383
382
redirect ();
384
383
}
385
384
386
- @ Nonnull
385
+ @ NonNull
387
386
static Set <Permission > getSafePermissions (Set <PermissionGroup > groups ) {
388
387
TreeSet <Permission > safePermissions = new TreeSet <>(Permission .ID_COMPARATOR );
389
388
groups .stream ().map (PermissionGroup ::getPermissions ).forEach (safePermissions ::addAll );
0 commit comments