Browse Source

bring back early exit that was there before Java8 refactoring

master
Stefan Bodewig 7 years ago
parent
commit
0a3b2c002b
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      src/main/org/apache/tools/ant/util/ScriptRunnerBase.java

+ 3
- 0
src/main/org/apache/tools/ant/util/ScriptRunnerBase.java View File

@@ -222,6 +222,9 @@ public abstract class ScriptRunnerBase {
*/ */
public void setSrc(File file) { public void setSrc(File file) {
String filename = file.getPath(); String filename = file.getPath();
if (!file.exists()) {
throw new BuildException("file " + filename + " not found.");
}


try (InputStream in = Files.newInputStream(file.toPath())) { try (InputStream in = Files.newInputStream(file.toPath())) {
final Charset charset = null == encoding ? Charset.defaultCharset() final Charset charset = null == encoding ? Charset.defaultCharset()


Loading…
Cancel
Save