提交 39da96f6 编写于 作者: K kohsuke

made more robust even when the file doesn't exist:...

made more robust even when the file doesn't exist: http://www.nabble.com/stuck-on-InputStream-from-FilePath.read%28%29-td22053991.html

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15388 71c3de6d-444a-0410-be80-ed276b4c234a
上级 fa76ba0d
......@@ -761,11 +761,15 @@ public final class FilePath implements Serializable {
final Pipe p = Pipe.createRemoteToLocal();
channel.callAsync(new Callable<Void,IOException>() {
public Void call() throws IOException {
FileInputStream fis = new FileInputStream(new File(remote));
Util.copyStream(fis,p.getOut());
fis.close();
p.getOut().close();
return null;
FileInputStream fis=null;
try {
fis = new FileInputStream(new File(remote));
Util.copyStream(fis,p.getOut());
return null;
} finally {
IOUtils.closeQuietly(fis);
IOUtils.closeQuietly(p.getOut());
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册