Fixed deprecated warnings without changing behaviour (#4177)

* fixed deprecated warnings without changing behaviour

* use Charset.defaultCharset() instead of null
This commit is contained in:
StefanSpieker authored and Oleg Nenashev committed 2019-09-13 09:45:34 +02:00
1 parent 8853687cde
commit 69a524ab0b
21 files changed
+59 -48

No files matched your search

+6 -5
View File
@@ -30,6 +30,7 @@ import hudson.util.ProcessTree;
import hudson.util.StreamTaskListener;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.nio.charset.Charset;
import jenkins.security.MasterToSlaveCallable;
import org.apache.commons.io.FileUtils;
@@ -65,7 +66,7 @@ public class LauncherTest {
assertTrue("Join did not finish promptly. The completion time (" + terminationTime + "ms) is longer than expected 15s", terminationTime < 15000);
channels.french.call(new NoopCallable()); // this only returns after the other side of the channel has finished executing cancellation
Thread.sleep(2000); // more delay to make sure it's gone
assertNull("process should be gone",ProcessTree.get().get(Integer.parseInt(FileUtils.readFileToString(tmp).trim())));
assertNull("process should be gone",ProcessTree.get().get(Integer.parseInt(FileUtils.readFileToString(tmp, Charset.defaultCharset()).trim())));
// Manual version of test: set up instance w/ one slave. Now in script console
// new hudson.FilePath(new java.io.File("/tmp")).createLauncher(new hudson.util.StreamTaskListener(System.err)).
@@ -101,10 +102,10 @@ public class LauncherTest {
TaskListener listener = new StreamBuildListener(output);
Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, FilePath.localChannel, false);
Launcher decorated = remoteLauncher.decorateByEnv(new EnvVars());
assertEquals(false, decorated.isUnix());
assertFalse(decorated.isUnix());
remoteLauncher = new Launcher.RemoteLauncher(listener, FilePath.localChannel, true);
decorated = remoteLauncher.decorateByEnv(new EnvVars());
assertEquals(true, decorated.isUnix());
assertTrue(decorated.isUnix());
}
@Issue("JENKINS-18368")
@@ -113,10 +114,10 @@ public class LauncherTest {
TaskListener listener = new StreamBuildListener(output);
Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, FilePath.localChannel, false);
Launcher decorated = remoteLauncher.decorateByPrefix("test");
assertEquals(false, decorated.isUnix());
assertFalse(decorated.isUnix());
remoteLauncher = new Launcher.RemoteLauncher(listener, FilePath.localChannel, true);
decorated = remoteLauncher.decorateByPrefix("test");
assertEquals(true, decorated.isUnix());
assertTrue(decorated.isUnix());
}
}