Skip to content

Commit e0d2066

Browse files
committed
Fix synchronization, PluginWrapper bug, and cleanup Javadoc
- Fix inconsistent synchronization in Fingerprint.java on 'usages' field by synchronizing on 'this'. - Fix logic bug in PluginWrapper.java where setOptionalDependants passed incorrect field instead of parameter. - Replace Boolean.getBoolean with SystemProperties.getBoolean in Jenkins.java and JnlpSlaveRestarterInstaller.java for best practices. - Update placeholder version numbers (@deprecated and @SInCE) in StreamTaskListener, StreamBuildListener, and JNLPLauncher. Signed-off-by: shbhmexe <shubhushukla586@gmail.com>
1 parent bde4fe7 commit e0d2066

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

core/src/main/java/hudson/PluginWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public void setOptionalDependents(@NonNull Set<String> optionalDependents) {
253253
*/
254254
@Deprecated
255255
public void setOptionalDependants(@NonNull Set<String> optionalDependents) {
256-
setOptionalDependents(dependents);
256+
setOptionalDependents(optionalDependents);
257257
}
258258

259259
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ protected Object readResolve() {
10361036
}
10371037

10381038
void addWithoutSaving(@NonNull String jobFullName, int n) {
1039-
synchronized (usages) { // TODO why not synchronized (this) like some, though not all, other accesses?
1039+
synchronized (this) {
10401040
RangeSet r = usages.get(jobFullName);
10411041
if (r == null) {
10421042
r = new RangeSet();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public StreamBuildListener(File out, Charset charset) throws IOException {
4848
}
4949

5050
/**
51-
* @deprecated as of TODO
51+
* @deprecated as of 2.328
5252
* The caller should use {@link #StreamBuildListener(OutputStream, Charset)} to pass in
5353
* the charset and output stream separately, so that this class can handle encoding correctly.
5454
*/

core/src/main/java/hudson/slaves/JNLPLauncher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public void launch(SlaveComputer computer, TaskListener listener) {
185185
}
186186

187187
/**
188-
* @deprecated as of 1.XXX
188+
* @deprecated as of 2.0
189189
* Use {@link Jenkins#getDescriptor(Class)}
190190
*/
191191
@Deprecated

core/src/main/java/hudson/util/StreamTaskListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public StreamTaskListener(@NonNull PrintStream out) {
7474
}
7575

7676
/**
77-
* @deprecated as of TODO
77+
* @deprecated as of 2.328
7878
* The caller should use {@link #StreamTaskListener(OutputStream, Charset)} to pass in
7979
* the charset and output stream separately, so that this class can handle encoding correctly,
8080
* or use {@link #fromStdout()} or {@link #fromStderr()}.
@@ -94,7 +94,7 @@ public StreamTaskListener(@NonNull OutputStream out, @CheckForNull Charset chars
9494
}
9595

9696
/**
97-
* @deprecated as of TODO
97+
* @deprecated as of 2.328
9898
* The caller should use {@link #StreamTaskListener(File, Charset)} to pass in
9999
* the charset and file separately, so that this class can handle encoding correctly.
100100
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5726,7 +5726,7 @@ private static void computeVersion(ServletContext context) {
57265726
@Restricted(NoExternalUse.class)
57275727
public boolean shouldShowStackTrace() {
57285728
// Used by oops.jelly
5729-
return Boolean.getBoolean(Jenkins.class.getName() + ".SHOW_STACK_TRACE");
5729+
return SystemProperties.getBoolean(Jenkins.class.getName() + ".SHOW_STACK_TRACE");
57305730
}
57315731

57325732
/**

core/src/main/java/jenkins/slaves/restarter/JnlpSlaveRestarterInstaller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.concurrent.Callable;
2222
import java.util.logging.Logger;
2323
import jenkins.security.MasterToSlaveCallable;
24+
import jenkins.util.SystemProperties;
2425

2526
/**
2627
* Actual agent restart logic.
@@ -36,7 +37,7 @@ public class JnlpSlaveRestarterInstaller extends ComputerListener implements Ser
3637
/**
3738
* To force installer to run on all agents, set this system property to true.
3839
*/
39-
private static final boolean FORCE_INSTALL = Boolean.getBoolean(JnlpSlaveRestarterInstaller.class.getName() + ".forceInstall");
40+
private static final boolean FORCE_INSTALL = SystemProperties.getBoolean(JnlpSlaveRestarterInstaller.class.getName() + ".forceInstall");
4041

4142
@SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification = "method signature does not permit plumbing through the return value")
4243
@Override

0 commit comments

Comments
 (0)