From 7b65b2f6bc74268a5577b5590570e3b4fe913725 Mon Sep 17 00:00:00 2001 From: Dawid Heyman Date: Thu, 27 Jun 2024 14:57:56 +0200 Subject: [PATCH] Add suggestions --- .../client/jdbc/SnowflakeDatabaseMetaData.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java index 20a491e93..c2b934faa 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java @@ -30,12 +30,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.sql.Types; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.regex.Pattern; import net.snowflake.client.core.ObjectMapperFactory; import net.snowflake.client.core.SFBaseSession; @@ -924,13 +919,9 @@ public int getMaxBinaryLiteralLength() throws SQLException { public int getMaxCharLiteralLength() throws SQLException { logger.trace("int getMaxCharLiteralLength()", false); raiseSQLExceptionIfConnectionIsClosed(); - int length = DEFAULT_MAX_LOB_SIZE; - Integer maxLiteralLengthFromSession = - (Integer) session.getOtherParameter(MAX_VARCHAR_BINARY_SIZE_PARAM_NAME); - if (maxLiteralLengthFromSession != null) { - length = maxLiteralLengthFromSession; - } - return length; + Optional maxLiteralLengthFromSession = + Optional.ofNullable((Integer) session.getOtherParameter(MAX_VARCHAR_BINARY_SIZE_PARAM_NAME)); + return maxLiteralLengthFromSession.orElse(DEFAULT_MAX_LOB_SIZE); } @Override