提交 b807845b 编写于 作者: C Christoph Kutzinski

Added serialVersionUID to all Callables

上级 19b31687
...@@ -543,6 +543,7 @@ public final class FilePath implements Serializable { ...@@ -543,6 +543,7 @@ public final class FilePath implements Serializable {
*/ */
public FilePath absolutize() throws IOException, InterruptedException { public FilePath absolutize() throws IOException, InterruptedException {
return new FilePath(channel,act(new FileCallable<String>() { return new FilePath(channel,act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File f, VirtualChannel channel) throws IOException { public String invoke(File f, VirtualChannel channel) throws IOException {
return f.getAbsolutePath(); return f.getAbsolutePath();
} }
...@@ -560,6 +561,7 @@ public final class FilePath implements Serializable { ...@@ -560,6 +561,7 @@ public final class FilePath implements Serializable {
*/ */
public void symlinkTo(final String target, final TaskListener listener) throws IOException, InterruptedException { public void symlinkTo(final String target, final TaskListener listener) throws IOException, InterruptedException {
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
Util.createSymlink(f.getParentFile(),target,f.getName(),listener); Util.createSymlink(f.getParentFile(),target,f.getName(),listener);
return null; return null;
...@@ -576,6 +578,7 @@ public final class FilePath implements Serializable { ...@@ -576,6 +578,7 @@ public final class FilePath implements Serializable {
*/ */
public String readLink() throws IOException, InterruptedException { public String readLink() throws IOException, InterruptedException {
return act(new FileCallable<String>() { return act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
return Util.resolveSymlink(f); return Util.resolveSymlink(f);
} }
...@@ -884,6 +887,7 @@ public final class FilePath implements Serializable { ...@@ -884,6 +887,7 @@ public final class FilePath implements Serializable {
* @since 1.482 * @since 1.482
*/ */
public static abstract class AbstractInterceptorCallableWrapper<T> implements DelegatingCallable<T, IOException> { public static abstract class AbstractInterceptorCallableWrapper<T> implements DelegatingCallable<T, IOException> {
private static final long serialVersionUID = 1L;
private final DelegatingCallable<T, IOException> callable; private final DelegatingCallable<T, IOException> callable;
...@@ -960,6 +964,7 @@ public final class FilePath implements Serializable { ...@@ -960,6 +964,7 @@ public final class FilePath implements Serializable {
*/ */
public URI toURI() throws IOException, InterruptedException { public URI toURI() throws IOException, InterruptedException {
return act(new FileCallable<URI>() { return act(new FileCallable<URI>() {
private static final long serialVersionUID = 1L;
public URI invoke(File f, VirtualChannel channel) { public URI invoke(File f, VirtualChannel channel) {
return f.toURI(); return f.toURI();
} }
...@@ -971,6 +976,7 @@ public final class FilePath implements Serializable { ...@@ -971,6 +976,7 @@ public final class FilePath implements Serializable {
*/ */
public void mkdirs() throws IOException, InterruptedException { public void mkdirs() throws IOException, InterruptedException {
if(!act(new FileCallable<Boolean>() { if(!act(new FileCallable<Boolean>() {
private static final long serialVersionUID = 1L;
public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
if(f.mkdirs() || f.exists()) if(f.mkdirs() || f.exists())
return true; // OK return true; // OK
...@@ -989,6 +995,7 @@ public final class FilePath implements Serializable { ...@@ -989,6 +995,7 @@ public final class FilePath implements Serializable {
*/ */
public void deleteRecursive() throws IOException, InterruptedException { public void deleteRecursive() throws IOException, InterruptedException {
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.deleteRecursive(f); Util.deleteRecursive(f);
return null; return null;
...@@ -1001,6 +1008,7 @@ public final class FilePath implements Serializable { ...@@ -1001,6 +1008,7 @@ public final class FilePath implements Serializable {
*/ */
public void deleteContents() throws IOException, InterruptedException { public void deleteContents() throws IOException, InterruptedException {
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.deleteContentsRecursive(f); Util.deleteContentsRecursive(f);
return null; return null;
...@@ -1094,6 +1102,7 @@ public final class FilePath implements Serializable { ...@@ -1094,6 +1102,7 @@ public final class FilePath implements Serializable {
public FilePath createTempFile(final String prefix, final String suffix) throws IOException, InterruptedException { public FilePath createTempFile(final String prefix, final String suffix) throws IOException, InterruptedException {
try { try {
return new FilePath(this,act(new FileCallable<String>() { return new FilePath(this,act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File dir, VirtualChannel channel) throws IOException { public String invoke(File dir, VirtualChannel channel) throws IOException {
File f = File.createTempFile(prefix, suffix, dir); File f = File.createTempFile(prefix, suffix, dir);
return f.getName(); return f.getName();
...@@ -1149,6 +1158,7 @@ public final class FilePath implements Serializable { ...@@ -1149,6 +1158,7 @@ public final class FilePath implements Serializable {
public FilePath createTextTempFile(final String prefix, final String suffix, final String contents, final boolean inThisDirectory) throws IOException, InterruptedException { public FilePath createTextTempFile(final String prefix, final String suffix, final String contents, final boolean inThisDirectory) throws IOException, InterruptedException {
try { try {
return new FilePath(channel,act(new FileCallable<String>() { return new FilePath(channel,act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File dir, VirtualChannel channel) throws IOException { public String invoke(File dir, VirtualChannel channel) throws IOException {
if(!inThisDirectory) if(!inThisDirectory)
dir = new File(System.getProperty("java.io.tmpdir")); dir = new File(System.getProperty("java.io.tmpdir"));
...@@ -1191,6 +1201,7 @@ public final class FilePath implements Serializable { ...@@ -1191,6 +1201,7 @@ public final class FilePath implements Serializable {
public FilePath createTempDir(final String prefix, final String suffix) throws IOException, InterruptedException { public FilePath createTempDir(final String prefix, final String suffix) throws IOException, InterruptedException {
try { try {
return new FilePath(this,act(new FileCallable<String>() { return new FilePath(this,act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File dir, VirtualChannel channel) throws IOException { public String invoke(File dir, VirtualChannel channel) throws IOException {
File f = File.createTempFile(prefix, suffix, dir); File f = File.createTempFile(prefix, suffix, dir);
f.delete(); f.delete();
...@@ -1210,6 +1221,7 @@ public final class FilePath implements Serializable { ...@@ -1210,6 +1221,7 @@ public final class FilePath implements Serializable {
*/ */
public boolean delete() throws IOException, InterruptedException { public boolean delete() throws IOException, InterruptedException {
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.deleteFile(f); Util.deleteFile(f);
return null; return null;
...@@ -1223,6 +1235,7 @@ public final class FilePath implements Serializable { ...@@ -1223,6 +1235,7 @@ public final class FilePath implements Serializable {
*/ */
public boolean exists() throws IOException, InterruptedException { public boolean exists() throws IOException, InterruptedException {
return act(new FileCallable<Boolean>() { return act(new FileCallable<Boolean>() {
private static final long serialVersionUID = 1L;
public Boolean invoke(File f, VirtualChannel channel) throws IOException { public Boolean invoke(File f, VirtualChannel channel) throws IOException {
return f.exists(); return f.exists();
} }
...@@ -1238,6 +1251,7 @@ public final class FilePath implements Serializable { ...@@ -1238,6 +1251,7 @@ public final class FilePath implements Serializable {
*/ */
public long lastModified() throws IOException, InterruptedException { public long lastModified() throws IOException, InterruptedException {
return act(new FileCallable<Long>() { return act(new FileCallable<Long>() {
private static final long serialVersionUID = 1L;
public Long invoke(File f, VirtualChannel channel) throws IOException { public Long invoke(File f, VirtualChannel channel) throws IOException {
return f.lastModified(); return f.lastModified();
} }
...@@ -1289,6 +1303,7 @@ public final class FilePath implements Serializable { ...@@ -1289,6 +1303,7 @@ public final class FilePath implements Serializable {
*/ */
public boolean isDirectory() throws IOException, InterruptedException { public boolean isDirectory() throws IOException, InterruptedException {
return act(new FileCallable<Boolean>() { return act(new FileCallable<Boolean>() {
private static final long serialVersionUID = 1L;
public Boolean invoke(File f, VirtualChannel channel) throws IOException { public Boolean invoke(File f, VirtualChannel channel) throws IOException {
return f.isDirectory(); return f.isDirectory();
} }
...@@ -1302,6 +1317,7 @@ public final class FilePath implements Serializable { ...@@ -1302,6 +1317,7 @@ public final class FilePath implements Serializable {
*/ */
public long length() throws IOException, InterruptedException { public long length() throws IOException, InterruptedException {
return act(new FileCallable<Long>() { return act(new FileCallable<Long>() {
private static final long serialVersionUID = 1L;
public Long invoke(File f, VirtualChannel channel) throws IOException { public Long invoke(File f, VirtualChannel channel) throws IOException {
return f.length(); return f.length();
} }
...@@ -1326,6 +1342,7 @@ public final class FilePath implements Serializable { ...@@ -1326,6 +1342,7 @@ public final class FilePath implements Serializable {
public void chmod(final int mask) throws IOException, InterruptedException { public void chmod(final int mask) throws IOException, InterruptedException {
if(!isUnix() || mask==-1) return; if(!isUnix() || mask==-1) return;
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
_chmod(f, mask); _chmod(f, mask);
...@@ -1376,6 +1393,7 @@ public final class FilePath implements Serializable { ...@@ -1376,6 +1393,7 @@ public final class FilePath implements Serializable {
public int mode() throws IOException, InterruptedException, PosixException { public int mode() throws IOException, InterruptedException, PosixException {
if(!isUnix()) return -1; if(!isUnix()) return -1;
return act(new FileCallable<Integer>() { return act(new FileCallable<Integer>() {
private static final long serialVersionUID = 1L;
public Integer invoke(File f, VirtualChannel channel) throws IOException { public Integer invoke(File f, VirtualChannel channel) throws IOException {
return IOUtils.mode(f); return IOUtils.mode(f);
} }
...@@ -1422,6 +1440,7 @@ public final class FilePath implements Serializable { ...@@ -1422,6 +1440,7 @@ public final class FilePath implements Serializable {
throw new IllegalArgumentException("Non-serializable filter of " + filter.getClass()); throw new IllegalArgumentException("Non-serializable filter of " + filter.getClass());
} }
return act(new FileCallable<List<FilePath>>() { return act(new FileCallable<List<FilePath>>() {
private static final long serialVersionUID = 1L;
public List<FilePath> invoke(File f, VirtualChannel channel) throws IOException { public List<FilePath> invoke(File f, VirtualChannel channel) throws IOException {
File[] children = f.listFiles(filter); File[] children = f.listFiles(filter);
if(children ==null) return null; if(children ==null) return null;
...@@ -1474,6 +1493,7 @@ public final class FilePath implements Serializable { ...@@ -1474,6 +1493,7 @@ public final class FilePath implements Serializable {
*/ */
public FilePath[] list(final String includes, final String excludes, final boolean defaultExcludes) throws IOException, InterruptedException { public FilePath[] list(final String includes, final String excludes, final boolean defaultExcludes) throws IOException, InterruptedException {
return act(new FileCallable<FilePath[]>() { return act(new FileCallable<FilePath[]>() {
private static final long serialVersionUID = 1L;
public FilePath[] invoke(File f, VirtualChannel channel) throws IOException { public FilePath[] invoke(File f, VirtualChannel channel) throws IOException {
String[] files = glob(f, includes, excludes, defaultExcludes); String[] files = glob(f, includes, excludes, defaultExcludes);
...@@ -1511,6 +1531,7 @@ public final class FilePath implements Serializable { ...@@ -1511,6 +1531,7 @@ public final class FilePath implements Serializable {
final Pipe p = Pipe.createRemoteToLocal(); final Pipe p = Pipe.createRemoteToLocal();
channel.callAsync(new Callable<Void,IOException>() { channel.callAsync(new Callable<Void,IOException>() {
private static final long serialVersionUID = 1L;
public Void call() throws IOException { public Void call() throws IOException {
FileInputStream fis=null; FileInputStream fis=null;
try { try {
...@@ -1562,6 +1583,7 @@ public final class FilePath implements Serializable { ...@@ -1562,6 +1583,7 @@ public final class FilePath implements Serializable {
} }
return channel.call(new Callable<OutputStream,IOException>() { return channel.call(new Callable<OutputStream,IOException>() {
private static final long serialVersionUID = 1L;
public OutputStream call() throws IOException { public OutputStream call() throws IOException {
File f = new File(remote).getAbsoluteFile(); File f = new File(remote).getAbsoluteFile();
f.getParentFile().mkdirs(); f.getParentFile().mkdirs();
...@@ -1580,6 +1602,7 @@ public final class FilePath implements Serializable { ...@@ -1580,6 +1602,7 @@ public final class FilePath implements Serializable {
*/ */
public void write(final String content, final String encoding) throws IOException, InterruptedException { public void write(final String content, final String encoding) throws IOException, InterruptedException {
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
f.getParentFile().mkdirs(); f.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(f); FileOutputStream fos = new FileOutputStream(f);
...@@ -1599,6 +1622,7 @@ public final class FilePath implements Serializable { ...@@ -1599,6 +1622,7 @@ public final class FilePath implements Serializable {
*/ */
public String digest() throws IOException, InterruptedException { public String digest() throws IOException, InterruptedException {
return act(new FileCallable<String>() { return act(new FileCallable<String>() {
private static final long serialVersionUID = 1L;
public String invoke(File f, VirtualChannel channel) throws IOException { public String invoke(File f, VirtualChannel channel) throws IOException {
return Util.getDigestOf(new FileInputStream(f)); return Util.getDigestOf(new FileInputStream(f));
} }
...@@ -1614,6 +1638,7 @@ public final class FilePath implements Serializable { ...@@ -1614,6 +1638,7 @@ public final class FilePath implements Serializable {
throw new IOException("renameTo target must be on the same host"); throw new IOException("renameTo target must be on the same host");
} }
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
f.renameTo(new File(target.remote)); f.renameTo(new File(target.remote));
return null; return null;
...@@ -1631,6 +1656,7 @@ public final class FilePath implements Serializable { ...@@ -1631,6 +1656,7 @@ public final class FilePath implements Serializable {
throw new IOException("pullUpTo target must be on the same host"); throw new IOException("pullUpTo target must be on the same host");
} }
act(new FileCallable<Void>() { act(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
File t = new File(target.getRemote()); File t = new File(target.getRemote());
...@@ -1783,6 +1809,7 @@ public final class FilePath implements Serializable { ...@@ -1783,6 +1809,7 @@ public final class FilePath implements Serializable {
if(this.channel==target.channel) { if(this.channel==target.channel) {
// local to local copy. // local to local copy.
return act(new FileCallable<Integer>() { return act(new FileCallable<Integer>() {
private static final long serialVersionUID = 1L;
public Integer invoke(File base, VirtualChannel channel) throws IOException { public Integer invoke(File base, VirtualChannel channel) throws IOException {
if(!base.exists()) return 0; if(!base.exists()) return 0;
assert target.channel==null; assert target.channel==null;
...@@ -1825,6 +1852,7 @@ public final class FilePath implements Serializable { ...@@ -1825,6 +1852,7 @@ public final class FilePath implements Serializable {
final Pipe pipe = Pipe.createLocalToRemote(); final Pipe pipe = Pipe.createLocalToRemote();
Future<Void> future = target.actAsync(new FileCallable<Void>() { Future<Void> future = target.actAsync(new FileCallable<Void>() {
private static final long serialVersionUID = 1L;
public Void invoke(File f, VirtualChannel channel) throws IOException { public Void invoke(File f, VirtualChannel channel) throws IOException {
try { try {
readFromTar(remote+'/'+fileMask, f,TarCompression.GZIP.extract(pipe.getIn())); readFromTar(remote+'/'+fileMask, f,TarCompression.GZIP.extract(pipe.getIn()));
...@@ -1846,6 +1874,7 @@ public final class FilePath implements Serializable { ...@@ -1846,6 +1874,7 @@ public final class FilePath implements Serializable {
final Pipe pipe = Pipe.createRemoteToLocal(); final Pipe pipe = Pipe.createRemoteToLocal();
Future<Integer> future = actAsync(new FileCallable<Integer>() { Future<Integer> future = actAsync(new FileCallable<Integer>() {
private static final long serialVersionUID = 1L;
public Integer invoke(File f, VirtualChannel channel) throws IOException { public Integer invoke(File f, VirtualChannel channel) throws IOException {
try { try {
return writeToTar(f,fileMask,excludes,TarCompression.GZIP.compress(pipe.getOut())); return writeToTar(f,fileMask,excludes,TarCompression.GZIP.compress(pipe.getOut()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册