- Added a loop to the accept license part that loops as long as an unreadable answer (not yes/y or no/n) is entered and only aborts if the user selects no.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/07c77ee3 Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/07c77ee3 Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/07c77ee3 Branch: refs/heads/as3httpclient-work Commit: 07c77ee31304498a89ec170af214d09e22acc55f Parents: f21e528 Author: Christofer Dutz <[email protected]> Authored: Fri Apr 10 09:14:50 2015 +0200 Committer: Christofer Dutz <[email protected]> Committed: Fri Apr 10 09:14:50 2015 +0200 ---------------------------------------------------------------------- .../retrievers/download/DownloadRetriever.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/07c77ee3/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java ---------------------------------------------------------------------- diff --git a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java index 115898d..96e95ff 100644 --- a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java +++ b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java @@ -342,14 +342,19 @@ public class DownloadRetriever extends BaseRetriever { } else { throw new RetrieverException("Unknown SdkType"); } - System.out.println(question); - System.out.print(questionProps.getProperty("DO_YOU_ACCEPT_QUESTION") + " "); final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { - final String answer = reader.readLine(); - if (!"YES".equalsIgnoreCase(answer)) { - System.out.println("You have to accept the license agreement in order to proceed."); - throw new RetrieverException("You have to accept the license agreement in order to proceed."); + while (true) { + System.out.println(question); + System.out.print(questionProps.getProperty("DO_YOU_ACCEPT_QUESTION") + " "); + final String answer = reader.readLine(); + if ("YES".equalsIgnoreCase(answer) || "Y".equalsIgnoreCase(answer)) { + return; + } + if ("NO".equalsIgnoreCase(answer) || "N".equalsIgnoreCase(answer)) { + System.out.println("You have to accept the license agreement in order to proceed."); + throw new RetrieverException("You have to accept the license agreement in order to proceed."); + } } } catch(IOException e) { throw new RetrieverException("Couldn't read from Stdin.");
