You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/01/06 17:30:50 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #1824: Upgrade to jline3

ctubbsii commented on a change in pull request #1824:
URL: https://github.com/apache/accumulo/pull/1824#discussion_r552838112



##########
File path: server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
##########
@@ -271,19 +273,23 @@ static boolean checkInit(VolumeManager fs, SiteConfiguration sconf, Configuratio
       return false;
     }
     if (sconf.get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) {
-      ConsoleReader c = getConsoleReader();
-      c.beep();
-      c.println();
-      c.println();
-      c.println("Warning!!! Your instance secret is still set to the default,"
-          + " this is not secure. We highly recommend you change it.");
-      c.println();
-      c.println();
-      c.println("You can change the instance secret in accumulo by using:");
-      c.println("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName());
-      c.println("You will also need to edit your secret in your configuration"
-          + " file by adding the property instance.secret to your"
-          + " accumulo.properties. Without this accumulo will not operate" + " correctly");
+      LineReader c = getLineReader();
+      c.getTerminal().puts(InfoCmp.Capability.bell);
+      c.getTerminal().writer().println();

Review comment:
       Sometimes this is done for readability, sometimes to reuse a buffer for performance to avoid unnecessary string concatenation (as in StringBuilder append methods), and sometimes to defer to environment-specific implementations (like cross-platform newline differences). It could also just be more convenient for a developer to copy/paste as many `println` calls as they want, rather than edit in a specific number of `\n` in several different String literals.
   
   I'm not sure why it's used this way in this particular case, but probably some combination of readability and developer convenience. But, it probably also makes sense in this case to defer to the terminal's environment-specific implementation, since the terminal itself is intended as an abstraction around the command-line environment.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org