[ 
https://issues.apache.org/jira/browse/HIVE-26272?focusedWorklogId=776033&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-776033
 ]

ASF GitHub Bot logged work on HIVE-26272:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/May/22 20:45
            Start Date: 30/May/22 20:45
    Worklog Time Spent: 10m 
      Work Description: 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....





Issue Time Tracking
-------------------

    Worklog Id:     (was: 776033)
    Time Spent: 20m  (was: 10m)

> inline log4j util code used in HiveServer2.java
> -----------------------------------------------
>
>                 Key: HIVE-26272
>                 URL: https://issues.apache.org/jira/browse/HIVE-26272
>             Project: Hive
>          Issue Type: Improvement
>          Components: Server Infrastructure
>    Affects Versions: 3.1.3
>            Reporter: PJ Fanning
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> See https://issues.apache.org/jira/browse/DRILL-8240 and related issues for 
> background.
> HiveServer2 uses log4j Strings class for a isBlank method.
> I can add a PR to inline this code.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to