ParkGyeongTae commented on code in PR #5002:
URL: https://github.com/apache/zeppelin/pull/5002#discussion_r2237986023


##########
elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/ElasticsearchClientTypeBuilder.java:
##########
@@ -47,18 +43,18 @@ private Builder(String propertyValue) {
 
     @Override
     public ElasticsearchClientType build() {
-      boolean isEmpty = StringUtils.isEmpty(propertyValue);
-      return isEmpty ?
+      boolean isBlank = StringUtils.isBlank(propertyValue);
+      return isBlank ?
         DEFAULT_ELASTICSEARCH_CLIENT_TYPE :
         getElasticsearchClientType(propertyValue);
     }
 
     private ElasticsearchClientType getElasticsearchClientType(String 
propertyValue){
-      boolean isExistingValue =
-          Arrays
-          .stream(values())
-          .anyMatch(clientType -> 
clientType.toString().equalsIgnoreCase(propertyValue));
-      return isExistingValue ? valueOf(propertyValue.toUpperCase()) : UNKNOWN;
+      try {
+        return ElasticsearchClientType.valueOf(propertyValue.toUpperCase());
+      } catch (IllegalArgumentException | NullPointerException e) {

Review Comment:
   I've removed the NPE in the updated code.



-- 
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: reviews-unsubscr...@zeppelin.apache.org

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

Reply via email to