| @@ -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: | ||||
| -------------- | -------------- | ||||
| @@ -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" | ||||
| @@ -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()); | ||||