[java-identity-provider] branch master updated: IDP-1499 Make prompts more prompt like

Rod Widdowson rdw at steadingsoftware.com
Fri Dec 20 04:49:23 EST 2019


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=14fe1379b157da2c90d42b714e8d98e5543a70da

The following commit(s) were added to refs/heads/master by this push:
       new  14fe137   IDP-1499 Make prompts more prompt like
14fe137 is described below

commit 14fe1379b157da2c90d42b714e8d98e5543a70da
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Dec 20 09:47:58 2019 +0000

    IDP-1499 Make prompts more prompt like
    
    https://issues.shibboleth.net/jira/browse/IDP-1499
---
 .../idp/installer/InstallerPropertiesImpl.java         | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
index 2c71271..c803174 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
@@ -35,6 +35,7 @@ import javax.annotation.Nullable;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.input.DefaultInputHandler;
+import org.apache.tools.ant.input.InputHandler;
 import org.apache.tools.ant.input.InputRequest;
 import org.apache.tools.ant.launch.Launcher;
 import org.slf4j.Logger;
@@ -175,12 +176,27 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
     /** Local overload of properties (to deal with nested calling). */
     private Map<String, String> inheritedProperties = Collections.EMPTY_MAP;
 
+    /** Inout handler from the prompting. */
+    private final InputHandler inputHandler;
+
     /**
      * Constructor.
      * @param copiedDistribution Has the distribution been copied? If no we don't need the source dir.
      */
     public InstallerPropertiesImpl(final boolean copiedDistribution) {
         needSourceDir = !copiedDistribution;
+        inputHandler = getInputHandler();
+    }
+
+    /** Get an {@link InputHandler} for the prompting.
+     * @return an input handler */
+    protected InputHandler getInputHandler() {
+        return new DefaultInputHandler() {
+            // we wants the prompts to be more obviously prompts
+            protected String getPrompt(final InputRequest request) {
+                return super.getPrompt(request) + " ? ";
+            }
+        };
     }
 
     /** Set any properties inherited from the base environment.
@@ -284,7 +300,7 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
         final String defaultValue = defaultSupplier.get();
         request.setDefaultValue(defaultValue);
 
-        new DefaultInputHandler().handleInput(request);
+        inputHandler.handleInput(request);
         value = request.getInput();
         if (value == null || "".contentEquals(value)) {
             return defaultValue;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list