Skip to content

Commit 6ba42fa

Browse files
LakshyaBaganiclaude
andcommitted
Address PR review feedback: fix whitespace, add Javadoc, update copyright year
- Revert whitespace-only changes in AbstractCIBase.java - Add complete Javadoc for new public API methods (isSnoozed, snooze, doSnooze, getSnoozedAdministrativeMonitors, setSnoozedAdministrativeMonitors) - Remove extraneous blank line in getRequiredPermission Javadoc - Update copyright year from 2025 to 2026 in snooze.js and snoozeForm.properties Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 428527e commit 6ba42fa

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public String getNodeName() {
6868
return "";
6969
}
7070

71-
/**
71+
/**
7272
* @deprecated
7373
* Why are you calling a method that always returns ""?
7474
* You probably want to call {@link Jenkins#getRootUrl()}
@@ -122,6 +122,9 @@ public void setDisabledAdministrativeMonitors(Set<String> disabledAdministrative
122122
private final Map<String, Long> snoozedAdministrativeMonitors = new HashMap<>();
123123

124124
/**
125+
* Get the snoozed administrative monitors and their expiry times.
126+
*
127+
* @return a copy of the snoozed administrative monitors map, where keys are monitor IDs and values are expiry timestamps in milliseconds
125128
* @since TODO
126129
*/
127130
public Map<String, Long> getSnoozedAdministrativeMonitors() {
@@ -131,6 +134,9 @@ public Map<String, Long> getSnoozedAdministrativeMonitors() {
131134
}
132135

133136
/**
137+
* Set the snoozed administrative monitors and their expiry times.
138+
*
139+
* @param snoozedAdministrativeMonitors the map of monitor IDs to expiry timestamps in milliseconds
134140
* @since TODO
135141
*/
136142
public void setSnoozedAdministrativeMonitors(Map<String, Long> snoozedAdministrativeMonitors) {
@@ -144,7 +150,7 @@ public void setSnoozedAdministrativeMonitors(Map<String, Long> snoozedAdministra
144150
* Implementation provided
145151
* ============================================================================================================== */
146152

147-
/**
153+
/**
148154
* Returns all {@link Node}s in the system, excluding {@link jenkins.model.Jenkins} instance itself which
149155
* represents the built-in node in this context.
150156
*/

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ public boolean isEnabled() {
157157
}
158158

159159
/**
160+
* Returns true if this monitor is currently snoozed.
161+
*
162+
* <p>
163+
* A snoozed monitor is temporarily hidden from the management page
164+
* until the snooze duration expires. Expired snooze entries are
165+
* automatically cleaned up when checked.
166+
* </p>
167+
*
168+
* @return true if this monitor is snoozed and the snooze has not yet expired
160169
* @since TODO
161170
*/
162171
public boolean isSnoozed() {
@@ -184,6 +193,11 @@ public boolean isSnoozed() {
184193
}
185194

186195
/**
196+
* Snooze this monitor for the specified duration, temporarily hiding it from the management page.
197+
*
198+
* @param durationMs the snooze duration in milliseconds, must be positive and at most 1 year
199+
* @throws IOException if persisting the snooze state fails
200+
* @throws IllegalArgumentException if the duration is not positive or exceeds 1 year
187201
* @since TODO
188202
*/
189203
public void snooze(long durationMs) throws IOException {
@@ -238,6 +252,16 @@ public void doDisable(StaplerRequest2 req, StaplerResponse2 rsp) throws IOExcept
238252
}
239253

240254
/**
255+
* URL binding to snooze this monitor for a chosen duration.
256+
*
257+
* <p>
258+
* Accepts a {@code durationPreset} parameter specifying preset minutes, or {@code "custom"}
259+
* with a {@code snoozeUntil} date in {@code yyyy-MM-dd} format. Requires {@link Jenkins#ADMINISTER} permission.
260+
* </p>
261+
*
262+
* @param req the request containing snooze duration parameters
263+
* @param rsp the response
264+
* @throws IOException if persisting the snooze state fails
241265
* @since TODO
242266
*/
243267
@RequirePOST
@@ -312,7 +336,6 @@ public void doSnooze(StaplerRequest2 req, StaplerResponse2 rsp) throws IOExcepti
312336
* Form UI elements that change system state, e.g. toggling a feature on or off, need to be hidden from users
313337
* lacking Administer permission.
314338
* </p>
315-
*
316339
* @since 2.233
317340
* @deprecated Callers should use {@link #checkRequiredPermission()} or {@link #hasRequiredPermission()}.
318341
*/

core/src/main/resources/lib/hudson/snooze.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* The MIT License
33
*
4-
* Copyright (c) 2025 Jenkins Contributors
4+
* Copyright (c) 2026 Jenkins Contributors
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal

core/src/main/resources/lib/hudson/snoozeForm.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The MIT License
22
#
3-
# Copyright (c) 2025 Jenkins Contributors
3+
# Copyright (c) 2026 Jenkins Contributors
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)