Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 7 years ago
parent
commit
4ecd6bf90b
3 changed files with 10 additions and 0 deletions
  1. +4
    -0
      WHATSNEW
  2. +3
    -0
      src/main/org/apache/tools/ant/input/DefaultInputHandler.java
  3. +3
    -0
      src/main/org/apache/tools/ant/input/SecureInputHandler.java

+ 4
- 0
WHATSNEW View File

@@ -37,6 +37,10 @@ Fixed bugs:
Java bytecode version 53 now. Java bytecode version 53 now.
Bug reported by Simon IJskes https://issues.apache.org/jira/browse/NETBEANS-781 Bug reported by Simon IJskes https://issues.apache.org/jira/browse/NETBEANS-781


* Default and SecureInputHandler will now raise an error when then
end of the inout stream (usually System.in or System.console) are
reached before a valid input has been read.

Other changes: Other changes:
-------------- --------------




+ 3
- 0
src/main/org/apache/tools/ant/input/DefaultInputHandler.java View File

@@ -56,6 +56,9 @@ public class DefaultInputHandler implements InputHandler {
System.err.flush(); System.err.flush();
try { try {
String input = r.readLine(); String input = r.readLine();
if (input == null) {
throw new BuildException("unexpected end of stream while reading input");
}
request.setInput(input); request.setInput(input);
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("Failed to read input from" throw new BuildException("Failed to read input from"


+ 3
- 0
src/main/org/apache/tools/ant/input/SecureInputHandler.java View File

@@ -43,6 +43,9 @@ public class SecureInputHandler extends DefaultInputHandler {
String prompt = getPrompt(request); String prompt = getPrompt(request);
do { do {
char[] input = System.console().readPassword(); char[] input = System.console().readPassword();
if (input == null) {
throw new BuildException("unexpected end of stream while reading input");
}
request.setInput(new String(input)); request.setInput(new String(input));
Arrays.fill(input, ' '); Arrays.fill(input, ' ');
} while (!request.isInputValid()); } while (!request.isInputValid());


Loading…
Cancel
Save