Skip to content

Commit

Permalink
[GH-12] Fix exception caused by offline cause localization
Browse files Browse the repository at this point in the history
Use properties file to localize OfflineCause's description.
  • Loading branch information
Pavel Golikov committed Oct 6, 2020
1 parent 7dbcf45 commit c678974
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;

import org.jvnet.localizer.Localizable;
import org.jvnet.localizer.ResourceBundleHolder;

import hudson.Messages;
import hudson.model.Executor;
import hudson.model.Node;
import hudson.model.Queue;
Expand All @@ -18,11 +14,6 @@

public class VirtualMachineSlaveComputer extends SlaveComputer {

/**
* The resource bundle reference
*
*/
private final static ResourceBundleHolder holder = ResourceBundleHolder.get(Messages.class);
private AtomicBoolean isRevertingSnapshot = new AtomicBoolean(false);

public VirtualMachineSlaveComputer(Slave slave) {
Expand All @@ -34,8 +25,8 @@ public void tryReconnect() {
if(isRevertingSnapshot.get()) {
getListener().getLogger().println("INFO: trying to reconnect while snapshot revert - ignoring");
return;
}
}

super.tryReconnect();
}

Expand All @@ -53,7 +44,7 @@ public void taskAccepted(Executor executor, Queue.Task task) {
try {
isRevertingSnapshot.set(true);

final Future<?> disconnectFuture = disconnect(OfflineCause.create(new Localizable(holder, "Disconnect before snapshot revert")));
final Future<?> disconnectFuture = disconnect(OfflineCause.create(Messages._VirtualMachineSlaveComputer_disconnectBeforeSnapshotRevert()));
disconnectFuture.get();
getListener().getLogger().println("INFO: slave disconnected");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VirtualMachineSlaveComputer.disconnectBeforeSnapshotRevert=Disconnect before snapshot revert

0 comments on commit c678974

Please sign in to comment.