You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/05/30 20:45:38 UTC

[GitHub] [hive] ayushtkn commented on a diff in pull request #3330: HIVE-26272: inline util code that is used from log4j jar

ayushtkn commented on code in PR #3330:
URL: https://github.com/apache/hive/pull/3330#discussion_r885071286


##########
service/src/java/org/apache/hive/service/server/HiveServer2.java:
##########
@@ -442,6 +441,26 @@ public synchronized void init(HiveConf hiveConf) {
     ShutdownHookManager.addShutdownHook(() -> hiveServer2.stop());
   }
 
+  /**
+   * Checks if a String is blank. A blank string is one that is either
+   * {@code null}, empty, or all characters are {@link Character#isWhitespace(char)}.
+   *
+   * @param s the String to check, may be {@code null}
+   * @return {@code true} if the String is {@code null}, empty, or all characters are {@link Character#isWhitespace(char)}
+   */
+  private static boolean isBlank(final String s) {
+    if (s == null || s.isEmpty()) {
+      return true;
+    }
+    for (int i = 0; i < s.length(); i++) {
+      final char c = s.charAt(i);
+      if (!Character.isWhitespace(c)) {
+        return false;
+      }
+    }
+    return true;
+  }
+

Review Comment:
   Can't we directly use ``StringUtils.isBlank()`` rather than implementing our own stuff? If we want to do so in that case we should put it in some Util class then....



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org