This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jelly.git

commit 1c400deb53a927eafc328d7bffa9cd2d81207056
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Jun 13 11:38:18 2025 -0400

    Use final
    
    - Sort imports
---
 .../commons/jelly/tags/interaction/AskTag.java     | 57 +++++++++++-----------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git 
a/jelly-tags/interaction/src/main/java/org/apache/commons/jelly/tags/interaction/AskTag.java
 
b/jelly-tags/interaction/src/main/java/org/apache/commons/jelly/tags/interaction/AskTag.java
index 04bab578..5ce3d69d 100644
--- 
a/jelly-tags/interaction/src/main/java/org/apache/commons/jelly/tags/interaction/AskTag.java
+++ 
b/jelly-tags/interaction/src/main/java/org/apache/commons/jelly/tags/interaction/AskTag.java
@@ -19,19 +19,18 @@ package org.apache.commons.jelly.tags.interaction;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.jelly.TagSupport;
+import org.apache.commons.jelly.XMLOutput;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import jline.ConsoleReader;
 import jline.History;
 import jline.SimpleCompletor;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.jelly.TagSupport;
-import org.apache.commons.jelly.XMLOutput;
-
   /**
   * Jelly Tag that asks the user a question, and puts his answer into a 
variable,
   * with the attribute "answer". This variable may be reused further as any 
other
@@ -62,81 +61,81 @@ public class AskTag extends TagSupport {
 
     /** A list of predefined commands for tab completion. */
     private List completor;
-    
+
     /** Whether to complete with previous completions as well. */
     private boolean useHistoryCompletor = true;
 
     /**
      * Sets the question to ask to the user. If a "default" attribute is
      * present, it will appear inside [].
-     * 
+     *
      * @param question
      *            The question to ask to the user
      */
-    public void setQuestion(String question) {
+    public void setQuestion(final String question) {
         this.question = question;
     }
 
     /**
-     * Sets the name of the variable that will hold the answer. 
+     * Sets the name of the variable that will hold the answer.
      * This defaults to "interact.answer".
-     * 
+     *
      * @param answer
      *            the name of the variable that will hold the answer
      */
-    public void setAnswer(String answer) {
+    public void setAnswer(final String answer) {
         this.answer = answer;
     }
 
     /**
      * Sets the default answer to the question. If it is present, it will 
appear
      * inside [].
-     * 
+     *
      * @param defaultInput
      *            the default answer to the question
      */
-    public void setDefault(String defaultInput) {
+    public void setDefault(final String defaultInput) {
         this.defaultInput = defaultInput;
     }
 
     /**
      * Sets the prompt that will be displayed before the user's input.
-     * 
+     *
      * @param prompt
      *            the prompt that will be displayed before the user's input.
      */
-    public void setPrompt(String prompt) {
+    public void setPrompt(final String prompt) {
         this.prompt = prompt;
     }
 
     /**
      * Sets the list of predefined commands.
-     * 
+     *
      * @param list
      *            the list of commands used for tab completion.
      */
-    public void setCompletor(List list) {
+    public void setCompletor(final List list) {
         this.completor = list;
     }
-    
+
     /**
      * Sets whether the completion should also happen on previously
      * entered lines (default true).
      *
      * @param should whether it should
      */
-    public void setUseHistoryCompletor(boolean should) {
+    public void setUseHistoryCompletor(final boolean should) {
         this.useHistoryCompletor = should;
     }
 
     /**
      * Perform functionality provided by the tag.
-     * 
+     *
      * @param output
      *            the place to write output
      */
     @Override
-    public void doTag(XMLOutput output) {
+    public void doTag(final XMLOutput output) {
         if (question != null) {
             if (defaultInput != null) {
                 System.out.println(question + " [" + defaultInput + "]");
@@ -153,7 +152,7 @@ public class AskTag extends TagSupport {
 
         try {
             consoleReader = new ConsoleReader();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             logger.warn("couldnt create console reader", e);
             consoleReader = null;
         }
@@ -169,19 +168,19 @@ public class AskTag extends TagSupport {
                 consoleReader.setBellEnabled(false);
 
                 // add old commands as tab completion history
-                List oldCommandsAsList = useHistoryCompletor
+                final List oldCommandsAsList = useHistoryCompletor
                     ? new ArrayList(consoleHistory.getHistoryList()) : new 
ArrayList(0);
                 // add predefined commands if given
                 if (completor != null && !completor.isEmpty()) {
                     oldCommandsAsList.addAll(completor);
                 }
-                String[] oldCommands = new String[oldCommandsAsList.size()];
+                final String[] oldCommands = new 
String[oldCommandsAsList.size()];
                 oldCommandsAsList.toArray(oldCommands);
                 consoleReader.addCompletor (new SimpleCompletor (oldCommands));
 
                 // read the input!
                 input = consoleReader.readLine();
-                
+
                 // trim the input for tab completion
                 input = input.trim();
 
@@ -189,12 +188,12 @@ public class AskTag extends TagSupport {
                     input = defaultInput;
                 }
             } else {
-                BufferedReader reader = new BufferedReader(
+                final BufferedReader reader = new BufferedReader(
                         new InputStreamReader(System.in));
                 input = reader.readLine();
             }
 
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             logger.warn("error setting up the console reader", ex);
         }
 

Reply via email to