mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
Deprecate hudson.util.NullStream (#8128)
This commit is contained in:
1 parent
9be693daae
commit
ffd2afe45b
9 files changed
+25
-19
No files matched your search
@@ -33,7 +33,6 @@ import hudson.util.ClassLoaderSanityThreadFactory;
|
||||
import hudson.util.DaemonThreadFactory;
|
||||
import hudson.util.ExceptionCatchingThreadFactory;
|
||||
import hudson.util.NamingThreadFactory;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.ProcessTree;
|
||||
import hudson.util.StreamCopyThread;
|
||||
import java.io.File;
|
||||
@@ -429,7 +428,7 @@ public abstract class Proc {
|
||||
}
|
||||
|
||||
public static final InputStream SELFPUMP_INPUT = new NullInputStream(0);
|
||||
public static final OutputStream SELFPUMP_OUTPUT = new NullStream();
|
||||
public static final OutputStream SELFPUMP_OUTPUT = OutputStream.nullOutputStream();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,11 +34,11 @@ import hudson.tools.ToolInstallation;
|
||||
import hudson.tools.ToolInstaller;
|
||||
import hudson.tools.ToolProperty;
|
||||
import hudson.util.FormValidation;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import hudson.util.XStream2;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -164,7 +164,7 @@ public final class JDK extends ToolInstallation implements NodeSpecific<JDK>, En
|
||||
*/
|
||||
public static boolean isDefaultJDKValid(Node n) {
|
||||
try {
|
||||
TaskListener listener = new StreamTaskListener(new NullStream());
|
||||
TaskListener listener = new StreamTaskListener(OutputStream.nullOutputStream());
|
||||
Launcher launcher = n.createLauncher(listener);
|
||||
return launcher.launch().cmds("java", "-fullversion").stdout(listener).join() == 0;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
|
||||
@@ -56,7 +56,6 @@ import hudson.security.ACL;
|
||||
import hudson.security.ACLContext;
|
||||
import hudson.slaves.OfflineCause.ChannelTermination;
|
||||
import hudson.util.Futures;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.RingBufferLogHandler;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import hudson.util.VersionNumber;
|
||||
@@ -386,7 +385,7 @@ public class SlaveComputer extends Computer {
|
||||
return log;
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.SEVERE, "Failed to create log file " + getLogFile(), e);
|
||||
return new NullStream();
|
||||
return OutputStream.nullOutputStream();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ import hudson.tools.ToolInstaller;
|
||||
import hudson.tools.ToolProperty;
|
||||
import hudson.util.ArgumentListBuilder;
|
||||
import hudson.util.FormValidation;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import hudson.util.VariableResolver;
|
||||
import hudson.util.VariableResolver.ByMap;
|
||||
@@ -59,6 +58,7 @@ import hudson.util.VariableResolver.Union;
|
||||
import hudson.util.XStream2;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -665,7 +665,7 @@ public class Maven extends Builder {
|
||||
*/
|
||||
public boolean getExists() {
|
||||
try {
|
||||
return getExecutable(new LocalLauncher(new StreamTaskListener(new NullStream()))) != null;
|
||||
return getExecutable(new LocalLauncher(new StreamTaskListener(OutputStream.nullOutputStream()))) != null;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ public class IOUtils {
|
||||
* Drains the input stream and closes it.
|
||||
*/
|
||||
public static void drain(InputStream in) throws IOException {
|
||||
org.apache.commons.io.IOUtils.copy(in, new NullStream());
|
||||
in.close();
|
||||
try (in; OutputStream out = OutputStream.nullOutputStream()) {
|
||||
org.apache.commons.io.IOUtils.copy(in, out);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copy(File src, OutputStream out) throws IOException {
|
||||
|
||||
@@ -28,7 +28,9 @@ import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @deprecated use {@link OutputStream#nullOutputStream}
|
||||
*/
|
||||
@Deprecated
|
||||
public final class NullStream extends OutputStream {
|
||||
public NullStream() {}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class StreamTaskListener extends AbstractTaskListener implements TaskList
|
||||
*/
|
||||
@Deprecated
|
||||
public StreamTaskListener() throws IOException {
|
||||
this(new NullStream());
|
||||
this(OutputStream.nullOutputStream());
|
||||
}
|
||||
|
||||
public static StreamTaskListener fromStdout() {
|
||||
|
||||
Reference in new issue
Block a user