Skip to content

Commit 3f2c0b0

Browse files
committed
[ZEPPELIN-6262] Simplify build() method and remove redundant null check in client type parsing
1 parent 164d436 commit 3f2c0b0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client/ElasticsearchClientTypeBuilder.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,15 @@ private Builder(String propertyValue) {
4343

4444
@Override
4545
public ElasticsearchClientType build() {
46-
boolean isBlank = StringUtils.isBlank(propertyValue);
47-
return isBlank ?
48-
DEFAULT_ELASTICSEARCH_CLIENT_TYPE :
49-
getElasticsearchClientType(propertyValue);
46+
return StringUtils.isBlank(propertyValue) ?
47+
DEFAULT_ELASTICSEARCH_CLIENT_TYPE :
48+
getElasticsearchClientType(propertyValue);
5049
}
5150

5251
private ElasticsearchClientType getElasticsearchClientType(String propertyValue){
5352
try {
5453
return ElasticsearchClientType.valueOf(propertyValue.toUpperCase());
55-
} catch (IllegalArgumentException | NullPointerException e) {
54+
} catch (IllegalArgumentException e) {
5655
return UNKNOWN;
5756
}
5857
}

0 commit comments

Comments
 (0)