Skip to content

Commit 6825fc8

Browse files
authored
Merge branch 'master' into fully-nameable-model-object
2 parents cfcb729 + de9058e commit 6825fc8

File tree

25 files changed

+99
-164
lines changed

25 files changed

+99
-164
lines changed

.gitpod/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM gitpod/workspace-full:latest
22
ARG JAVA_VERSION=21.0.6-tem
3-
ARG MAVEN_VERSION=3.9.10
3+
ARG MAVEN_VERSION=3.9.11
44
# Install Java 21, Maven and GitHub CLI
55
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
66
sdk install java ${JAVA_VERSION} && \

ath.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o xtrace
66
cd "$(dirname "$0")"
77

88
# https://github.com/jenkinsci/acceptance-test-harness/releases
9-
export ATH_VERSION=6294.v8837063f315d
9+
export ATH_VERSION=6300.v12732144c83f
1010

1111
if [[ $# -eq 0 ]]; then
1212
export JDK=17

bom/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ THE SOFTWARE.
6363
<dependency>
6464
<groupId>org.springframework</groupId>
6565
<artifactId>spring-framework-bom</artifactId>
66-
<version>6.2.8</version>
66+
<version>6.2.9</version>
6767
<type>pom</type>
6868
<scope>import</scope>
6969
</dependency>
7070
<dependency>
7171
<!-- https://docs.spring.io/spring-security/reference/6.3/getting-spring-security.html#getting-maven-no-boot -->
7272
<groupId>org.springframework.security</groupId>
7373
<artifactId>spring-security-bom</artifactId>
74-
<version>6.5.1</version>
74+
<version>6.5.2</version>
7575
<type>pom</type>
7676
<scope>import</scope>
7777
</dependency>
@@ -119,7 +119,7 @@ THE SOFTWARE.
119119
<dependency>
120120
<groupId>commons-io</groupId>
121121
<artifactId>commons-io</artifactId>
122-
<version>2.19.0</version>
122+
<version>2.20.0</version>
123123
</dependency>
124124
<dependency>
125125
<groupId>commons-lang</groupId>

core/src/main/java/hudson/Functions.java

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import hudson.model.Describable;
4242
import hudson.model.Descriptor;
4343
import hudson.model.DescriptorVisibilityFilter;
44-
import hudson.model.Hudson;
4544
import hudson.model.Item;
4645
import hudson.model.ItemGroup;
4746
import hudson.model.Items;
@@ -97,11 +96,9 @@
9796
import hudson.views.MyViewsTabBar;
9897
import hudson.views.ViewsTabBar;
9998
import hudson.widgets.RenderOnDemandClosure;
100-
import io.jenkins.servlet.ServletExceptionWrapper;
10199
import io.jenkins.servlet.http.CookieWrapper;
102100
import io.jenkins.servlet.http.HttpServletRequestWrapper;
103101
import io.jenkins.servlet.http.HttpServletResponseWrapper;
104-
import jakarta.servlet.ServletException;
105102
import jakarta.servlet.http.Cookie;
106103
import jakarta.servlet.http.HttpServletRequest;
107104
import jakarta.servlet.http.HttpServletResponse;
@@ -190,8 +187,6 @@
190187
import org.kohsuke.stapler.Stapler;
191188
import org.kohsuke.stapler.StaplerRequest;
192189
import org.kohsuke.stapler.StaplerRequest2;
193-
import org.kohsuke.stapler.StaplerResponse;
194-
import org.kohsuke.stapler.StaplerResponse2;
195190
import org.springframework.security.access.AccessDeniedException;
196191

197192
/**
@@ -921,11 +916,11 @@ public static String htmlAttributeEscape(String text) {
921916
return buf.toString();
922917
}
923918

924-
public static void checkPermission(Permission permission) throws IOException, ServletException {
919+
public static void checkPermission(Permission permission) {
925920
checkPermission(Jenkins.get(), permission);
926921
}
927922

928-
public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
923+
public static void checkPermission(AccessControlled object, Permission permission) {
929924
if (permission != null) {
930925
object.checkPermission(permission);
931926
}
@@ -936,7 +931,7 @@ public static void checkPermission(AccessControlled object, Permission permissio
936931
* degrades gracefully if "it" is not an {@link AccessControlled} object.
937932
* Otherwise it will perform no check and that problem is hard to notice.
938933
*/
939-
public static void checkPermission(Object object, Permission permission) throws IOException, ServletException {
934+
public static void checkPermission(Object object, Permission permission) {
940935
if (permission == null)
941936
return;
942937

@@ -961,15 +956,15 @@ public static void checkPermission(Object object, Permission permission) throws
961956
* @param permission
962957
* If null, returns true. This defaulting is convenient in making the use of this method terse.
963958
*/
964-
public static boolean hasPermission(Permission permission) throws IOException, ServletException {
959+
public static boolean hasPermission(Permission permission) {
965960
return hasPermission(Jenkins.get(), permission);
966961
}
967962

968963
/**
969964
* This version is so that the 'hasPermission' can degrade gracefully
970965
* if "it" is not an {@link AccessControlled} object.
971966
*/
972-
public static boolean hasPermission(Object object, Permission permission) throws IOException, ServletException {
967+
public static boolean hasPermission(Object object, Permission permission) {
973968
if (permission == null)
974969
return true;
975970
if (object instanceof AccessControlled)
@@ -986,36 +981,6 @@ public static boolean hasPermission(Object object, Permission permission) throws
986981
}
987982
}
988983

989-
/**
990-
* @since 2.475
991-
*/
992-
public static void adminCheck(StaplerRequest2 req, StaplerResponse2 rsp, Object required, Permission permission) throws IOException, ServletException {
993-
// this is legacy --- all views should be eventually converted to
994-
// the permission based model.
995-
if (required != null && !Hudson.adminCheck(StaplerRequest.fromStaplerRequest2(req), StaplerResponse.fromStaplerResponse2(rsp))) {
996-
// check failed. commit the FORBIDDEN response, then abort.
997-
rsp.setStatus(HttpServletResponse.SC_FORBIDDEN);
998-
rsp.getOutputStream().close();
999-
throw new ServletException("Unauthorized access");
1000-
}
1001-
1002-
// make sure the user owns the necessary permission to access this page.
1003-
if (permission != null)
1004-
checkPermission(permission);
1005-
}
1006-
1007-
/**
1008-
* @deprecated use {@link #adminCheck(StaplerRequest2, StaplerResponse2, Object, Permission)}
1009-
*/
1010-
@Deprecated
1011-
public static void adminCheck(StaplerRequest req, StaplerResponse rsp, Object required, Permission permission) throws IOException, javax.servlet.ServletException {
1012-
try {
1013-
adminCheck(StaplerRequest.toStaplerRequest2(req), StaplerResponse.toStaplerResponse2(rsp), required, permission);
1014-
} catch (ServletException e) {
1015-
throw ServletExceptionWrapper.fromJakartaServletException(e);
1016-
}
1017-
}
1018-
1019984
/**
1020985
* Infers the hudson installation URL from the given request.
1021986
*
@@ -1298,7 +1263,7 @@ public static boolean hasAnyPermission(AccessControlled ac, Permission[] permiss
12981263
*
12991264
* @since 2.238
13001265
*/
1301-
public static boolean hasAnyPermission(Object object, Permission[] permissions) throws IOException, ServletException {
1266+
public static boolean hasAnyPermission(Object object, Permission[] permissions) {
13021267
if (permissions == null || permissions.length == 0) {
13031268
return true;
13041269
}
@@ -1336,7 +1301,7 @@ public static void checkAnyPermission(AccessControlled ac, Permission[] permissi
13361301
* degrades gracefully if "it" is not an {@link AccessControlled} object.
13371302
* Otherwise it will perform no check and that problem is hard to notice.
13381303
*/
1339-
public static void checkAnyPermission(Object object, Permission[] permissions) throws IOException, ServletException {
1304+
public static void checkAnyPermission(Object object, Permission[] permissions) {
13401305
if (permissions == null || permissions.length == 0) {
13411306
return;
13421307
}
@@ -2099,7 +2064,7 @@ public boolean hyperlinkMatchesCurrentPage(String href) {
20992064
}
21002065

21012066
/**
2102-
* If the given {@code Action} is a {@link RootAction#isPrimaryAction() primary} {code RootAction}, or a parent of the current page, return {@code true}.
2067+
* If the given {@code Action} is a {@link RootAction#isPrimaryAction() primary} {@code RootAction}, or a parent of the current page, return {@code true}.
21032068
* Used in {@code actions.jelly} to decide if the action should shown in the main header or the hamburger.
21042069
*/
21052070
@Restricted(NoExternalUse.class)

core/src/main/java/hudson/model/Hudson.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import io.jenkins.servlet.ServletExceptionWrapper;
4343
import jakarta.servlet.ServletContext;
4444
import jakarta.servlet.ServletException;
45-
import jakarta.servlet.http.HttpServletResponse;
4645
import java.io.File;
4746
import java.io.IOException;
4847
import java.text.NumberFormat;
@@ -51,7 +50,6 @@
5150
import jenkins.model.Jenkins;
5251
import org.jvnet.hudson.reactor.ReactorException;
5352
import org.kohsuke.stapler.QueryParameter;
54-
import org.kohsuke.stapler.Stapler;
5553
import org.kohsuke.stapler.StaplerRequest;
5654
import org.kohsuke.stapler.StaplerResponse;
5755
import org.kohsuke.stapler.interceptor.RequirePOST;
@@ -293,27 +291,6 @@ public static boolean isDarwin() {
293291
return Platform.isDarwin();
294292
}
295293

296-
/**
297-
* @deprecated since 2007-12-18.
298-
* Use {@link #checkPermission(hudson.security.Permission)}
299-
*/
300-
@Deprecated
301-
public static boolean adminCheck() throws IOException {
302-
return adminCheck(Stapler.getCurrentRequest(), Stapler.getCurrentResponse());
303-
}
304-
305-
/**
306-
* @deprecated since 2007-12-18.
307-
* Use {@link #checkPermission(hudson.security.Permission)}
308-
*/
309-
@Deprecated
310-
public static boolean adminCheck(StaplerRequest req, StaplerResponse rsp) throws IOException {
311-
if (isAdmin(req)) return true;
312-
313-
rsp.sendError(HttpServletResponse.SC_FORBIDDEN);
314-
return false;
315-
}
316-
317294
/**
318295
* Checks if the current user (for which we are processing the current request)
319296
* has the admin access.

core/src/main/java/hudson/model/Slave.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import edu.umd.cs.findbugs.annotations.CheckForNull;
2929
import edu.umd.cs.findbugs.annotations.NonNull;
30+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3031
import hudson.DescriptorExtensionList;
3132
import hudson.EnvVars;
3233
import hudson.FilePath;
@@ -102,6 +103,7 @@
102103
*
103104
* @author Kohsuke Kawaguchi
104105
*/
106+
@SuppressFBWarnings(value = "DESERIALIZATION_GADGET", justification = "unhappy about existence of readResolve?")
105107
public abstract class Slave extends Node implements Serializable {
106108

107109
private static final Logger LOGGER = Logger.getLogger(Slave.class.getName());
@@ -381,7 +383,9 @@ private void _setLabelString(String labelString) {
381383
@Override
382384
protected Set<LabelAtom> getLabelAtomSet() {
383385
if (labelAtomSet == null) {
384-
warnPlugin();
386+
if (!insideReadResolve.get()) {
387+
warnPlugin();
388+
}
385389
this.labelAtomSet = Collections.unmodifiableSet(Label.parse(label));
386390
}
387391
return labelAtomSet;
@@ -627,14 +631,21 @@ public int hashCode() {
627631
return name.hashCode();
628632
}
629633

634+
private static final ThreadLocal<Boolean> insideReadResolve = ThreadLocal.withInitial(() -> false);
635+
630636
/**
631637
* Invoked by XStream when this object is read into memory.
632638
*/
633639
protected Object readResolve() {
634640
if (nodeProperties == null)
635641
nodeProperties = new DescribableList<>(this);
636642
previouslyAssignedLabels = new HashSet<>();
637-
_setLabelString(label);
643+
insideReadResolve.set(true);
644+
try {
645+
_setLabelString(label);
646+
} finally {
647+
insideReadResolve.set(false);
648+
}
638649
return this;
639650
}
640651

core/src/main/java/jenkins/console/ConsoleUrlProviderUserProperty.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
package jenkins.console;
2626

2727
import edu.umd.cs.findbugs.annotations.CheckForNull;
28+
import edu.umd.cs.findbugs.annotations.NonNull;
2829
import hudson.Extension;
2930
import hudson.model.User;
3031
import hudson.model.UserProperty;
3132
import hudson.model.UserPropertyDescriptor;
33+
import hudson.model.userproperty.UserPropertyCategory;
3234
import java.util.List;
3335
import org.jenkinsci.Symbol;
3436
import org.kohsuke.accmod.Restricted;
@@ -70,6 +72,11 @@ public String getDescription() {
7072
return Messages.consoleUrlProviderDisplayName_Description();
7173
}
7274

75+
@Override
76+
public @NonNull UserPropertyCategory getUserPropertyCategory() {
77+
return UserPropertyCategory.get(UserPropertyCategory.Appearance.class);
78+
}
79+
7380
@Override
7481
public UserProperty newInstance(User user) {
7582
return new ConsoleUrlProviderUserProperty();

core/src/main/java/jenkins/model/Jenkins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,7 @@ public <T> ExtensionList<T> getExtensionList(Class<T> extensionType) {
28372837
* For URL access to descriptors, see {@link hudson.model.DescriptorByNameOwner}.
28382838
* For URL access to specific other {@link hudson.Extension} annotated elements, create your own {@link hudson.model.Action}, like {@link hudson.console.ConsoleAnnotatorFactory.RootAction}.
28392839
*/
2840-
@Deprecated(since = "TODO")
2840+
@Deprecated(since = "2.519")
28412841
public ExtensionList getExtensionList(String extensionType) throws ClassNotFoundException {
28422842
return getExtensionList(pluginManager.uberClassLoader.loadClass(extensionType));
28432843
}

core/src/main/resources/hudson/model/userproperty/UserPropertyCategoryAppearanceAction/index.jelly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ THE SOFTWARE.
3030
<l:layout permission="${app.ADMINISTER}" title="${%title}">
3131
<st:include page="sidepanel.jelly" it="${it.targetUser}" />
3232
<l:main-panel>
33-
<f:form method="post" action="configSubmit" name="config">
33+
<f:form method="post" action="configSubmit" name="config" class="jenkins-form">
3434
<h1>
3535
${%title}
3636
</h1>
@@ -44,7 +44,7 @@ THE SOFTWARE.
4444
<j:when test="${hasItems}">
4545
<j:forEach var="d" items="${descriptors}" varStatus="loop">
4646
<j:if test="${d.enabled}">
47-
<f:section title="${d.displayName}">
47+
<f:section title="${d.displayName}" description="${d.description}">
4848
<j:set var="it" value="${thisAction.targetUser}" />
4949
<j:set var="descriptor" value="${d}" />
5050
<j:set var="instance" value="${instances[d]}" />
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<?jelly escape-by-default='true'?>
22
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
33
<j:if test="${descriptor.enabled}">
4-
<f:section title="${%Console URL Provider}">
5-
<f:block>
6-
${%description}
7-
</f:block>
8-
<f:entry>
9-
<f:repeatableHeteroProperty field="providers" hasHeader="true" oneEach="true" header="${%Providers}" />
10-
</f:entry>
4+
<f:section title="${%Console URL Provider}" description="${%description}">
5+
<f:repeatableHeteroProperty field="providers" hasHeader="true" oneEach="true" header="${%Providers}" />
116
</f:section>
127
</j:if>
138
</j:jelly>

0 commit comments

Comments
 (0)