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:33 UTC
[1/3] ant git commit: throw exception with useful message if input
handler hits EOF
Repository: ant
Updated Branches:
refs/heads/master d228bfb07 -> bb572da3b
throw exception with useful message if input handler hits EOF
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/f443a85b
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/f443a85b
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/f443a85b
Branch: refs/heads/master
Commit: f443a85b921093deceb30e0b82875d7badb1f6e7
Parents: 291a214
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jun 4 08:50:42 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jun 4 08:50:42 2018 +0200
----------------------------------------------------------------------
WHATSNEW | 4 ++++
.../org/apache/tools/ant/input/DefaultInputHandler.java | 3 +++
.../org/apache/tools/ant/input/SecureInputHandler.java | 10 +++++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/f443a85b/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 9e096c9..699ad23 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -28,6 +28,10 @@ Fixed bugs:
* The junit task when used with includeantruntime="no" was incorrectly
printing a warning about multiple versions of ant detected in path
+ * 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/f443a85b/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/input/DefaultInputHandler.java b/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
index 164505f..fa68223 100644
--- a/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
+++ b/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
@@ -56,6 +56,9 @@ public class DefaultInputHandler implements InputHandler {
System.err.flush();
try {
String input = r.readLine();
+ if (input == null) {
+ throw new BuildException("unexpected end of stream while reading input");
+ }
request.setInput(input);
} catch (IOException e) {
throw new BuildException("Failed to read input from"
http://git-wip-us.apache.org/repos/asf/ant/blob/f443a85b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/input/SecureInputHandler.java b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
index 51f8b95..7fb0c34 100644
--- a/src/main/org/apache/tools/ant/input/SecureInputHandler.java
+++ b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
@@ -40,6 +40,7 @@ public class SecureInputHandler extends DefaultInputHandler {
* @throws BuildException if not possible to read from console
*/
public void handleInput(InputRequest request) throws BuildException {
+ boolean nullInput = false;
String prompt = getPrompt(request);
try {
Object console = ReflectUtil.invokeStatic(System.class, "console");
@@ -47,6 +48,10 @@ public class SecureInputHandler extends DefaultInputHandler {
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, ' ');
@@ -55,5 +60,8 @@ public class SecureInputHandler extends DefaultInputHandler {
/* Java6 not present use default handler */
super.handleInput(request);
}
+ if (nullInput) {
+ throw new BuildException("unexpected end of stream while reading input");
+ }
}
-}
\ No newline at end of file
+}
[2/3] ant git commit: Merge branch '1.9.x'
Posted by bo...@apache.org.
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());
}
}
[3/3] ant git commit: SecureInputHandler lost prompt with commit
066c4ce
Posted by bo...@apache.org.
SecureInputHandler lost prompt with commit 066c4ce
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/bb572da3
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/bb572da3
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/bb572da3
Branch: refs/heads/master
Commit: bb572da3bb0f4b21f5bf0e728a8ddd2c4bdb2746
Parents: 4ecd6bf
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jun 4 08:57:05 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jun 4 08:57:05 2018 +0200
----------------------------------------------------------------------
src/main/org/apache/tools/ant/input/SecureInputHandler.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/bb572da3/src/main/org/apache/tools/ant/input/SecureInputHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/input/SecureInputHandler.java b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
index 7ae2dbc..eea7714 100644
--- a/src/main/org/apache/tools/ant/input/SecureInputHandler.java
+++ b/src/main/org/apache/tools/ant/input/SecureInputHandler.java
@@ -42,7 +42,7 @@ public class SecureInputHandler extends DefaultInputHandler {
public void handleInput(InputRequest request) throws BuildException {
String prompt = getPrompt(request);
do {
- char[] input = System.console().readPassword();
+ char[] input = System.console().readPassword(prompt);
if (input == null) {
throw new BuildException("unexpected end of stream while reading input");
}