diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index ada188f94b22e95b8f832a12031e33e9816ea147..19a36843775f116da26cef6bb846cae0644ccf24 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1261,11 +1261,15 @@ public final class FilePath implements Serializable { * Copies this file to the specified target. */ public void copyTo(FilePath target) throws IOException, InterruptedException { - OutputStream out = target.write(); try { - copyTo(out); - } finally { - out.close(); + OutputStream out = target.write(); + try { + copyTo(out); + } finally { + out.close(); + } + } catch (IOException e) { + throw new IOException2("Failed to copy "+this+" to "+target,e); } }