You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2018/06/04 06:57:34 UTC

[2/3] ant git commit: Merge branch '1.9.x'

Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/4ecd6bf9
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/4ecd6bf9
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/4ecd6bf9

Branch: refs/heads/master
Commit: 4ecd6bf90b5ed6725f073f4d9d9b62c8830c757f
Parents: d228bfb f443a85
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jun 4 08:53:51 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jun 4 08:53:51 2018 +0200

----------------------------------------------------------------------
 WHATSNEW                                                     | 4 ++++
 src/main/org/apache/tools/ant/input/DefaultInputHandler.java | 3 +++
 src/main/org/apache/tools/ant/input/SecureInputHandler.java  | 3 +++
 3 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/4ecd6bf9/WHATSNEW
----------------------------------------------------------------------
diff --cc WHATSNEW
index d7b6733,699ad23..e9da6dd
--- a/WHATSNEW
+++ b/WHATSNEW
@@@ -28,15 -28,10 +28,19 @@@ Fixed bugs
   * The junit task when used with includeantruntime="no" was incorrectly
     printing a warning about multiple versions of ant detected in path
  
 + * <cab> died with a NullPointerException since Ant 1.10.2.
 +   Bugzilla Report 62335
 +
 + * The <depend> task would fail with 
 +   "java.lang.ClassFormatError: Invalid Constant Pool entry Type 19" while
 +   parsing a module-info.class. The task is compatible with
 +   Java bytecode version 53 now.
 +   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:
  --------------
  

http://git-wip-us.apache.org/repos/asf/ant/blob/4ecd6bf9/src/main/org/apache/tools/ant/input/SecureInputHandler.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/input/SecureInputHandler.java
index 878a01d,7fb0c34..7ae2dbc
--- a/src/main/org/apache/tools/ant/input/SecureInputHandler.java
+++ b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
@@@ -38,13 -39,29 +38,16 @@@ public class SecureInputHandler extend
       * @param request the request to handle
       * @throws BuildException if not possible to read from console
       */
 +    @SuppressWarnings("unused")
      public void handleInput(InputRequest request) throws BuildException {
 -        boolean nullInput = false;
          String prompt = getPrompt(request);
 -        try {
 -            Object console = ReflectUtil.invokeStatic(System.class, "console");
 -            do {
 -                char[] input = (char[]) ReflectUtil.invoke(
 -                    console, "readPassword", String.class, prompt,
 -                    Object[].class, (Object[]) null);
 -                if (input == null) {
 -                    nullInput = true;
 -                    break;
 -                }
 -                request.setInput(new String(input));
 -                /* for security zero char array after retrieving value */
 -                java.util.Arrays.fill(input, ' ');
 -            } while (!request.isInputValid());
 -        } catch (Exception e) {
 -            /* Java6 not present use default handler */
 -            super.handleInput(request);
 -        }
 -        if (nullInput) {
 -            throw new BuildException("unexpected end of stream while reading input");
 -        }
 +        do {
 +            char[] input = System.console().readPassword();
++            if (input == null) {
++                throw new BuildException("unexpected end of stream while reading input");
++            }
 +            request.setInput(new String(input));
 +            Arrays.fill(input, ' ');
 +        } while (!request.isInputValid());
      }
  }