Skip to content

Commit

Permalink
[FIXED JENKINS-15869] When running on Java 5, must still load DiskSpa…
Browse files Browse the repository at this point in the history
…ceMonitor/TemporarySpaceMonitor, even though they will show N/A.

Returning null from an @extension method does not seem to work reliably, and is not supported by SezPoz.
If desirable to hide a monitor column in $server/computer/, add a boolean isEnabled() method interpretable in Jelly.
  • Loading branch information
jglick committed Nov 19, 2012
1 parent c60c1fe commit 8ad62f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -61,6 +61,9 @@
<li class=bug>
Build records were broken if timezone was changed while running.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15816">issue 15816</a>)
<li class='major bug'>
Linkage errors trying to run Jenkins on Java 5.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15869">issue 15869</a>)
<li class=bug>
Symlink detection refinement on Java 7.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13202">issue 13202</a>)
Expand Down
8 changes: 2 additions & 6 deletions core/src/main/java/hudson/node_monitors/DiskSpaceMonitor.java
Expand Up @@ -59,9 +59,10 @@ public String getColumnCaption() {
return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? super.getColumnCaption() : null;
}

@Extension
public static final DiskSpaceMonitorDescriptor DESCRIPTOR = new DiskSpaceMonitorDescriptor() {
public String getDisplayName() {
return Messages.DiskSpaceMonitor_DisplayName();
return Functions.isMustangOrAbove() ? Messages.DiskSpaceMonitor_DisplayName() : Messages.DiskSpaceMonitor_DisplayName5();
}

protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedException {
Expand All @@ -72,9 +73,4 @@ protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedExce
}
};

@Extension
public static DiskSpaceMonitorDescriptor install() {
if(Functions.isMustangOrAbove()) return DESCRIPTOR;
return null;
}
}
Expand Up @@ -61,9 +61,10 @@ public String getColumnCaption() {
return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? super.getColumnCaption() : null;
}

@Extension
public static final DiskSpaceMonitorDescriptor DESCRIPTOR = new DiskSpaceMonitorDescriptor() {
public String getDisplayName() {
return Messages.TemporarySpaceMonitor_DisplayName();
return Functions.isMustangOrAbove() ? Messages.TemporarySpaceMonitor_DisplayName() : Messages.TemporarySpaceMonitor_DisplayName5();
}

protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedException {
Expand All @@ -74,12 +75,6 @@ protected DiskSpace getFreeSpace(Computer c) throws IOException, InterruptedExce
}
};

@Extension
public static DiskSpaceMonitorDescriptor install() {
if(Functions.isMustangOrAbove()) return DESCRIPTOR;
return null;
}

protected static final class GetTempSpace implements FileCallable<DiskSpace> {
@IgnoreJRERequirement
public DiskSpace invoke(File f, VirtualChannel channel) throws IOException {
Expand Down
Expand Up @@ -25,8 +25,10 @@ ClockMonitor.DisplayName=Clock Difference
DiskSpaceMonitor.MarkedOffline=Making {0} offline temporarily due to the lack of disk space
DiskSpaceMonitor.MarkedOnline=Putting {0} back online as there is enough disk space again
DiskSpaceMonitor.DisplayName=Free Disk Space
DiskSpaceMonitor.DisplayName5=Free Disk Space (Java 6+)
ResponseTimeMonitor.DisplayName=Response Time
ResponseTimeMonitor.MarkedOffline=Making {0} offline because it''s not responding
ResponseTimeMonitor.TimeOut=Time out for last {0} try
SwapSpaceMonitor.DisplayName=Free Swap Space
TemporarySpaceMonitor.DisplayName=Free Temp Space
TemporarySpaceMonitor.DisplayName=Free Temp Space
TemporarySpaceMonitor.DisplayName5=Free Temp Space (Java 6+)

0 comments on commit 8ad62f7

Please sign in to comment.