From e899319ea519a7b3e1447af36980de010cc1f387 Mon Sep 17 00:00:00 2001 From: Joyce <115662568+sfc-gh-ext-simba-jl@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:54:01 -0800 Subject: [PATCH 1/4] SNOW-1003775: Fix parsing large string values with jackson databind > 2.15 (#1613) --- .../net/snowflake/client/core/HttpUtil.java | 34 ++----- .../client/core/ObjectMapperFactory.java | 20 ++++ .../net/snowflake/client/core/SFSession.java | 3 +- .../net/snowflake/client/core/SystemUtil.java | 37 ++++++++ .../client/core/ObjectMapperTest.java | 92 +++++++++++++++++++ .../client/core/SessionUtilLatestIT.java | 4 +- .../client/core/SessionUtilTest.java | 6 +- .../client/jdbc/ResultSetLatestIT.java | 22 +++++ 8 files changed, 183 insertions(+), 35 deletions(-) create mode 100644 src/main/java/net/snowflake/client/core/SystemUtil.java create mode 100644 src/test/java/net/snowflake/client/core/ObjectMapperTest.java diff --git a/src/main/java/net/snowflake/client/core/HttpUtil.java b/src/main/java/net/snowflake/client/core/HttpUtil.java index eb2d3d6b6..0d73270fc 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -109,14 +109,14 @@ public class HttpUtil { @SnowflakeJdbcInternalApi public static Duration getConnectionTimeout() { return Duration.ofMillis( - convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( JDBC_CONNECTION_TIMEOUT_IN_MS_PROPERTY, DEFAULT_HTTP_CLIENT_CONNECTION_TIMEOUT_IN_MS)); } @SnowflakeJdbcInternalApi public static Duration getSocketTimeout() { return Duration.ofMillis( - convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( JDBC_SOCKET_TIMEOUT_IN_MS_PROPERTY, DEFAULT_HTTP_CLIENT_SOCKET_TIMEOUT_IN_MS)); } @@ -305,7 +305,7 @@ public static CloseableHttpClient buildHttpClient( @Nullable HttpClientSettingsKey key, File ocspCacheFile, boolean downloadUnCompressed) { // set timeout so that we don't wait forever. // Setup the default configuration for all requests on this client - int timeToLive = convertSystemPropertyToIntValue(JDBC_TTL, DEFAULT_TTL); + int timeToLive = SystemUtil.convertSystemPropertyToIntValue(JDBC_TTL, DEFAULT_TTL); logger.debug("time to live in connection pooling manager: {}", timeToLive); long connectTimeout = getConnectionTimeout().toMillis(); long socketTimeout = getSocketTimeout().toMillis(); @@ -373,9 +373,10 @@ public static CloseableHttpClient buildHttpClient( new PoolingHttpClientConnectionManager( registry, null, null, null, timeToLive, TimeUnit.SECONDS); int maxConnections = - convertSystemPropertyToIntValue(JDBC_MAX_CONNECTIONS_PROPERTY, DEFAULT_MAX_CONNECTIONS); + SystemUtil.convertSystemPropertyToIntValue( + JDBC_MAX_CONNECTIONS_PROPERTY, DEFAULT_MAX_CONNECTIONS); int maxConnectionsPerRoute = - convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( JDBC_MAX_CONNECTIONS_PER_ROUTE_PROPERTY, DEFAULT_MAX_CONNECTIONS_PER_ROUTE); logger.debug( "Max connections total in connection pooling manager: {}; max connections per route: {}", @@ -901,29 +902,6 @@ public Socket createSocket(HttpContext ctx) throws IOException { } } - /** - * Helper function to convert system properties to integers - * - * @param systemProperty name of the system property - * @param defaultValue default value used - * @return the value of the system property, else the default value - */ - static int convertSystemPropertyToIntValue(String systemProperty, int defaultValue) { - String systemPropertyValue = systemGetProperty(systemProperty); - int returnVal = defaultValue; - if (systemPropertyValue != null) { - try { - returnVal = Integer.parseInt(systemPropertyValue); - } catch (NumberFormatException ex) { - logger.info( - "Failed to parse the system parameter {} with value {}", - systemProperty, - systemPropertyValue); - } - } - return returnVal; - } - /** * Helper function to attach additional headers to a request if present. This takes a (nullable) * map of headers in format and adds them to the incoming request using addHeader. diff --git a/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java b/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java index d93fc3b52..2c6a3fbb1 100644 --- a/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java +++ b/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java @@ -1,18 +1,38 @@ package net.snowflake.client.core; +import com.fasterxml.jackson.core.StreamReadConstraints; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import net.snowflake.client.log.SFLogger; +import net.snowflake.client.log.SFLoggerFactory; /** * Factor method used to create ObjectMapper instance. All object mapper in JDBC should be created * by this method. */ public class ObjectMapperFactory { + @SnowflakeJdbcInternalApi + // Snowflake allows up to 16M string size and returns base64 encoded value that makes it up to 23M + public static final int DEFAULT_MAX_JSON_STRING_LEN = 23_000_000; + + public static final String MAX_JSON_STRING_LENGTH_JVM = + "net.snowflake.jdbc.objectMapper.maxJsonStringLength"; + + private static final SFLogger logger = SFLoggerFactory.getLogger(ObjectMapperFactory.class); + public static ObjectMapper getObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS, false); mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false); + // override the maxStringLength value in ObjectMapper + int maxJsonStringLength = + SystemUtil.convertSystemPropertyToIntValue( + MAX_JSON_STRING_LENGTH_JVM, DEFAULT_MAX_JSON_STRING_LEN); + mapper + .getFactory() + .setStreamReadConstraints( + StreamReadConstraints.builder().maxStringLength(maxJsonStringLength).build()); return mapper; } } diff --git a/src/main/java/net/snowflake/client/core/SFSession.java b/src/main/java/net/snowflake/client/core/SFSession.java index 8ff722191..c5523d894 100644 --- a/src/main/java/net/snowflake/client/core/SFSession.java +++ b/src/main/java/net/snowflake/client/core/SFSession.java @@ -47,7 +47,6 @@ public class SFSession extends SFBaseSession { // Need to be removed when a better way to organize session parameter is introduced. private static final String CLIENT_STORE_TEMPORARY_CREDENTIAL = "CLIENT_STORE_TEMPORARY_CREDENTIAL"; - private static final ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(); private static final int MAX_SESSION_PARAMETERS = 1000; // this constant was public - let's not change it public static final int DEFAULT_HTTP_CLIENT_SOCKET_TIMEOUT = @@ -931,7 +930,7 @@ protected void heartbeat() throws SFException, SQLException { logger.debug("connection heartbeat response: {}", theResponse); - rootNode = mapper.readTree(theResponse); + rootNode = OBJECT_MAPPER.readTree(theResponse); // check the response to see if it is session expiration response if (rootNode != null diff --git a/src/main/java/net/snowflake/client/core/SystemUtil.java b/src/main/java/net/snowflake/client/core/SystemUtil.java new file mode 100644 index 000000000..1094261eb --- /dev/null +++ b/src/main/java/net/snowflake/client/core/SystemUtil.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved. + */ + +package net.snowflake.client.core; + +import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; + +import net.snowflake.client.log.SFLogger; +import net.snowflake.client.log.SFLoggerFactory; + +class SystemUtil { + private static final SFLogger logger = SFLoggerFactory.getLogger(SystemUtil.class); + + /** + * Helper function to convert system properties to integers + * + * @param systemProperty name of the system property + * @param defaultValue default value used + * @return the value of the system property, else the default value + */ + static int convertSystemPropertyToIntValue(String systemProperty, int defaultValue) { + String systemPropertyValue = systemGetProperty(systemProperty); + int returnVal = defaultValue; + if (systemPropertyValue != null) { + try { + returnVal = Integer.parseInt(systemPropertyValue); + } catch (NumberFormatException ex) { + logger.info( + "Failed to parse the system parameter {} with value {}", + systemProperty, + systemPropertyValue); + } + } + return returnVal; + } +} diff --git a/src/test/java/net/snowflake/client/core/ObjectMapperTest.java b/src/test/java/net/snowflake/client/core/ObjectMapperTest.java new file mode 100644 index 000000000..6868d186e --- /dev/null +++ b/src/test/java/net/snowflake/client/core/ObjectMapperTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved. + */ + +package net.snowflake.client.core; + +import static org.junit.Assert.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.charset.StandardCharsets; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Collection; +import java.util.List; +import net.snowflake.client.jdbc.SnowflakeUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class ObjectMapperTest { + private static final int jacksonDefaultMaxStringLength = 20_000_000; + + @Parameterized.Parameters(name = "lobSizeInMB={0}, maxJsonStringLength={1}") + public static Collection data() { + int[] lobSizeInMB = new int[] {16, 16, 32, 64, 128}; + // maxJsonStringLength to be set for the corresponding LOB size + int[] maxJsonStringLengths = + new int[] {jacksonDefaultMaxStringLength, 23_000_000, 45_000_000, 90_000_000, 180_000_000}; + List ret = new ArrayList<>(); + for (int i = 0; i < lobSizeInMB.length; i++) { + ret.add(new Object[] {lobSizeInMB[i], maxJsonStringLengths[i]}); + } + return ret; + } + + private final int lobSizeInBytes; + private final int maxJsonStringLength; + + @After + public void clearProperty() { + System.clearProperty(ObjectMapperFactory.MAX_JSON_STRING_LENGTH_JVM); + } + + public ObjectMapperTest(int lobSizeInMB, int maxJsonStringLength) { + // convert LOB size from MB to bytes + this.lobSizeInBytes = lobSizeInMB * 1024 * 1024; + this.maxJsonStringLength = maxJsonStringLength; + System.setProperty( + ObjectMapperFactory.MAX_JSON_STRING_LENGTH_JVM, Integer.toString(maxJsonStringLength)); + } + + @Test + public void testInvalidMaxJsonStringLength() throws SQLException { + System.setProperty(ObjectMapperFactory.MAX_JSON_STRING_LENGTH_JVM, "abc"); + // calling getObjectMapper() should log the exception but not throw + // default maxJsonStringLength value will be used + ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(); + int stringLengthInMapper = mapper.getFactory().streamReadConstraints().getMaxStringLength(); + Assert.assertEquals(ObjectMapperFactory.DEFAULT_MAX_JSON_STRING_LEN, stringLengthInMapper); + } + + @Test + public void testObjectMapperWithLargeJsonString() { + ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(); + try { + JsonNode jsonNode = mapper.readTree(generateBase64EncodedJsonString(lobSizeInBytes)); + Assert.assertNotNull(jsonNode); + } catch (Exception e) { + // exception is expected when jackson's default maxStringLength value is used while retrieving + // 16M string data + assertEquals(jacksonDefaultMaxStringLength, maxJsonStringLength); + } + } + + private String generateBase64EncodedJsonString(int numChar) { + StringBuilder jsonStr = new StringBuilder(); + String largeStr = SnowflakeUtil.randomAlphaNumeric(numChar); + + // encode the string and put it into a JSON formatted string + jsonStr.append("[\"").append(encodeStringToBase64(largeStr)).append("\"]"); + return jsonStr.toString(); + } + + private String encodeStringToBase64(String stringToBeEncoded) { + return Base64.getEncoder().encodeToString(stringToBeEncoded.getBytes(StandardCharsets.UTF_8)); + } +} diff --git a/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java b/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java index 14d697371..e38fb451b 100644 --- a/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java +++ b/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java @@ -112,12 +112,12 @@ private Map initConnectionPropertiesMap() { public void testConvertSystemPropertyToIntValue() { // SNOW-760642 - Test that new default for net.snowflake.jdbc.ttl is 60 seconds. assertEquals( - 60, HttpUtil.convertSystemPropertyToIntValue(HttpUtil.JDBC_TTL, HttpUtil.DEFAULT_TTL)); + 60, SystemUtil.convertSystemPropertyToIntValue(HttpUtil.JDBC_TTL, HttpUtil.DEFAULT_TTL)); // Test that TTL can be disabled System.setProperty(HttpUtil.JDBC_TTL, "-1"); assertEquals( - -1, HttpUtil.convertSystemPropertyToIntValue(HttpUtil.JDBC_TTL, HttpUtil.DEFAULT_TTL)); + -1, SystemUtil.convertSystemPropertyToIntValue(HttpUtil.JDBC_TTL, HttpUtil.DEFAULT_TTL)); } /** diff --git a/src/test/java/net/snowflake/client/core/SessionUtilTest.java b/src/test/java/net/snowflake/client/core/SessionUtilTest.java index 13e7a0a78..e3ef60014 100644 --- a/src/test/java/net/snowflake/client/core/SessionUtilTest.java +++ b/src/test/java/net/snowflake/client/core/SessionUtilTest.java @@ -73,19 +73,19 @@ public void testConvertSystemPropertyToIntValue() { System.setProperty("net.snowflake.jdbc.max_connections", "500"); assertEquals( 500, - HttpUtil.convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( HttpUtil.JDBC_MAX_CONNECTIONS_PROPERTY, HttpUtil.DEFAULT_MAX_CONNECTIONS)); // Test that entering a non-int sets the value to the default System.setProperty("net.snowflake.jdbc.max_connections", "notAnInteger"); assertEquals( HttpUtil.DEFAULT_MAX_CONNECTIONS, - HttpUtil.convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( HttpUtil.JDBC_MAX_CONNECTIONS_PROPERTY, HttpUtil.DEFAULT_MAX_CONNECTIONS)); // Test another system property System.setProperty("net.snowflake.jdbc.max_connections_per_route", "30"); assertEquals( 30, - HttpUtil.convertSystemPropertyToIntValue( + SystemUtil.convertSystemPropertyToIntValue( HttpUtil.JDBC_MAX_CONNECTIONS_PER_ROUTE_PROPERTY, HttpUtil.DEFAULT_MAX_CONNECTIONS_PER_ROUTE)); } diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java index 3d6b758b9..0261e71ce 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java @@ -21,6 +21,7 @@ import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.TestUtil; import net.snowflake.client.category.TestCategoryResultSet; +import net.snowflake.client.core.ObjectMapperFactory; import net.snowflake.client.core.SFBaseSession; import net.snowflake.client.core.SessionUtil; import net.snowflake.client.jdbc.telemetry.*; @@ -924,4 +925,25 @@ public void testGranularTimeFunctionsInUTC() throws SQLException { connection.close(); } } + + /** Added in > 3.14.5 */ + @Test + public void testLargeStringRetrieval() throws SQLException { + String tableName = "maxJsonStringLength_table"; + int colLength = 16777216; + try (Connection con = getConnection(); + Statement statement = con.createStatement()) { + statement.execute("create or replace table " + tableName + " (c1 string(" + colLength + "))"); + statement.execute( + "insert into " + tableName + " select randstr(" + colLength + ", random())"); + assertNull(System.getProperty(ObjectMapperFactory.MAX_JSON_STRING_LENGTH_JVM)); + try (ResultSet rs = statement.executeQuery("select * from " + tableName)) { + assertTrue(rs.next()); + assertEquals(colLength, rs.getString(1).length()); + assertFalse(rs.next()); + } + } catch (Exception e) { + fail("executeQuery should not fail"); + } + } } From 4ce7a834b4581a0d20e8dd5a821ee9017ff0c753 Mon Sep 17 00:00:00 2001 From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:17:50 +0100 Subject: [PATCH 2/4] SNOW-1050570: Block builds on incompatible changes (#1632) --- FIPS/pom.xml | 4 ++-- README.rst | 12 ++++++++++ parent-pom.xml | 7 +++++- pom.xml | 23 ++++--------------- .../net/snowflake/client/core/HttpUtil.java | 2 +- .../client/jdbc/SnowflakeDriver.java | 2 +- .../client/jdbc/SnowflakeDriverLatestIT.java | 2 +- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/FIPS/pom.xml b/FIPS/pom.xml index e7b0f6ccf..e3177ea96 100644 --- a/FIPS/pom.xml +++ b/FIPS/pom.xml @@ -5,12 +5,12 @@ net.snowflake snowflake-jdbc-parent - 3.14.5 + 3.14.6-SNAPSHOT ../parent-pom.xml snowflake-jdbc-fips - 3.14.5 + 3.14.6-SNAPSHOT jar snowflake-jdbc-fips diff --git a/README.rst b/README.rst index ae38c2a67..23519f350 100644 --- a/README.rst +++ b/README.rst @@ -179,6 +179,18 @@ Run the maven ``verify`` goal. where ``category`` is the class name under the package ``net.snowflake.client.category``. +Set new version +--------------- + +1. Run maven command with passing specific version: + +.. code-block:: bash + + mvn -f parent-pom.xml versions:set -DnewVersion=... -DgenerateBackupPoms=false + +2. Set manually the same version in field ``implementVersion`` in ``src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java`` when it's version for release or without ``-SNAPSHOT`` suffix between releases +3. Add entry in ``CHANGELOG.rst`` for release versions + Test Class Naming Convention ---------------------------- diff --git a/parent-pom.xml b/parent-pom.xml index bc9ebdfc8..dc6eb9419 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -5,9 +5,14 @@ net.snowflake snowflake-jdbc-parent - 3.14.5 + 3.14.6-SNAPSHOT pom + + . + FIPS + + 1.21 3.12.0 diff --git a/pom.xml b/pom.xml index 146b1367f..ca9aec0e0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,13 +6,13 @@ net.snowflake snowflake-jdbc-parent - 3.14.5 + 3.14.6-SNAPSHOT ./parent-pom.xml ${artifactId} - 3.14.5 + 3.14.6-SNAPSHOT jar ${artifactId} @@ -185,14 +185,15 @@ japicmp-maven-plugin - true - true + true + false \d+\.\d+\.\d+ com.snowflake net.snowflake + @net.snowflake.client.core.SnowflakeJdbcInternalApi ${shadeBase} @@ -594,20 +595,6 @@ - - - com.github.siom79.japicmp - japicmp-maven-plugin - - - japicmp - - cmp - - none - - - org.apache.maven.plugins diff --git a/src/main/java/net/snowflake/client/core/HttpUtil.java b/src/main/java/net/snowflake/client/core/HttpUtil.java index 0d73270fc..af30eaed1 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -13,7 +13,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.microsoft.azure.storage.OperationContext; -import com.snowflake.client.jdbc.SnowflakeDriver; import java.io.*; import java.net.InetSocketAddress; import java.net.Proxy; @@ -30,6 +29,7 @@ import javax.net.ssl.TrustManager; import net.snowflake.client.jdbc.ErrorCode; import net.snowflake.client.jdbc.RestRequest; +import net.snowflake.client.jdbc.SnowflakeDriver; import net.snowflake.client.jdbc.SnowflakeSQLException; import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.log.ArgSupplier; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java index 7c610c715..65569717e 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java @@ -23,7 +23,7 @@ public class SnowflakeDriver implements Driver { static SnowflakeDriver INSTANCE; public static final Properties EMPTY_PROPERTIES = new Properties(); - public static String implementVersion = "3.14.5"; + public static String implementVersion = "3.14.6"; static int majorVersion = 0; static int minorVersion = 0; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java index 93ec59580..5e091a487 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java @@ -79,7 +79,7 @@ private boolean isFileContentEqual( @Test public void testStaticVersionMatchesManifest() { - assertEquals(implementVersion, getClientVersionStringFromManifest()); + assertEquals(implementVersion, getClientVersionStringFromManifest().replace("-SNAPSHOT", "")); } @Test From 829618a0ca129e5765e656ab4476990f4ae4f23e Mon Sep 17 00:00:00 2001 From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:11:34 +0100 Subject: [PATCH 3/4] SNOW-1003775: Mark object mapper factory constant property name as internal (#1636) --- .../java/net/snowflake/client/core/ObjectMapperFactory.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java b/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java index 2c6a3fbb1..c751d4d20 100644 --- a/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java +++ b/src/main/java/net/snowflake/client/core/ObjectMapperFactory.java @@ -3,8 +3,6 @@ import com.fasterxml.jackson.core.StreamReadConstraints; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import net.snowflake.client.log.SFLogger; -import net.snowflake.client.log.SFLoggerFactory; /** * Factor method used to create ObjectMapper instance. All object mapper in JDBC should be created @@ -15,11 +13,10 @@ public class ObjectMapperFactory { // Snowflake allows up to 16M string size and returns base64 encoded value that makes it up to 23M public static final int DEFAULT_MAX_JSON_STRING_LEN = 23_000_000; + @SnowflakeJdbcInternalApi public static final String MAX_JSON_STRING_LENGTH_JVM = "net.snowflake.jdbc.objectMapper.maxJsonStringLength"; - private static final SFLogger logger = SFLoggerFactory.getLogger(ObjectMapperFactory.class); - public static ObjectMapper getObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS, false); From 557659ed6ebdd8a7acfd6349a5f6d632bb833502 Mon Sep 17 00:00:00 2001 From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:01:32 +0100 Subject: [PATCH 4/4] SNOW-1037802: Remove wildcard imports (#1635) --- .github/pull_request_template.md | 15 +++--- .github/workflows/check-style.yml | 2 +- README.rst | 6 ++- parent-pom.xml | 1 + pom.xml | 33 ++++++++++++ .../java/net/snowflake/client/core/Event.java | 6 ++- .../snowflake/client/core/EventHandler.java | 14 ++++- .../client/core/FileCacheManager.java | 9 +++- .../net/snowflake/client/core/HttpUtil.java | 6 ++- .../snowflake/client/core/IncidentUtil.java | 6 ++- .../client/core/QueryContextCache.java | 7 ++- .../net/snowflake/client/core/ResultUtil.java | 9 +++- .../client/core/SFArrowResultSet.java | 6 ++- .../client/core/SFBaseResultSet.java | 6 ++- .../snowflake/client/core/SFBaseSession.java | 13 ++++- .../client/core/SFFixedViewResultSet.java | 7 ++- .../snowflake/client/core/SFResultSet.java | 7 ++- .../client/core/SFResultSetMetaData.java | 7 ++- .../net/snowflake/client/core/SFSession.java | 27 ++++++++-- .../snowflake/client/core/SFStatement.java | 14 +++-- .../snowflake/client/core/SFTrustManager.java | 51 ++++++++++++++++--- .../core/SecureStorageWindowsManager.java | 6 ++- .../snowflake/client/core/SessionUtil.java | 15 +++++- .../core/SessionUtilExternalBrowser.java | 15 +++++- .../client/core/SessionUtilKeyPair.java | 9 +++- .../core/arrow/BigIntToTimeConverter.java | 6 ++- .../client/core/arrow/IntToTimeConverter.java | 5 +- ...hreeFieldStructToTimestampTZConverter.java | 6 ++- ...TwoFieldStructToTimestampLTZConverter.java | 6 ++- .../client/core/bind/BindUploader.java | 7 ++- .../client/jdbc/ArrowResultChunk.java | 39 +++++++++++++- .../jdbc/DefaultSFConnectionHandler.java | 19 +++++-- .../snowflake/client/jdbc/RestRequest.java | 8 ++- .../client/jdbc/SFAsyncResultSet.java | 8 ++- .../client/jdbc/SFConnectionHandler.java | 5 +- .../client/jdbc/SnowflakeBaseResultSet.java | 16 +++++- .../client/jdbc/SnowflakeBasicDataSource.java | 6 ++- .../client/jdbc/SnowflakeChunkDownloader.java | 32 ++++++++++-- .../client/jdbc/SnowflakeConnectString.java | 6 ++- .../client/jdbc/SnowflakeConnectionV1.java | 28 +++++++++- .../jdbc/SnowflakeDatabaseMetaData.java | 29 +++++++++-- .../SnowflakeDatabaseMetaDataResultSet.java | 8 ++- .../client/jdbc/SnowflakeDriver.java | 7 ++- .../jdbc/SnowflakeFileTransferAgent.java | 45 ++++++++++++++-- .../jdbc/SnowflakePreparedStatementV1.java | 35 +++++++++++-- .../SnowflakeResultSetSerializableV1.java | 34 +++++++++++-- .../client/jdbc/SnowflakeResultSetV1.java | 17 ++++++- .../client/jdbc/SnowflakeStatementV1.java | 24 +++++++-- .../snowflake/client/jdbc/SnowflakeType.java | 6 ++- .../snowflake/client/jdbc/SnowflakeUtil.java | 14 ++++- .../cloud/storage/SnowflakeAzureClient.java | 43 +++++++++++++--- .../cloud/storage/SnowflakeGCSClient.java | 37 ++++++++++++-- .../jdbc/cloud/storage/SnowflakeS3Client.java | 30 +++++++++-- .../cloud/storage/SnowflakeStorageClient.java | 6 ++- .../net/snowflake/client/log/JDK14Logger.java | 7 ++- .../snowflake/client/util/SecretDetector.java | 18 +++++-- .../snowflake/client/AbstractDriverIT.java | 13 ++++- .../config/SFClientConfigParserTest.java | 13 +++-- .../core/CoreUtilsMiscellaneousTest.java | 5 +- .../client/core/SFArrowResultSetIT.java | 36 +++++++++++-- .../SFTrustManagerMockitoMockLatestIT.java | 4 +- .../client/core/SecureStorageManagerTest.java | 5 +- .../core/SessionUtilExternalBrowserTest.java | 9 +++- .../client/core/SessionUtilLatestIT.java | 5 +- .../client/core/SessionUtilTest.java | 4 +- .../snowflake/client/core/StmtUtilTest.java | 4 +- .../snowflake/client/core/URLUtilTest.java | 4 +- .../arrow/BigIntToFixedConverterTest.java | 13 ++++- .../BigIntToTimestampLTZConverterTest.java | 10 +++- .../BigIntToTimestampNTZConverterTest.java | 11 +++- .../client/core/arrow/DateConverterTest.java | 7 ++- .../core/arrow/IntToFixedConverterTest.java | 17 +++++-- .../arrow/SmallIntToFixedConverterTest.java | 17 +++++-- ...FieldStructToTimestampTZConverterTest.java | 8 ++- .../arrow/TinyIntToFixedConverterTest.java | 13 ++++- ...ieldStructToTimestampLTZConverterTest.java | 8 ++- ...ieldStructToTimestampNTZConverterTest.java | 9 +++- ...FieldStructToTimestampTZConverterTest.java | 8 ++- .../core/arrow/VarCharConverterTest.java | 9 +++- .../snowflake/client/jdbc/BaseJDBCTest.java | 20 +++++++- .../snowflake/client/jdbc/BindUploaderIT.java | 22 ++++++-- .../client/jdbc/BindUploaderLatestIT.java | 16 +++++- .../client/jdbc/BindingDataLatestIT.java | 11 ++-- .../client/jdbc/CallableStatementIT.java | 10 +++- .../snowflake/client/jdbc/ConnectionIT.java | 31 +++++++++-- .../client/jdbc/ConnectionLatestIT.java | 32 ++++++++++-- .../client/jdbc/ConnectionWithOCSPModeIT.java | 7 ++- .../client/jdbc/CustomProxyLatestIT.java | 6 ++- .../client/jdbc/DatabaseMetaDataIT.java | 15 +++++- .../jdbc/DatabaseMetaDataInternalIT.java | 13 +++-- .../DatabaseMetaDataInternalLatestIT.java | 7 ++- .../client/jdbc/DatabaseMetaDataLatestIT.java | 20 ++++++-- .../DatabaseMetaDataResultSetLatestIT.java | 6 ++- .../jdbc/DatabaseMetaDataResultsetIT.java | 13 ++++- .../jdbc/FileUploaderExpandFileNamesTest.java | 3 +- .../client/jdbc/FileUploaderLatestIT.java | 27 ++++++++-- .../jdbc/FileUploaderSessionlessTest.java | 5 +- .../client/jdbc/HeartbeatAsyncLatestIT.java | 4 +- .../snowflake/client/jdbc/HeartbeatIT.java | 13 +++-- .../client/jdbc/MockConnectionTest.java | 38 ++++++++++++-- .../client/jdbc/MultiStatementIT.java | 6 ++- .../client/jdbc/MultiStatementLatestIT.java | 6 ++- .../client/jdbc/OpenGroupCLIFuncIT.java | 3 +- .../client/jdbc/PreparedStatement1IT.java | 20 ++++++-- .../jdbc/PreparedStatement1LatestIT.java | 13 ++++- .../jdbc/PreparedStatement2LatestIT.java | 13 +++-- .../client/jdbc/PutUnescapeBackslashIT.java | 2 +- .../client/jdbc/RestRequestTest.java | 8 ++- .../client/jdbc/ResultSetAlreadyClosedIT.java | 3 +- .../client/jdbc/ResultSetAsyncIT.java | 18 ++++++- .../client/jdbc/ResultSetAsyncLatestIT.java | 6 ++- .../snowflake/client/jdbc/ResultSetIT.java | 22 ++++++-- .../client/jdbc/ResultSetJsonVsArrowIT.java | 17 ++++++- .../client/jdbc/ResultSetLatestIT.java | 34 +++++++++++-- .../client/jdbc/ResultSetMultiTimeZoneIT.java | 21 ++++++-- .../jdbc/ResultSetMultiTimeZoneLatestIT.java | 13 ++++- .../client/jdbc/SSOConnectionTest.java | 20 ++++++-- ...akeAzureClientHandleExceptionLatestIT.java | 6 ++- .../client/jdbc/SnowflakeClobTest.java | 4 +- .../client/jdbc/SnowflakeDriverIT.java | 42 +++++++++++++-- .../client/jdbc/SnowflakeDriverLatestIT.java | 24 +++++++-- .../client/jdbc/SnowflakeDriverTest.java | 15 +++++- ...flakeGcsClientHandleExceptionLatestIT.java | 6 ++- .../SnowflakeResultSetSerializableIT.java | 19 +++++-- ...wflakeS3ClientHandleExceptionLatestIT.java | 6 ++- .../snowflake/client/jdbc/StatementIT.java | 7 ++- .../client/jdbc/StatementLatestIT.java | 12 ++++- .../client/jdbc/StatementNoOpLatestIT.java | 3 +- .../snowflake/client/jdbc/StreamLatestIT.java | 11 +++- .../storage/SnowflakeAzureClientLatestIT.java | 5 +- .../storage/SnowflakeS3ClientLatestIT.java | 7 ++- .../jdbc/telemetryOOB/TelemetryServiceIT.java | 4 +- .../telemetryOOB/TelemetryServiceTest.java | 3 +- .../client/loader/LoaderLatestIT.java | 4 +- .../client/log/JDK14JCLWrapperLatestIT.java | 4 +- .../log/JDK14LoggerWithClientLatestIT.java | 4 +- .../client/log/SLF4JJJCLWrapperLatestIT.java | 4 +- ...ConnectionFeatureNotSupportedLatestIT.java | 6 ++- .../pooling/LogicalConnectionLatestIT.java | 15 +++++- 139 files changed, 1570 insertions(+), 271 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 97d27c1a9..84ae71dcc 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,9 +2,12 @@ SNOW-XXXXX -## External contributors - please answer these questions before submitting a pull request. Thanks! +## Pre-review self checklist +- [ ] The code is correctly formatted (run `mvn -P check-style validate`) +- [ ] I don't expose unnecessary new public API (run `mvn verify` and inspect `target/japicmp/japicmp.html`) +- [ ] Pull request name is prefixed with `SNOW-XXXX: ` -Please answer these questions before submitting your pull requests. Thanks! +## External contributors - please answer these questions before submitting a pull request. Thanks! 1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR. @@ -18,13 +21,9 @@ Please answer these questions before submitting your pull requests. Thanks! - [ ] I am modifying authorization mechanisms - [ ] I am adding new credentials - [ ] I am modifying OCSP code - - [ ] I am adding a new dependency + - [ ] I am adding a new dependency or upgrading an existing one + - [ ] I am adding new public/protected component not marked with `@SnowflakeJdbcInternalApi` (note that public/protected methods/fields in classes marked with this annotation are already internal) 3. Please describe how your code solves the related issue. Please write a short description of how your code change solves the related issue. - -## Pre-review checklist -- [ ] This change has passed precommit -- [ ] I have reviewed code coverage report for my PR in ([Sonarqube](https://sonarqube.int.snowflakecomputing.com/project/branches?id=snowflake-jdbc)) - diff --git a/.github/workflows/check-style.yml b/.github/workflows/check-style.yml index 7b712cf73..221651298 100644 --- a/.github/workflows/check-style.yml +++ b/.github/workflows/check-style.yml @@ -12,4 +12,4 @@ jobs: - uses: actions/checkout@v1 - name: Check Style shell: bash - run: mvn clean verify --batch-mode --show-version -P check-style + run: mvn clean validate --batch-mode --show-version -P check-style diff --git a/README.rst b/README.rst index 23519f350..55248b392 100644 --- a/README.rst +++ b/README.rst @@ -138,7 +138,7 @@ Run the maven command to check the coding style. .. code-block:: bash - mvn -P check-style verify + mvn -P check-style validate Follow the instruction if any error occurs or run this command to fix the formats. @@ -151,6 +151,10 @@ You may import the coding style from IntelliJ so that the coding style can be ap - In the **File** -> **Settings/Plugins**, and install `google-java-format` plugin. - Enable `google-java-format` for the JDBC project. - In the source code window, select **Code** -> **Reformat** to apply the coding style. +- Additionally configure IDE to not use wildcard imports in **File** -> **Ecitor** -> **Code Style** -> **Java** set: + - **Use single class import** + - **Class count to use import with '*'** to 1000 + - **Names count to use static import with '*'** to 1000 Tests ===== diff --git a/parent-pom.xml b/parent-pom.xml index dc6eb9419..b7a553564 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -79,6 +79,7 @@ 3.6.3 3.1.0 3.0.0 + 3.3.1 3.2.0 3.11.0 3.5.0 diff --git a/pom.xml b/pom.xml index ca9aec0e0..a10aec4a1 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,11 @@ maven-antrun-plugin ${version.plugin.antrun} + + org.apache.maven.plugins + maven-checkstyle-plugin + ${version.plugin.checkstyle} + org.apache.maven.plugins maven-clean-plugin @@ -574,9 +579,37 @@ fmt-maven-plugin + fmt + + check + + validate + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + + + + + + + true + true + true + warning + + + + checkstyle check + validate diff --git a/src/main/java/net/snowflake/client/core/Event.java b/src/main/java/net/snowflake/client/core/Event.java index cd3bddaf8..e9e5400a6 100644 --- a/src/main/java/net/snowflake/client/core/Event.java +++ b/src/main/java/net/snowflake/client/core/Event.java @@ -5,7 +5,11 @@ package net.snowflake.client.core; import com.google.common.base.Preconditions; -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; import java.util.zip.GZIPOutputStream; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; diff --git a/src/main/java/net/snowflake/client/core/EventHandler.java b/src/main/java/net/snowflake/client/core/EventHandler.java index cca435386..11acd00fa 100644 --- a/src/main/java/net/snowflake/client/core/EventHandler.java +++ b/src/main/java/net/snowflake/client/core/EventHandler.java @@ -6,10 +6,20 @@ import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.TimeZone; +import java.util.TreeSet; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; diff --git a/src/main/java/net/snowflake/client/core/FileCacheManager.java b/src/main/java/net/snowflake/client/core/FileCacheManager.java index becfa3c4a..e635796c0 100644 --- a/src/main/java/net/snowflake/client/core/FileCacheManager.java +++ b/src/main/java/net/snowflake/client/core/FileCacheManager.java @@ -9,7 +9,14 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; diff --git a/src/main/java/net/snowflake/client/core/HttpUtil.java b/src/main/java/net/snowflake/client/core/HttpUtil.java index af30eaed1..5203db2f1 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -13,7 +13,11 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.microsoft.azure.storage.OperationContext; -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.Socket; diff --git a/src/main/java/net/snowflake/client/core/IncidentUtil.java b/src/main/java/net/snowflake/client/core/IncidentUtil.java index 6b2086ee5..0506f159b 100644 --- a/src/main/java/net/snowflake/client/core/IncidentUtil.java +++ b/src/main/java/net/snowflake/client/core/IncidentUtil.java @@ -14,7 +14,11 @@ import com.yammer.metrics.core.Clock; import com.yammer.metrics.core.VirtualMachineMetrics; import com.yammer.metrics.reporting.MetricsServlet; -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; diff --git a/src/main/java/net/snowflake/client/core/QueryContextCache.java b/src/main/java/net/snowflake/client/core/QueryContextCache.java index cddf33e32..ea6e37cd5 100644 --- a/src/main/java/net/snowflake/client/core/QueryContextCache.java +++ b/src/main/java/net/snowflake/client/core/QueryContextCache.java @@ -7,7 +7,12 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; diff --git a/src/main/java/net/snowflake/client/core/ResultUtil.java b/src/main/java/net/snowflake/client/core/ResultUtil.java index 65730ff33..f973bb1b1 100644 --- a/src/main/java/net/snowflake/client/core/ResultUtil.java +++ b/src/main/java/net/snowflake/client/core/ResultUtil.java @@ -10,7 +10,14 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.sql.Types; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.jdbc.ErrorCode; import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.log.ArgSupplier; diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index 5a121086a..ce83befd0 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -16,8 +16,12 @@ import java.sql.Timestamp; import java.util.TimeZone; import net.snowflake.client.core.arrow.ArrowVectorConverter; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ArrowResultChunk; import net.snowflake.client.jdbc.ArrowResultChunk.ArrowChunkIterator; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.jdbc.telemetry.TelemetryData; import net.snowflake.client.jdbc.telemetry.TelemetryField; diff --git a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java index 0cf4ac568..8901598b8 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java @@ -9,7 +9,11 @@ import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.jdbc.ErrorCode; import net.snowflake.client.jdbc.SnowflakeResultSetSerializable; import net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1; diff --git a/src/main/java/net/snowflake/client/core/SFBaseSession.java b/src/main/java/net/snowflake/client/core/SFBaseSession.java index 810ce0398..a5b63974d 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseSession.java +++ b/src/main/java/net/snowflake/client/core/SFBaseSession.java @@ -10,10 +10,19 @@ import com.google.common.base.Strings; import java.sql.DriverPropertyInfo; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.QueryStatusV2; +import net.snowflake.client.jdbc.SFConnectionHandler; +import net.snowflake.client.jdbc.SnowflakeConnectString; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeType; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; diff --git a/src/main/java/net/snowflake/client/core/SFFixedViewResultSet.java b/src/main/java/net/snowflake/client/core/SFFixedViewResultSet.java index 671857b93..b3f797f6f 100644 --- a/src/main/java/net/snowflake/client/core/SFFixedViewResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFFixedViewResultSet.java @@ -7,8 +7,13 @@ import java.sql.SQLException; import java.util.List; import net.snowflake.client.core.json.Converters; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SFBaseFileTransferAgent; import net.snowflake.client.jdbc.SFBaseFileTransferAgent.CommandType; +import net.snowflake.client.jdbc.SnowflakeFixedView; +import net.snowflake.client.jdbc.SnowflakeLoggedFeatureNotSupportedException; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.common.core.SFBinaryFormat; diff --git a/src/main/java/net/snowflake/client/core/SFResultSet.java b/src/main/java/net/snowflake/client/core/SFResultSet.java index 3a32dde6b..77f30ddd7 100644 --- a/src/main/java/net/snowflake/client/core/SFResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFResultSet.java @@ -13,7 +13,12 @@ import java.util.Comparator; import net.snowflake.client.core.BasicEvent.QueryState; import net.snowflake.client.core.json.Converters; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.JsonResultChunk; +import net.snowflake.client.jdbc.SnowflakeResultChunk; +import net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.jdbc.telemetry.TelemetryData; import net.snowflake.client.jdbc.telemetry.TelemetryField; diff --git a/src/main/java/net/snowflake/client/core/SFResultSetMetaData.java b/src/main/java/net/snowflake/client/core/SFResultSetMetaData.java index 1ebe3ca1d..2976473ac 100644 --- a/src/main/java/net/snowflake/client/core/SFResultSetMetaData.java +++ b/src/main/java/net/snowflake/client/core/SFResultSetMetaData.java @@ -7,7 +7,12 @@ import java.sql.Date; import java.sql.ResultSetMetaData; import java.sql.Types; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.jdbc.ErrorCode; import net.snowflake.client.jdbc.SnowflakeColumnMetadata; import net.snowflake.client.jdbc.SnowflakeUtil; diff --git a/src/main/java/net/snowflake/client/core/SFSession.java b/src/main/java/net/snowflake/client/core/SFSession.java index c5523d894..b2b5ae3a1 100644 --- a/src/main/java/net/snowflake/client/core/SFSession.java +++ b/src/main/java/net/snowflake/client/core/SFSession.java @@ -4,7 +4,9 @@ package net.snowflake.client.core; -import static net.snowflake.client.core.QueryStatus.*; +import static net.snowflake.client.core.QueryStatus.getStatusFromString; +import static net.snowflake.client.core.QueryStatus.isAnError; +import static net.snowflake.client.core.QueryStatus.isStillRunning; import static net.snowflake.client.core.SFLoginInput.getBooleanValue; import com.fasterxml.jackson.databind.JsonNode; @@ -15,12 +17,29 @@ import java.sql.DriverPropertyInfo; import java.sql.SQLException; import java.time.Duration; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import net.snowflake.client.config.SFClientConfig; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.DefaultSFConnectionHandler; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.QueryStatusV2; +import net.snowflake.client.jdbc.SnowflakeConnectString; +import net.snowflake.client.jdbc.SnowflakeReauthenticationRequest; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.jdbc.telemetry.TelemetryClient; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; diff --git a/src/main/java/net/snowflake/client/core/SFStatement.java b/src/main/java/net/snowflake/client/core/SFStatement.java index 5715da73a..1dd555bb5 100644 --- a/src/main/java/net/snowflake/client/core/SFStatement.java +++ b/src/main/java/net/snowflake/client/core/SFStatement.java @@ -4,13 +4,15 @@ package net.snowflake.client.core; -import static net.snowflake.client.core.SessionUtil.*; +import static net.snowflake.client.core.SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT; +import static net.snowflake.client.core.SessionUtil.DEFAULT_CLIENT_PREFETCH_THREADS; +import static net.snowflake.client.core.SessionUtil.MAX_CLIENT_CHUNK_SIZE; +import static net.snowflake.client.core.SessionUtil.MIN_CLIENT_CHUNK_SIZE; import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; import com.fasterxml.jackson.databind.JsonNode; import java.sql.SQLException; import java.sql.Statement; -import java.util.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -23,7 +25,13 @@ import net.snowflake.client.core.BasicEvent.QueryState; import net.snowflake.client.core.bind.BindException; import net.snowflake.client.core.bind.BindUploader; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.QueryStatusV2; +import net.snowflake.client.jdbc.SnowflakeDriver; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; +import net.snowflake.client.jdbc.SnowflakeReauthenticationRequest; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.client.jdbc.telemetry.TelemetryData; import net.snowflake.client.jdbc.telemetry.TelemetryField; import net.snowflake.client.jdbc.telemetry.TelemetryUtil; diff --git a/src/main/java/net/snowflake/client/core/SFTrustManager.java b/src/main/java/net/snowflake/client/core/SFTrustManager.java index b73b7f934..0f66f3ef6 100644 --- a/src/main/java/net/snowflake/client/core/SFTrustManager.java +++ b/src/main/java/net/snowflake/client/core/SFTrustManager.java @@ -24,16 +24,38 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.security.*; +import java.security.InvalidKeyException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.Signature; +import java.security.SignatureException; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.text.MessageFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import javax.net.ssl.*; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509ExtendedTrustManager; +import javax.net.ssl.X509TrustManager; import net.snowflake.client.jdbc.OCSPErrorCode; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; @@ -61,14 +83,31 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.ssl.SSLInitializationException; -import org.bouncycastle.asn1.*; +import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; +import org.bouncycastle.asn1.ASN1OctetString; +import org.bouncycastle.asn1.DEROctetString; +import org.bouncycastle.asn1.DLSequence; import org.bouncycastle.asn1.ocsp.CertID; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; -import org.bouncycastle.asn1.x509.*; +import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.Certificate; +import org.bouncycastle.asn1.x509.Extension; +import org.bouncycastle.asn1.x509.Extensions; +import org.bouncycastle.asn1.x509.GeneralName; +import org.bouncycastle.asn1.x509.TBSCertificate; import org.bouncycastle.cert.X509CertificateHolder; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.cert.ocsp.*; +import org.bouncycastle.cert.ocsp.BasicOCSPResp; +import org.bouncycastle.cert.ocsp.CertificateID; +import org.bouncycastle.cert.ocsp.CertificateStatus; +import org.bouncycastle.cert.ocsp.OCSPException; +import org.bouncycastle.cert.ocsp.OCSPReq; +import org.bouncycastle.cert.ocsp.OCSPReqBuilder; +import org.bouncycastle.cert.ocsp.OCSPResp; +import org.bouncycastle.cert.ocsp.RevokedStatus; +import org.bouncycastle.cert.ocsp.SingleResp; import org.bouncycastle.operator.DigestCalculator; /** diff --git a/src/main/java/net/snowflake/client/core/SecureStorageWindowsManager.java b/src/main/java/net/snowflake/client/core/SecureStorageWindowsManager.java index 4fadcfe29..f43952023 100644 --- a/src/main/java/net/snowflake/client/core/SecureStorageWindowsManager.java +++ b/src/main/java/net/snowflake/client/core/SecureStorageWindowsManager.java @@ -5,7 +5,11 @@ package net.snowflake.client.core; import com.google.common.base.Strings; -import com.sun.jna.*; +import com.sun.jna.Memory; +import com.sun.jna.Native; +import com.sun.jna.Pointer; +import com.sun.jna.Structure; +import com.sun.jna.WString; import com.sun.jna.platform.win32.WinBase.FILETIME; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.win32.StdCallLibrary; diff --git a/src/main/java/net/snowflake/client/core/SessionUtil.java b/src/main/java/net/snowflake/client/core/SessionUtil.java index e17459f7f..305b5b220 100644 --- a/src/main/java/net/snowflake/client/core/SessionUtil.java +++ b/src/main/java/net/snowflake/client/core/SessionUtil.java @@ -17,10 +17,21 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.security.PrivateKey; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeDriver; +import net.snowflake.client.jdbc.SnowflakeReauthenticationRequest; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; +import net.snowflake.client.jdbc.SnowflakeType; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; import net.snowflake.client.log.ArgSupplier; import net.snowflake.client.log.SFLogger; diff --git a/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java b/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java index 6e36f3adf..da7807b69 100644 --- a/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java +++ b/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java @@ -10,12 +10,23 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; -import java.net.*; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.jdbc.ErrorCode; import net.snowflake.client.jdbc.SnowflakeSQLException; import net.snowflake.client.log.SFLogger; diff --git a/src/main/java/net/snowflake/client/core/SessionUtilKeyPair.java b/src/main/java/net/snowflake/client/core/SessionUtilKeyPair.java index 8c27d2c44..7830b55db 100644 --- a/src/main/java/net/snowflake/client/core/SessionUtilKeyPair.java +++ b/src/main/java/net/snowflake/client/core/SessionUtilKeyPair.java @@ -17,7 +17,14 @@ import java.io.StringReader; import java.nio.file.Files; import java.nio.file.Paths; -import java.security.*; +import java.security.InvalidKeyException; +import java.security.KeyFactory; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.PublicKey; +import java.security.Security; import java.security.interfaces.RSAPrivateCrtKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; diff --git a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java index 9074a16bf..a902cb66a 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java @@ -6,12 +6,14 @@ import java.nio.ByteBuffer; import java.sql.Time; import java.sql.Timestamp; -import java.time.*; import java.util.TimeZone; import net.snowflake.client.core.DataConversionContext; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeTimestampWithTimezone; +import net.snowflake.client.jdbc.SnowflakeType; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.common.core.SFTime; import org.apache.arrow.vector.BigIntVector; import org.apache.arrow.vector.ValueVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java b/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java index 15d3fbc8f..d704e31bd 100644 --- a/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java @@ -10,7 +10,10 @@ import net.snowflake.client.core.DataConversionContext; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeTimestampWithTimezone; +import net.snowflake.client.jdbc.SnowflakeType; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.common.core.SFTime; import org.apache.arrow.vector.IntVector; import org.apache.arrow.vector.ValueVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java index cb7a18fa0..4c7f00d53 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java @@ -10,7 +10,11 @@ import net.snowflake.client.core.DataConversionContext; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeDateWithTimezone; +import net.snowflake.client.jdbc.SnowflakeTimeWithTimezone; +import net.snowflake.client.jdbc.SnowflakeType; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.common.core.SFTimestamp; import org.apache.arrow.vector.BigIntVector; import org.apache.arrow.vector.IntVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java index abd2d49b9..339f3c541 100644 --- a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java @@ -10,7 +10,11 @@ import net.snowflake.client.core.DataConversionContext; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeDateWithTimezone; +import net.snowflake.client.jdbc.SnowflakeTimeWithTimezone; +import net.snowflake.client.jdbc.SnowflakeType; +import net.snowflake.client.jdbc.SnowflakeUtil; import org.apache.arrow.vector.BigIntVector; import org.apache.arrow.vector.IntVector; import org.apache.arrow.vector.ValueVector; diff --git a/src/main/java/net/snowflake/client/core/bind/BindUploader.java b/src/main/java/net/snowflake/client/core/bind/BindUploader.java index 1763672dd..2332f0150 100644 --- a/src/main/java/net/snowflake/client/core/bind/BindUploader.java +++ b/src/main/java/net/snowflake/client/core/bind/BindUploader.java @@ -19,7 +19,12 @@ import java.time.Instant; import java.time.ZoneId; import java.time.ZoneOffset; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.core.ExecTimeTelemetryData; import net.snowflake.client.core.ParameterBindingDTO; import net.snowflake.client.core.SFBaseSession; diff --git a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java index 5d2661786..c4bf33241 100644 --- a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java +++ b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java @@ -13,12 +13,47 @@ import net.snowflake.client.core.DataConversionContext; import net.snowflake.client.core.SFBaseSession; import net.snowflake.client.core.SFException; -import net.snowflake.client.core.arrow.*; +import net.snowflake.client.core.arrow.ArrowResultChunkIndexSorter; +import net.snowflake.client.core.arrow.ArrowVectorConverter; +import net.snowflake.client.core.arrow.BigIntToFixedConverter; +import net.snowflake.client.core.arrow.BigIntToScaledFixedConverter; +import net.snowflake.client.core.arrow.BigIntToTimeConverter; +import net.snowflake.client.core.arrow.BigIntToTimestampLTZConverter; +import net.snowflake.client.core.arrow.BigIntToTimestampNTZConverter; +import net.snowflake.client.core.arrow.BitToBooleanConverter; +import net.snowflake.client.core.arrow.DateConverter; +import net.snowflake.client.core.arrow.DecimalToScaledFixedConverter; +import net.snowflake.client.core.arrow.DoubleToRealConverter; +import net.snowflake.client.core.arrow.IntToFixedConverter; +import net.snowflake.client.core.arrow.IntToScaledFixedConverter; +import net.snowflake.client.core.arrow.IntToTimeConverter; +import net.snowflake.client.core.arrow.SmallIntToFixedConverter; +import net.snowflake.client.core.arrow.SmallIntToScaledFixedConverter; +import net.snowflake.client.core.arrow.ThreeFieldStructToTimestampTZConverter; +import net.snowflake.client.core.arrow.TinyIntToFixedConverter; +import net.snowflake.client.core.arrow.TinyIntToScaledFixedConverter; +import net.snowflake.client.core.arrow.TwoFieldStructToTimestampLTZConverter; +import net.snowflake.client.core.arrow.TwoFieldStructToTimestampNTZConverter; +import net.snowflake.client.core.arrow.TwoFieldStructToTimestampTZConverter; +import net.snowflake.client.core.arrow.VarBinaryToBinaryConverter; +import net.snowflake.client.core.arrow.VarCharConverter; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.common.core.SqlState; import org.apache.arrow.memory.RootAllocator; -import org.apache.arrow.vector.*; +import org.apache.arrow.vector.BigIntVector; +import org.apache.arrow.vector.BitVector; +import org.apache.arrow.vector.DateDayVector; +import org.apache.arrow.vector.DecimalVector; +import org.apache.arrow.vector.FieldVector; +import org.apache.arrow.vector.Float8Vector; +import org.apache.arrow.vector.IntVector; +import org.apache.arrow.vector.SmallIntVector; +import org.apache.arrow.vector.TinyIntVector; +import org.apache.arrow.vector.ValueVector; +import org.apache.arrow.vector.VarBinaryVector; +import org.apache.arrow.vector.VarCharVector; +import org.apache.arrow.vector.VectorSchemaRoot; import org.apache.arrow.vector.complex.StructVector; import org.apache.arrow.vector.ipc.ArrowStreamReader; import org.apache.arrow.vector.types.Types; diff --git a/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java b/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java index 32c3b53ec..7ada3a803 100644 --- a/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java +++ b/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java @@ -8,15 +8,28 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.sql.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; +import java.sql.Statement; import java.util.Map; import java.util.Properties; import java.util.logging.Level; import net.snowflake.client.config.SFClientConfig; import net.snowflake.client.config.SFClientConfigParser; -import net.snowflake.client.core.*; +import net.snowflake.client.core.SFBaseResultSet; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFBaseStatement; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFSessionProperty; +import net.snowflake.client.core.SFStatement; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; -import net.snowflake.client.log.*; +import net.snowflake.client.log.JDK14Logger; +import net.snowflake.client.log.SFLogLevel; +import net.snowflake.client.log.SFLogger; +import net.snowflake.client.log.SFLoggerFactory; +import net.snowflake.client.log.SFToJavaLogMapper; import net.snowflake.common.core.LoginInfoDTO; /** diff --git a/src/main/java/net/snowflake/client/jdbc/RestRequest.java b/src/main/java/net/snowflake/client/jdbc/RestRequest.java index 3e57d2ff1..615b20894 100644 --- a/src/main/java/net/snowflake/client/jdbc/RestRequest.java +++ b/src/main/java/net/snowflake/client/jdbc/RestRequest.java @@ -11,7 +11,13 @@ import javax.net.ssl.SSLKeyException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLProtocolException; -import net.snowflake.client.core.*; +import net.snowflake.client.core.Event; +import net.snowflake.client.core.EventUtil; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.SFOCSPException; +import net.snowflake.client.core.SessionUtil; +import net.snowflake.client.core.UUIDUtils; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; import net.snowflake.client.log.ArgSupplier; import net.snowflake.client.log.SFLogger; diff --git a/src/main/java/net/snowflake/client/jdbc/SFAsyncResultSet.java b/src/main/java/net/snowflake/client/jdbc/SFAsyncResultSet.java index 8e2798db7..bc164de89 100644 --- a/src/main/java/net/snowflake/client/jdbc/SFAsyncResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SFAsyncResultSet.java @@ -8,7 +8,13 @@ import com.google.api.client.util.Strings; import java.math.BigDecimal; -import java.sql.*; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; import java.util.List; import java.util.TimeZone; import net.snowflake.client.core.QueryStatus; diff --git a/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java b/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java index 0066e46cd..64297ff57 100644 --- a/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java +++ b/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java @@ -1,6 +1,9 @@ package net.snowflake.client.jdbc; -import java.sql.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; +import java.sql.Statement; import java.util.Properties; import net.snowflake.client.core.SFBaseResultSet; import net.snowflake.client.core.SFBaseSession; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java index 521a00f07..0b5d7fe61 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java @@ -9,7 +9,21 @@ import java.io.StringReader; import java.math.BigDecimal; import java.net.URL; -import java.sql.*; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; import java.util.Calendar; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeBasicDataSource.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeBasicDataSource.java index 0c7991d3f..f1281d593 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeBasicDataSource.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeBasicDataSource.java @@ -1,7 +1,11 @@ package net.snowflake.client.jdbc; import com.google.common.base.Strings; -import java.io.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.Serializable; import java.security.PrivateKey; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java index a2bd4135e..ff9eb9003 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java @@ -9,13 +9,37 @@ import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.MappingJsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.nio.ByteBuffer; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import net.snowflake.client.core.*; +import net.snowflake.client.core.ChunkDownloader; +import net.snowflake.client.core.DownloaderMetrics; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.OCSPMode; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.QueryResultFormat; +import net.snowflake.client.core.SFArrowResultSet; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SessionUtil; import net.snowflake.client.jdbc.SnowflakeResultChunk.DownloadState; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; import net.snowflake.client.log.ArgSupplier; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectString.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectString.java index d79a57ebd..9d7da8071 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectString.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectString.java @@ -10,7 +10,11 @@ import java.net.URISyntaxException; import java.net.URLDecoder; import java.net.URLEncoder; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; import net.snowflake.client.core.SFSessionProperty; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java index 3f39bf285..0da7d44c8 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java @@ -10,8 +10,32 @@ import com.google.common.base.Strings; import java.io.IOException; import java.io.InputStream; -import java.sql.*; -import java.util.*; +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.ClientInfoStatus; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.DriverPropertyInfo; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java index ec1f7eb49..48b95e416 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java @@ -4,15 +4,38 @@ package net.snowflake.client.jdbc; -import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.*; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_CATALOGS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_COLUMNS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_COLUMNS_EXTENDED_SET; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_FOREIGN_KEYS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_FUNCTIONS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_FUNCTION_COLUMNS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_PRIMARY_KEYS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_PROCEDURES; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_PROCEDURE_COLUMNS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_SCHEMAS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_STREAMS; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_TABLES; +import static net.snowflake.client.jdbc.DBMetadataResultSetMetadata.GET_TABLE_PRIVILEGES; import static net.snowflake.client.jdbc.SnowflakeType.convertStringToType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Strings; -import java.sql.*; -import java.util.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.RowIdLifetime; +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.regex.Pattern; import net.snowflake.client.core.ObjectMapperFactory; import net.snowflake.client.core.SFBaseSession; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaDataResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaDataResultSet.java index bed368aba..456eed7d7 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaDataResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaDataResultSet.java @@ -7,7 +7,13 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.charset.StandardCharsets; -import java.sql.*; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.util.List; import java.util.TimeZone; import net.snowflake.client.core.SFBaseSession; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java index 65569717e..9ef6077c4 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java @@ -6,7 +6,12 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.sql.*; +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; import java.util.List; import java.util.Properties; import net.snowflake.common.core.ResourceBundleManager; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java index cf4996715..9a0f874bb 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java @@ -14,19 +14,54 @@ import com.google.common.base.Strings; import com.google.common.io.ByteStreams; import com.google.common.io.CountingOutputStream; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.security.DigestOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.*; +import java.util.Optional; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; -import net.snowflake.client.core.*; -import net.snowflake.client.jdbc.cloud.storage.*; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.OCSPMode; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFFixedViewResultSet; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFStatement; +import net.snowflake.client.jdbc.cloud.storage.SnowflakeStorageClient; +import net.snowflake.client.jdbc.cloud.storage.StageInfo; +import net.snowflake.client.jdbc.cloud.storage.StorageClientFactory; +import net.snowflake.client.jdbc.cloud.storage.StorageObjectMetadata; +import net.snowflake.client.jdbc.cloud.storage.StorageObjectSummary; +import net.snowflake.client.jdbc.cloud.storage.StorageObjectSummaryCollection; +import net.snowflake.client.jdbc.cloud.storage.StorageProviderException; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; import net.snowflake.client.log.ArgSupplier; import net.snowflake.client.log.SFLogger; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java index 5be0e53b1..b2dea22c0 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java @@ -9,10 +9,39 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URL; -import java.sql.*; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; import java.sql.Date; -import java.util.*; -import net.snowflake.client.core.*; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLXML; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.ParameterBindingDTO; +import net.snowflake.client.core.ResultUtil; +import net.snowflake.client.core.SFBaseResultSet; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFPreparedStatementMetaData; +import net.snowflake.client.core.StmtUtil; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.client.util.VariableTypeArray; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java index c99c38e8a..c0a9addea 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java @@ -6,7 +6,12 @@ import static net.snowflake.client.core.Constants.GB; import static net.snowflake.client.core.Constants.MB; -import static net.snowflake.client.core.SessionUtil.*; +import static net.snowflake.client.core.SessionUtil.CLIENT_ENABLE_CONSERVATIVE_MEMORY_USAGE; +import static net.snowflake.client.core.SessionUtil.CLIENT_MEMORY_LIMIT; +import static net.snowflake.client.core.SessionUtil.CLIENT_PREFETCH_THREADS; +import static net.snowflake.client.core.SessionUtil.CLIENT_RESULT_CHUNK_SIZE; +import static net.snowflake.client.core.SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT; +import static net.snowflake.client.core.SessionUtil.DEFAULT_CLIENT_PREFETCH_THREADS; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -16,8 +21,31 @@ import java.nio.channels.ClosedByInterruptException; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.*; -import net.snowflake.client.core.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.TimeZone; +import net.snowflake.client.core.ChunkDownloader; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.MetaDataOfBinds; +import net.snowflake.client.core.OCSPMode; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.QueryResultFormat; +import net.snowflake.client.core.ResultUtil; +import net.snowflake.client.core.SFArrowResultSet; +import net.snowflake.client.core.SFBaseResultSet; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFBaseStatement; +import net.snowflake.client.core.SFResultSet; +import net.snowflake.client.core.SFResultSetMetaData; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFStatementType; +import net.snowflake.client.core.SessionUtil; import net.snowflake.client.jdbc.telemetry.NoOpTelemetryClient; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.log.ArgSupplier; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index e1068799b..30938b0e4 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -8,7 +8,22 @@ import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.*; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; import java.util.Calendar; import java.util.List; import java.util.Map; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java index b4f67bcf2..a4c9100c3 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java @@ -6,10 +6,28 @@ import static net.snowflake.client.jdbc.ErrorCode.FEATURE_UNSUPPORTED; -import java.sql.*; -import java.util.*; +import java.sql.BatchUpdateException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLWarning; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import net.snowflake.client.core.*; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.ParameterBindingDTO; +import net.snowflake.client.core.ResultUtil; +import net.snowflake.client.core.SFBaseResultSet; +import net.snowflake.client.core.SFBaseStatement; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFStatement; +import net.snowflake.client.core.StmtUtil; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.client.util.VariableTypeArray; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java index 969373896..d7f30d614 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java @@ -5,7 +5,11 @@ package net.snowflake.client.jdbc; import java.math.BigDecimal; -import java.sql.*; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.text.DateFormat; import java.util.Date; import java.util.HashSet; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java index 7a25e1b0d..2856e15e2 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java @@ -8,14 +8,24 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.base.Strings; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; import java.lang.reflect.Field; import java.sql.Time; import java.sql.Types; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Random; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java index 4622e7cb5..be54535ff 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java @@ -10,18 +10,49 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.storage.*; -import com.microsoft.azure.storage.blob.*; -import java.io.*; +import com.microsoft.azure.storage.OperationContext; +import com.microsoft.azure.storage.StorageCredentials; +import com.microsoft.azure.storage.StorageCredentialsAnonymous; +import com.microsoft.azure.storage.StorageCredentialsSharedAccessSignature; +import com.microsoft.azure.storage.StorageException; +import com.microsoft.azure.storage.StorageExtendedErrorInformation; +import com.microsoft.azure.storage.blob.BlobListingDetails; +import com.microsoft.azure.storage.blob.BlobProperties; +import com.microsoft.azure.storage.blob.BlobRequestOptions; +import com.microsoft.azure.storage.blob.CloudBlob; +import com.microsoft.azure.storage.blob.CloudBlobClient; +import com.microsoft.azure.storage.blob.CloudBlobContainer; +import com.microsoft.azure.storage.blob.CloudBlockBlob; +import com.microsoft.azure.storage.blob.ListBlobItem; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.net.SocketTimeoutException; import java.net.URI; import java.net.URISyntaxException; import java.security.InvalidKeyException; -import java.util.*; +import java.util.AbstractMap; import java.util.AbstractMap.SimpleEntry; +import java.util.ArrayList; import java.util.Base64; -import net.snowflake.client.core.*; -import net.snowflake.client.jdbc.*; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFSessionProperty; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.FileBackedOutputStream; +import net.snowflake.client.jdbc.MatDesc; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.client.util.SFPair; diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java index b1acfd2bc..98040b91b 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java @@ -12,18 +12,45 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.api.gax.paging.Page; import com.google.api.gax.rpc.FixedHeaderProvider; -import com.google.cloud.storage.*; +import com.google.cloud.storage.Blob; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobInfo; +import com.google.cloud.storage.Storage; import com.google.cloud.storage.Storage.BlobListOption; +import com.google.cloud.storage.StorageException; +import com.google.cloud.storage.StorageOptions; import com.google.common.base.Strings; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.SocketTimeoutException; import java.net.URISyntaxException; import java.nio.channels.Channels; import java.security.InvalidKeyException; -import java.util.*; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; -import net.snowflake.client.core.*; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFSessionProperty; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.FileBackedOutputStream; +import net.snowflake.client.jdbc.MatDesc; +import net.snowflake.client.jdbc.RestRequest; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.log.ArgSupplier; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java index 86c571ee2..9ff35a247 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java @@ -22,12 +22,24 @@ import com.amazonaws.services.s3.AmazonS3Builder; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.AmazonS3EncryptionClient; -import com.amazonaws.services.s3.model.*; +import com.amazonaws.services.s3.model.AmazonS3Exception; +import com.amazonaws.services.s3.model.CryptoConfiguration; +import com.amazonaws.services.s3.model.CryptoMode; +import com.amazonaws.services.s3.model.EncryptionMaterials; +import com.amazonaws.services.s3.model.ObjectListing; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectRequest; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider; import com.amazonaws.services.s3.transfer.Download; import com.amazonaws.services.s3.transfer.TransferManager; import com.amazonaws.services.s3.transfer.TransferManagerBuilder; import com.amazonaws.services.s3.transfer.Upload; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.net.SocketTimeoutException; import java.security.InvalidKeyException; import java.security.KeyManagementException; @@ -40,8 +52,18 @@ import java.util.concurrent.ExecutorService; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; -import net.snowflake.client.core.*; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFSSLConnectionSocketFactory; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFSessionProperty; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.FileBackedOutputStream; +import net.snowflake.client.jdbc.MatDesc; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; +import net.snowflake.client.jdbc.SnowflakeUtil; import net.snowflake.client.log.SFLogger; import net.snowflake.client.log.SFLoggerFactory; import net.snowflake.client.util.SFPair; diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java index 1bd4127f6..2cd187dc3 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java @@ -8,7 +8,11 @@ import java.util.Map; import net.snowflake.client.core.HttpClientSettingsKey; import net.snowflake.client.core.SFSession; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.FileBackedOutputStream; +import net.snowflake.client.jdbc.MatDesc; +import net.snowflake.client.jdbc.SnowflakeSQLException; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.common.core.SqlState; /** diff --git a/src/main/java/net/snowflake/client/log/JDK14Logger.java b/src/main/java/net/snowflake/client/log/JDK14Logger.java index 7c0a98dc6..d70009e16 100644 --- a/src/main/java/net/snowflake/client/log/JDK14Logger.java +++ b/src/main/java/net/snowflake/client/log/JDK14Logger.java @@ -10,7 +10,12 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import java.util.logging.*; +import java.util.logging.ConsoleHandler; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; import net.snowflake.client.core.EventHandler; import net.snowflake.client.core.EventUtil; import net.snowflake.client.util.SecretDetector; diff --git a/src/main/java/net/snowflake/client/util/SecretDetector.java b/src/main/java/net/snowflake/client/util/SecretDetector.java index a7bce22d3..0d43ec725 100644 --- a/src/main/java/net/snowflake/client/util/SecretDetector.java +++ b/src/main/java/net/snowflake/client/util/SecretDetector.java @@ -9,7 +9,11 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import java.io.IOException; -import java.util.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.minidev.json.JSONArray; @@ -47,10 +51,14 @@ public class SecretDetector { + "([a-z0-9!\"#$%&'\\()*+,-./:;<=>?@\\[\\]^_`\\{|\\}~]{6,})", Pattern.CASE_INSENSITIVE); - // "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----" + // "-----BEGIN PRIVATE KEY----- // #pragma: allowlist secret + // [PRIVATE-KEY] + // -----END PRIVATE KEY-----" private static final Pattern PRIVATE_KEY_PATTERN = Pattern.compile( - "-----BEGIN PRIVATE KEY-----\\\\n([a-z0-9/+=\\\\n]{32,})\\\\n-----END PRIVATE KEY-----", + "-----BEGIN PRIVATE KEY-----" // #pragma: allowlist secret + + "\\\\n([a-z0-9/+=\\\\n]{32,})\\\\n" + + "-----END PRIVATE KEY-----", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); // "privateKeyData": "[PRIVATE-KEY]" @@ -233,7 +241,9 @@ public static String filterAccessTokens(String message) { if (gcsMatcher.find()) { message = gcsMatcher.replaceAll( - "-----BEGIN PRIVATE KEY-----\\\\nXXXX\\\\n-----END PRIVATE KEY-----"); + "-----BEGIN PRIVATE KEY-----" // #pragma: allowlist secret + + "\\\\nXXXX\\\\n" + + "-----END PRIVATE KEY-----"); } gcsMatcher = PRIVATE_KEY_DATA_PATTERN.matcher(message); diff --git a/src/test/java/net/snowflake/client/AbstractDriverIT.java b/src/test/java/net/snowflake/client/AbstractDriverIT.java index 7ec6243b2..7f762d48b 100644 --- a/src/test/java/net/snowflake/client/AbstractDriverIT.java +++ b/src/test/java/net/snowflake/client/AbstractDriverIT.java @@ -7,9 +7,18 @@ import com.google.common.base.Strings; import java.net.URL; -import java.sql.*; +import java.sql.Connection; import java.sql.Date; -import java.util.*; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; diff --git a/src/test/java/net/snowflake/client/config/SFClientConfigParserTest.java b/src/test/java/net/snowflake/client/config/SFClientConfigParserTest.java index 26a868ef7..a09c3036e 100644 --- a/src/test/java/net/snowflake/client/config/SFClientConfigParserTest.java +++ b/src/test/java/net/snowflake/client/config/SFClientConfigParserTest.java @@ -1,8 +1,15 @@ package net.snowflake.client.config; -import static net.snowflake.client.config.SFClientConfigParser.*; -import static net.snowflake.client.jdbc.SnowflakeUtil.*; -import static org.junit.Assert.*; +import static net.snowflake.client.config.SFClientConfigParser.SF_CLIENT_CONFIG_ENV_NAME; +import static net.snowflake.client.config.SFClientConfigParser.SF_CLIENT_CONFIG_FILE_NAME; +import static net.snowflake.client.config.SFClientConfigParser.getConfigFilePathFromJDBCJarLocation; +import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; +import static net.snowflake.client.jdbc.SnowflakeUtil.systemSetEnv; +import static net.snowflake.client.jdbc.SnowflakeUtil.systemUnsetEnv; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Mockito.mockStatic; import java.io.IOException; diff --git a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java index d89eb01ed..598ffcdc0 100644 --- a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java +++ b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java @@ -4,7 +4,10 @@ package net.snowflake.client.core; import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; diff --git a/src/test/java/net/snowflake/client/core/SFArrowResultSetIT.java b/src/test/java/net/snowflake/client/core/SFArrowResultSetIT.java index 63200c70f..8e034675d 100644 --- a/src/test/java/net/snowflake/client/core/SFArrowResultSetIT.java +++ b/src/test/java/net/snowflake/client/core/SFArrowResultSetIT.java @@ -10,21 +10,49 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.time.Instant; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.SkipOnThinJar; import net.snowflake.client.category.TestCategoryArrow; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.ArrowResultChunk; +import net.snowflake.client.jdbc.ErrorCode; +import net.snowflake.client.jdbc.SnowflakeResultChunk; +import net.snowflake.client.jdbc.SnowflakeResultSet; +import net.snowflake.client.jdbc.SnowflakeResultSetSerializable; +import net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1; +import net.snowflake.client.jdbc.SnowflakeSQLException; import net.snowflake.client.jdbc.telemetry.NoOpTelemetryClient; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.RootAllocator; -import org.apache.arrow.vector.*; +import org.apache.arrow.vector.BigIntVector; +import org.apache.arrow.vector.BitVector; +import org.apache.arrow.vector.DateDayVector; +import org.apache.arrow.vector.DecimalVector; +import org.apache.arrow.vector.FieldVector; +import org.apache.arrow.vector.Float8Vector; +import org.apache.arrow.vector.IntVector; +import org.apache.arrow.vector.SmallIntVector; +import org.apache.arrow.vector.TinyIntVector; +import org.apache.arrow.vector.VarBinaryVector; +import org.apache.arrow.vector.VarCharVector; +import org.apache.arrow.vector.VectorSchemaRoot; import org.apache.arrow.vector.complex.StructVector; import org.apache.arrow.vector.dictionary.DictionaryProvider; import org.apache.arrow.vector.ipc.ArrowStreamWriter; diff --git a/src/test/java/net/snowflake/client/core/SFTrustManagerMockitoMockLatestIT.java b/src/test/java/net/snowflake/client/core/SFTrustManagerMockitoMockLatestIT.java index 3d6854beb..862f4867e 100644 --- a/src/test/java/net/snowflake/client/core/SFTrustManagerMockitoMockLatestIT.java +++ b/src/test/java/net/snowflake/client/core/SFTrustManagerMockitoMockLatestIT.java @@ -5,7 +5,9 @@ package net.snowflake.client.core; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; diff --git a/src/test/java/net/snowflake/client/core/SecureStorageManagerTest.java b/src/test/java/net/snowflake/client/core/SecureStorageManagerTest.java index 6cf964883..b6f8a16ac 100644 --- a/src/test/java/net/snowflake/client/core/SecureStorageManagerTest.java +++ b/src/test/java/net/snowflake/client/core/SecureStorageManagerTest.java @@ -4,7 +4,10 @@ package net.snowflake.client.core; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.sun.jna.Memory; diff --git a/src/test/java/net/snowflake/client/core/SessionUtilExternalBrowserTest.java b/src/test/java/net/snowflake/client/core/SessionUtilExternalBrowserTest.java index 0092b925f..15ac840d8 100644 --- a/src/test/java/net/snowflake/client/core/SessionUtilExternalBrowserTest.java +++ b/src/test/java/net/snowflake/client/core/SessionUtilExternalBrowserTest.java @@ -5,8 +5,13 @@ package net.snowflake.client.core; import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java b/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java index e38fb451b..f3e60f56b 100644 --- a/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java +++ b/src/test/java/net/snowflake/client/core/SessionUtilLatestIT.java @@ -8,7 +8,10 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/src/test/java/net/snowflake/client/core/SessionUtilTest.java b/src/test/java/net/snowflake/client/core/SessionUtilTest.java index e3ef60014..5cb118c56 100644 --- a/src/test/java/net/snowflake/client/core/SessionUtilTest.java +++ b/src/test/java/net/snowflake/client/core/SessionUtilTest.java @@ -5,7 +5,9 @@ package net.snowflake.client.core; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import com.fasterxml.jackson.databind.node.BooleanNode; import java.net.URI; diff --git a/src/test/java/net/snowflake/client/core/StmtUtilTest.java b/src/test/java/net/snowflake/client/core/StmtUtilTest.java index 5b7e2703b..75daa9a03 100644 --- a/src/test/java/net/snowflake/client/core/StmtUtilTest.java +++ b/src/test/java/net/snowflake/client/core/StmtUtilTest.java @@ -4,7 +4,9 @@ package net.snowflake.client.core; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; import java.util.HashMap; import java.util.Map; diff --git a/src/test/java/net/snowflake/client/core/URLUtilTest.java b/src/test/java/net/snowflake/client/core/URLUtilTest.java index f2ef78691..b61324eee 100644 --- a/src/test/java/net/snowflake/client/core/URLUtilTest.java +++ b/src/test/java/net/snowflake/client/core/URLUtilTest.java @@ -3,7 +3,9 @@ */ package net.snowflake.client.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/src/test/java/net/snowflake/client/core/arrow/BigIntToFixedConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/BigIntToFixedConverterTest.java index 6d48e62f3..74eabad29 100644 --- a/src/test/java/net/snowflake/client/core/arrow/BigIntToFixedConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/BigIntToFixedConverterTest.java @@ -3,14 +3,23 @@ */ package net.snowflake.client.core.arrow; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.nio.ByteBuffer; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import org.apache.arrow.memory.BufferAllocator; diff --git a/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverterTest.java index 330bc08f7..26fdbc052 100644 --- a/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverterTest.java @@ -4,7 +4,9 @@ package net.snowflake.client.core.arrow; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -12,7 +14,11 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverterTest.java index 79e316232..df4370641 100644 --- a/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverterTest.java @@ -4,7 +4,9 @@ package net.snowflake.client.core.arrow; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -12,7 +14,12 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/DateConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/DateConverterTest.java index 097c8e612..3a406a147 100644 --- a/src/test/java/net/snowflake/client/core/arrow/DateConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/DateConverterTest.java @@ -7,7 +7,12 @@ import static org.junit.Assert.assertTrue; import java.sql.Date; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import org.apache.arrow.memory.BufferAllocator; diff --git a/src/test/java/net/snowflake/client/core/arrow/IntToFixedConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/IntToFixedConverterTest.java index 4a14672d5..c11d8275d 100644 --- a/src/test/java/net/snowflake/client/core/arrow/IntToFixedConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/IntToFixedConverterTest.java @@ -3,13 +3,24 @@ */ package net.snowflake.client.core.arrow; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.nio.ByteBuffer; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import net.snowflake.client.jdbc.ErrorCode; diff --git a/src/test/java/net/snowflake/client/core/arrow/SmallIntToFixedConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/SmallIntToFixedConverterTest.java index 3ab96fbc7..5513a420b 100644 --- a/src/test/java/net/snowflake/client/core/arrow/SmallIntToFixedConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/SmallIntToFixedConverterTest.java @@ -3,13 +3,24 @@ */ package net.snowflake.client.core.arrow; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.nio.ByteBuffer; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import net.snowflake.client.jdbc.ErrorCode; diff --git a/src/test/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverterTest.java index 5a57118c9..10721fbc1 100644 --- a/src/test/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverterTest.java @@ -13,7 +13,13 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/TinyIntToFixedConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/TinyIntToFixedConverterTest.java index e571dcce4..8000ec885 100644 --- a/src/test/java/net/snowflake/client/core/arrow/TinyIntToFixedConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/TinyIntToFixedConverterTest.java @@ -6,10 +6,19 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import net.snowflake.client.jdbc.ErrorCode; diff --git a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverterTest.java index 390b82b2a..8ce93fb6a 100644 --- a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverterTest.java @@ -13,7 +13,13 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverterTest.java index fc419e80b..2b5bf0e16 100644 --- a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverterTest.java @@ -13,7 +13,14 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampTZConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampTZConverterTest.java index 84c2714c0..742b82751 100644 --- a/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampTZConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampTZConverterTest.java @@ -13,7 +13,13 @@ import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; import net.snowflake.client.TestUtil; import net.snowflake.client.core.ResultUtil; import net.snowflake.client.core.SFException; diff --git a/src/test/java/net/snowflake/client/core/arrow/VarCharConverterTest.java b/src/test/java/net/snowflake/client/core/arrow/VarCharConverterTest.java index 77bcef798..6569c0309 100644 --- a/src/test/java/net/snowflake/client/core/arrow/VarCharConverterTest.java +++ b/src/test/java/net/snowflake/client/core/arrow/VarCharConverterTest.java @@ -11,7 +11,14 @@ import java.nio.charset.StandardCharsets; import java.sql.Date; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TimeZone; import net.snowflake.client.TestUtil; import net.snowflake.client.core.SFException; import org.apache.arrow.memory.BufferAllocator; diff --git a/src/test/java/net/snowflake/client/jdbc/BaseJDBCTest.java b/src/test/java/net/snowflake/client/jdbc/BaseJDBCTest.java index b3c763001..b8bacc82b 100644 --- a/src/test/java/net/snowflake/client/jdbc/BaseJDBCTest.java +++ b/src/test/java/net/snowflake/client/jdbc/BaseJDBCTest.java @@ -12,10 +12,26 @@ import java.io.OutputStream; import java.io.Reader; import java.io.Writer; -import java.sql.*; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.RowId; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLXML; +import java.sql.Statement; import java.time.LocalDateTime; import java.time.ZonedDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Map; +import java.util.UUID; import javax.xml.transform.Result; import javax.xml.transform.Source; import net.snowflake.client.AbstractDriverIT; diff --git a/src/test/java/net/snowflake/client/jdbc/BindUploaderIT.java b/src/test/java/net/snowflake/client/jdbc/BindUploaderIT.java index 9e8270474..dec8bd6aa 100644 --- a/src/test/java/net/snowflake/client/jdbc/BindUploaderIT.java +++ b/src/test/java/net/snowflake/client/jdbc/BindUploaderIT.java @@ -4,17 +4,31 @@ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; -import java.sql.*; +import java.sql.Connection; import java.sql.Date; -import java.util.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; import net.snowflake.client.category.TestCategoryOthers; import net.snowflake.client.core.ParameterBindingDTO; import net.snowflake.client.core.SFSession; import net.snowflake.client.core.bind.BindUploader; -import org.junit.*; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; import org.junit.experimental.categories.Category; @Category(TestCategoryOthers.class) diff --git a/src/test/java/net/snowflake/client/jdbc/BindUploaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/BindUploaderLatestIT.java index cf87d7438..41c409d8b 100644 --- a/src/test/java/net/snowflake/client/jdbc/BindUploaderLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/BindUploaderLatestIT.java @@ -3,7 +3,15 @@ */ package net.snowflake.client.jdbc; -import static net.snowflake.client.jdbc.BindUploaderIT.*; +import static net.snowflake.client.jdbc.BindUploaderIT.SELECT_FROM_STAGE; +import static net.snowflake.client.jdbc.BindUploaderIT.STAGE_DIR; +import static net.snowflake.client.jdbc.BindUploaderIT.bind; +import static net.snowflake.client.jdbc.BindUploaderIT.csv1; +import static net.snowflake.client.jdbc.BindUploaderIT.csv2; +import static net.snowflake.client.jdbc.BindUploaderIT.dummyInsert; +import static net.snowflake.client.jdbc.BindUploaderIT.getBindings; +import static net.snowflake.client.jdbc.BindUploaderIT.parseRow; +import static net.snowflake.client.jdbc.BindUploaderIT.row1; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -17,7 +25,11 @@ import net.snowflake.client.core.ParameterBindingDTO; import net.snowflake.client.core.SFSession; import net.snowflake.client.core.bind.BindUploader; -import org.junit.*; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; import org.junit.experimental.categories.Category; /** diff --git a/src/test/java/net/snowflake/client/jdbc/BindingDataLatestIT.java b/src/test/java/net/snowflake/client/jdbc/BindingDataLatestIT.java index dcfaaecb1..257759120 100644 --- a/src/test/java/net/snowflake/client/jdbc/BindingDataLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/BindingDataLatestIT.java @@ -5,9 +5,14 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; - -import java.sql.*; +import static org.junit.Assert.assertEquals; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; import java.util.Calendar; import java.util.TimeZone; import net.snowflake.client.AbstractDriverIT; diff --git a/src/test/java/net/snowflake/client/jdbc/CallableStatementIT.java b/src/test/java/net/snowflake/client/jdbc/CallableStatementIT.java index 0d7c4c5d9..0db221c03 100644 --- a/src/test/java/net/snowflake/client/jdbc/CallableStatementIT.java +++ b/src/test/java/net/snowflake/client/jdbc/CallableStatementIT.java @@ -9,7 +9,15 @@ import java.math.BigDecimal; import java.net.URL; -import java.sql.*; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.util.Calendar; import java.util.HashMap; import net.snowflake.client.category.TestCategoryStatement; diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java index 689af8822..14b9f2d71 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java @@ -4,14 +4,35 @@ package net.snowflake.client.jdbc; import static net.snowflake.client.core.SessionUtil.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.junit.Assume.assumeTrue; -import java.io.*; -import java.security.*; -import java.sql.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Statement; import java.util.Collections; import java.util.Enumeration; import java.util.Map; diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java index 9f0842ff6..d91e8c3a3 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java @@ -4,20 +4,37 @@ package net.snowflake.client.jdbc; import static net.snowflake.client.core.SessionUtil.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY; -import static net.snowflake.client.jdbc.ConnectionIT.*; +import static net.snowflake.client.jdbc.ConnectionIT.BAD_REQUEST_GS_CODE; +import static net.snowflake.client.jdbc.ConnectionIT.INVALID_CONNECTION_INFO_CODE; +import static net.snowflake.client.jdbc.ConnectionIT.WAIT_FOR_TELEMETRY_REPORT_IN_MILLISECS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.AnyOf.anyOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.time.Duration; import java.util.Collections; import java.util.Enumeration; @@ -28,7 +45,12 @@ import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.TestUtil; import net.snowflake.client.category.TestCategoryConnection; -import net.snowflake.client.core.*; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.ObjectMapperFactory; +import net.snowflake.client.core.QueryStatus; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SessionUtil; import net.snowflake.client.jdbc.telemetryOOB.TelemetryService; import net.snowflake.common.core.ClientAuthnDTO; import net.snowflake.common.core.ClientAuthnParameter; diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionWithOCSPModeIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionWithOCSPModeIT.java index 03a58517f..00978b0d5 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionWithOCSPModeIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionWithOCSPModeIT.java @@ -4,10 +4,13 @@ package net.snowflake.client.jdbc; import static net.snowflake.client.jdbc.ErrorCode.NETWORK_ERROR; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; import java.net.SocketTimeoutException; import java.security.cert.CertificateExpiredException; diff --git a/src/test/java/net/snowflake/client/jdbc/CustomProxyLatestIT.java b/src/test/java/net/snowflake/client/jdbc/CustomProxyLatestIT.java index b8379f985..719257871 100644 --- a/src/test/java/net/snowflake/client/jdbc/CustomProxyLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/CustomProxyLatestIT.java @@ -13,7 +13,11 @@ import java.io.File; import java.net.Authenticator; import java.net.PasswordAuthentication; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Properties; import net.snowflake.client.category.TestCategoryOthers; import net.snowflake.client.core.HttpClientSettingsKey; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataIT.java index 81a63ba2d..a5267eea5 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataIT.java @@ -8,10 +8,21 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.hasItem; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.google.common.base.Strings; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Statement; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalIT.java index 458c4eaaf..be0bfac66 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalIT.java @@ -3,9 +3,16 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; - -import java.sql.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.category.TestCategoryOthers; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalLatestIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalLatestIT.java index 273bfdafb..cdc50ab35 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataInternalLatestIT.java @@ -5,7 +5,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java index 9c5743c9d..c6f075264 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java @@ -4,12 +4,26 @@ package net.snowflake.client.jdbc; import static net.snowflake.client.jdbc.DatabaseMetaDataIT.verifyResultSetMetaDataColumns; -import static net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.*; +import static net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.NumericFunctionsSupported; +import static net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.StringFunctionsSupported; +import static net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.SystemFunctionsSupported; import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.lang.reflect.Field; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.HashSet; import java.util.Map; import java.util.Properties; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java index c7acff14c..6d31b3a63 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java @@ -5,7 +5,11 @@ import static org.junit.Assert.assertEquals; -import java.sql.*; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.Arrays; import java.util.List; import org.junit.Test; diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultsetIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultsetIT.java index c1c057fb0..5da6af6f8 100644 --- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultsetIT.java +++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultsetIT.java @@ -3,10 +3,19 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; -import java.sql.*; +import java.sql.Connection; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.util.Arrays; import java.util.List; import net.snowflake.client.category.TestCategoryOthers; diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java index 9f329b01c..02ef84747 100644 --- a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java +++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java @@ -3,7 +3,8 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.io.InputStream; diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java index 443e868d3..ac1ffe249 100644 --- a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java @@ -5,17 +5,30 @@ import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty; import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.amazonaws.services.s3.model.ObjectMetadata; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.security.NoSuchAlgorithmException; -import java.sql.*; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.List; import java.util.Map; import java.util.Properties; @@ -25,7 +38,13 @@ import net.snowflake.client.core.OCSPMode; import net.snowflake.client.core.SFSession; import net.snowflake.client.core.SFStatement; -import net.snowflake.client.jdbc.cloud.storage.*; +import net.snowflake.client.jdbc.cloud.storage.S3StorageObjectMetadata; +import net.snowflake.client.jdbc.cloud.storage.SnowflakeGCSClient; +import net.snowflake.client.jdbc.cloud.storage.SnowflakeStorageClient; +import net.snowflake.client.jdbc.cloud.storage.StageInfo; +import net.snowflake.client.jdbc.cloud.storage.StorageClientFactory; +import net.snowflake.client.jdbc.cloud.storage.StorageObjectMetadata; +import net.snowflake.client.jdbc.cloud.storage.StorageProviderException; import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial; import org.apache.commons.io.FileUtils; import org.junit.Assert; diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java index 9bf765da3..822ce8e92 100644 --- a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java +++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java @@ -7,7 +7,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.snowflake.client.jdbc.cloud.storage.StageInfo; import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial; import org.junit.Assert; diff --git a/src/test/java/net/snowflake/client/jdbc/HeartbeatAsyncLatestIT.java b/src/test/java/net/snowflake/client/jdbc/HeartbeatAsyncLatestIT.java index 3c23b2591..0b04c2ec3 100644 --- a/src/test/java/net/snowflake/client/jdbc/HeartbeatAsyncLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/HeartbeatAsyncLatestIT.java @@ -1,6 +1,8 @@ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/HeartbeatIT.java b/src/test/java/net/snowflake/client/jdbc/HeartbeatIT.java index 26ce21409..c0863d3b5 100644 --- a/src/test/java/net/snowflake/client/jdbc/HeartbeatIT.java +++ b/src/test/java/net/snowflake/client/jdbc/HeartbeatIT.java @@ -5,9 +5,16 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.*; - -import java.sql.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Properties; diff --git a/src/test/java/net/snowflake/client/jdbc/MockConnectionTest.java b/src/test/java/net/snowflake/client/jdbc/MockConnectionTest.java index 18ad2eb8c..65163a938 100644 --- a/src/test/java/net/snowflake/client/jdbc/MockConnectionTest.java +++ b/src/test/java/net/snowflake/client/jdbc/MockConnectionTest.java @@ -1,6 +1,8 @@ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; @@ -10,13 +12,41 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.sql.*; -import java.util.*; +import java.sql.Connection; +import java.sql.DriverPropertyInfo; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLNonTransientConnectionException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.TimeZone; import java.util.concurrent.Future; import java.util.stream.Collectors; import java.util.stream.IntStream; import net.snowflake.client.category.TestCategoryConnection; -import net.snowflake.client.core.*; +import net.snowflake.client.core.ExecTimeTelemetryData; +import net.snowflake.client.core.ParameterBindingDTO; +import net.snowflake.client.core.QueryContextDTO; +import net.snowflake.client.core.QueryStatus; +import net.snowflake.client.core.ResultUtil; +import net.snowflake.client.core.SFBaseResultSet; +import net.snowflake.client.core.SFBaseSession; +import net.snowflake.client.core.SFBaseStatement; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFJsonResultSet; +import net.snowflake.client.core.SFPreparedStatementMetaData; +import net.snowflake.client.core.SFResultSetMetaData; +import net.snowflake.client.core.SFSession; +import net.snowflake.client.core.SFStatementType; +import net.snowflake.client.core.SessionUtil; import net.snowflake.client.core.json.Converters; import net.snowflake.client.jdbc.telemetry.Telemetry; import net.snowflake.client.jdbc.telemetry.TelemetryData; diff --git a/src/test/java/net/snowflake/client/jdbc/MultiStatementIT.java b/src/test/java/net/snowflake/client/jdbc/MultiStatementIT.java index a2a1ca917..e12c3c5fb 100644 --- a/src/test/java/net/snowflake/client/jdbc/MultiStatementIT.java +++ b/src/test/java/net/snowflake/client/jdbc/MultiStatementIT.java @@ -6,7 +6,11 @@ import static net.snowflake.client.ConditionalIgnoreRule.ConditionalIgnore; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/MultiStatementLatestIT.java b/src/test/java/net/snowflake/client/jdbc/MultiStatementLatestIT.java index 567abddfa..c4e91e872 100644 --- a/src/test/java/net/snowflake/client/jdbc/MultiStatementLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/MultiStatementLatestIT.java @@ -3,7 +3,11 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/OpenGroupCLIFuncIT.java b/src/test/java/net/snowflake/client/jdbc/OpenGroupCLIFuncIT.java index 45843b699..d34cc4bc9 100644 --- a/src/test/java/net/snowflake/client/jdbc/OpenGroupCLIFuncIT.java +++ b/src/test/java/net/snowflake/client/jdbc/OpenGroupCLIFuncIT.java @@ -3,7 +3,8 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/PreparedStatement1IT.java b/src/test/java/net/snowflake/client/jdbc/PreparedStatement1IT.java index 0fd046460..bd23d803d 100644 --- a/src/test/java/net/snowflake/client/jdbc/PreparedStatement1IT.java +++ b/src/test/java/net/snowflake/client/jdbc/PreparedStatement1IT.java @@ -6,9 +6,23 @@ import static net.snowflake.client.jdbc.ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; - -import java.sql.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.util.Map; import java.util.Properties; import net.snowflake.client.ConditionalIgnoreRule; diff --git a/src/test/java/net/snowflake/client/jdbc/PreparedStatement1LatestIT.java b/src/test/java/net/snowflake/client/jdbc/PreparedStatement1LatestIT.java index b2473219f..52b4f4518 100644 --- a/src/test/java/net/snowflake/client/jdbc/PreparedStatement1LatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/PreparedStatement1LatestIT.java @@ -4,10 +4,19 @@ package net.snowflake.client.jdbc; import static net.snowflake.client.jdbc.PreparedStatement1IT.bindOneParamSet; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.math.BigInteger; -import java.sql.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.category.TestCategoryStatement; diff --git a/src/test/java/net/snowflake/client/jdbc/PreparedStatement2LatestIT.java b/src/test/java/net/snowflake/client/jdbc/PreparedStatement2LatestIT.java index a034aed0c..84e5f20ea 100644 --- a/src/test/java/net/snowflake/client/jdbc/PreparedStatement2LatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/PreparedStatement2LatestIT.java @@ -6,9 +6,16 @@ import static net.snowflake.client.jdbc.PreparedStatement1IT.bindOneParamSet; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; - -import java.sql.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.category.TestCategoryStatement; diff --git a/src/test/java/net/snowflake/client/jdbc/PutUnescapeBackslashIT.java b/src/test/java/net/snowflake/client/jdbc/PutUnescapeBackslashIT.java index 8dcc9b374..e27bf02a2 100644 --- a/src/test/java/net/snowflake/client/jdbc/PutUnescapeBackslashIT.java +++ b/src/test/java/net/snowflake/client/jdbc/PutUnescapeBackslashIT.java @@ -3,7 +3,7 @@ */ package net.snowflake.client.jdbc; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; import java.io.BufferedWriter; diff --git a/src/test/java/net/snowflake/client/jdbc/RestRequestTest.java b/src/test/java/net/snowflake/client/jdbc/RestRequestTest.java index dc00d053a..0654cc73d 100644 --- a/src/test/java/net/snowflake/client/jdbc/RestRequestTest.java +++ b/src/test/java/net/snowflake/client/jdbc/RestRequestTest.java @@ -5,8 +5,12 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.IOException; import java.net.SocketTimeoutException; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetAlreadyClosedIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetAlreadyClosedIT.java index 0949c67f9..40e536ebe 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetAlreadyClosedIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetAlreadyClosedIT.java @@ -3,7 +3,8 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.sql.Connection; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncIT.java index ff9df32ca..832b353a2 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncIT.java @@ -4,11 +4,25 @@ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.Reader; import java.math.BigDecimal; -import java.sql.*; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.List; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncLatestIT.java index e2996668c..e5dc110ce 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetAsyncLatestIT.java @@ -6,7 +6,11 @@ import static org.junit.Assert.assertEquals; -import java.sql.*; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; import net.snowflake.client.category.TestCategoryResultSet; import org.junit.Test; import org.junit.experimental.categories.Category; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetIT.java index cb79ef7d2..e521078c6 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetIT.java @@ -3,16 +3,32 @@ */ package net.snowflake.client.jdbc; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; -import java.sql.*; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.Properties; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetJsonVsArrowIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetJsonVsArrowIT.java index 232a2115c..5a13d368e 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetJsonVsArrowIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetJsonVsArrowIT.java @@ -4,11 +4,24 @@ package net.snowflake.client.jdbc; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.math.BigDecimal; import java.nio.ByteBuffer; -import java.sql.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.sql.Types; import java.util.Arrays; import java.util.List; import java.util.TimeZone; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java index 0261e71ce..68e6d512f 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java @@ -5,7 +5,12 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.fasterxml.jackson.databind.JsonNode; import java.lang.reflect.Field; @@ -13,8 +18,25 @@ import java.math.BigInteger; import java.math.RoundingMode; import java.nio.ByteBuffer; -import java.sql.*; -import java.util.*; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.TimeZone; import java.util.concurrent.ExecutionException; import java.util.regex.Pattern; import net.snowflake.client.ConditionalIgnoreRule; @@ -24,7 +46,11 @@ import net.snowflake.client.core.ObjectMapperFactory; import net.snowflake.client.core.SFBaseSession; import net.snowflake.client.core.SessionUtil; -import net.snowflake.client.jdbc.telemetry.*; +import net.snowflake.client.jdbc.telemetry.Telemetry; +import net.snowflake.client.jdbc.telemetry.TelemetryClient; +import net.snowflake.client.jdbc.telemetry.TelemetryData; +import net.snowflake.client.jdbc.telemetry.TelemetryField; +import net.snowflake.client.jdbc.telemetry.TelemetryUtil; import net.snowflake.common.core.SFBinary; import org.apache.arrow.vector.Float8Vector; import org.junit.Test; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneIT.java index 3d630db2e..1ed7d09ea 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneIT.java @@ -5,12 +5,27 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; -import java.sql.*; +import java.sql.Connection; import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.category.TestCategoryResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneLatestIT.java index 3b1b930b5..3720b9ae5 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetMultiTimeZoneLatestIT.java @@ -2,10 +2,19 @@ import static org.junit.Assert.assertEquals; -import java.sql.*; +import java.sql.Connection; import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.List; +import java.util.TimeZone; import net.snowflake.client.ConditionalIgnoreRule; import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.category.TestCategoryResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/SSOConnectionTest.java b/src/test/java/net/snowflake/client/jdbc/SSOConnectionTest.java index 6a945fcc9..51c9179b4 100644 --- a/src/test/java/net/snowflake/client/jdbc/SSOConnectionTest.java +++ b/src/test/java/net/snowflake/client/jdbc/SSOConnectionTest.java @@ -7,11 +7,20 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.nullable; +import static org.mockito.Mockito.when; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringWriter; import java.net.ServerSocket; import java.net.Socket; import java.net.URI; @@ -20,7 +29,12 @@ import java.sql.DriverManager; import java.util.ArrayList; import java.util.Properties; -import net.snowflake.client.core.*; +import net.snowflake.client.core.HttpClientSettingsKey; +import net.snowflake.client.core.HttpUtil; +import net.snowflake.client.core.SFException; +import net.snowflake.client.core.SFLoginInput; +import net.snowflake.client.core.SessionUtil; +import net.snowflake.client.core.SessionUtilExternalBrowser; import net.snowflake.common.core.ClientAuthnDTO; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.HttpPost; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeAzureClientHandleExceptionLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeAzureClientHandleExceptionLatestIT.java index d562cff34..c0c5dc18d 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeAzureClientHandleExceptionLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeAzureClientHandleExceptionLatestIT.java @@ -20,7 +20,11 @@ import net.snowflake.client.core.SFSession; import net.snowflake.client.core.SFStatement; import net.snowflake.client.jdbc.cloud.storage.SnowflakeAzureClient; -import org.junit.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeClobTest.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeClobTest.java index b8db8f1bc..fa3d4de6e 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeClobTest.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeClobTest.java @@ -3,7 +3,9 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.io.InputStream; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverIT.java index 92e737ccd..1501f58ea 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverIT.java @@ -5,16 +5,44 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; import java.math.BigDecimal; import java.nio.channels.FileChannel; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.sql.Types; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.TimeZone; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; @@ -28,7 +56,11 @@ import net.snowflake.common.core.ClientAuthnDTO; import net.snowflake.common.core.SqlState; import org.apache.commons.io.FileUtils; -import org.junit.*; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java index 5e091a487..1a307ffb3 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java @@ -7,14 +7,32 @@ import static net.snowflake.client.jdbc.SnowflakeDriver.implementVersion; import static net.snowflake.client.jdbc.SnowflakeDriverIT.findFile; import static net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1.mapper; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.fasterxml.jackson.databind.JsonNode; import com.google.cloud.storage.StorageException; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; import java.nio.channels.FileChannel; import java.nio.charset.StandardCharsets; -import java.sql.*; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.Arrays; import java.util.List; import java.util.Properties; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverTest.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverTest.java index ead351cbc..b67f99a96 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverTest.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverTest.java @@ -4,10 +4,21 @@ package net.snowflake.client.jdbc; import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; import org.junit.Test; /** Driver unit test */ diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeGcsClientHandleExceptionLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeGcsClientHandleExceptionLatestIT.java index effa3c9c1..22c26465d 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeGcsClientHandleExceptionLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeGcsClientHandleExceptionLatestIT.java @@ -17,7 +17,11 @@ import net.snowflake.client.core.SFSession; import net.snowflake.client.core.SFStatement; import net.snowflake.client.jdbc.cloud.storage.SnowflakeGCSClient; -import org.junit.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableIT.java index 4ff18e4fd..20f986542 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableIT.java @@ -1,10 +1,21 @@ package net.snowflake.client.jdbc; import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.*; - -import java.io.*; -import java.sql.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Properties; diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeS3ClientHandleExceptionLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeS3ClientHandleExceptionLatestIT.java index 523475251..aed4d1f39 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeS3ClientHandleExceptionLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeS3ClientHandleExceptionLatestIT.java @@ -24,7 +24,11 @@ import net.snowflake.client.core.SFStatement; import net.snowflake.client.jdbc.cloud.storage.SnowflakeS3Client; import net.snowflake.client.jdbc.cloud.storage.StageInfo; -import org.junit.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; diff --git a/src/test/java/net/snowflake/client/jdbc/StatementIT.java b/src/test/java/net/snowflake/client/jdbc/StatementIT.java index 245b92ec5..82c9725b4 100644 --- a/src/test/java/net/snowflake/client/jdbc/StatementIT.java +++ b/src/test/java/net/snowflake/client/jdbc/StatementIT.java @@ -14,7 +14,12 @@ import static org.junit.Assert.fail; import java.io.File; -import java.sql.*; +import java.sql.BatchUpdateException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.Statement; import java.util.List; import net.snowflake.client.AbstractDriverIT; import net.snowflake.client.ConditionalIgnoreRule; diff --git a/src/test/java/net/snowflake/client/jdbc/StatementLatestIT.java b/src/test/java/net/snowflake/client/jdbc/StatementLatestIT.java index dfc585163..0a003957c 100644 --- a/src/test/java/net/snowflake/client/jdbc/StatementLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/StatementLatestIT.java @@ -6,11 +6,19 @@ import static net.snowflake.client.jdbc.ErrorCode.ROW_DOES_NOT_EXIST; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.File; import java.net.URL; -import java.sql.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Arrays; import java.util.List; import java.util.Map; diff --git a/src/test/java/net/snowflake/client/jdbc/StatementNoOpLatestIT.java b/src/test/java/net/snowflake/client/jdbc/StatementNoOpLatestIT.java index 87a750a6b..12aa69882 100644 --- a/src/test/java/net/snowflake/client/jdbc/StatementNoOpLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/StatementNoOpLatestIT.java @@ -4,7 +4,8 @@ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.sql.SQLException; import java.sql.Statement; diff --git a/src/test/java/net/snowflake/client/jdbc/StreamLatestIT.java b/src/test/java/net/snowflake/client/jdbc/StreamLatestIT.java index 7ab2cd9d9..f7e3d0d74 100644 --- a/src/test/java/net/snowflake/client/jdbc/StreamLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/StreamLatestIT.java @@ -3,9 +3,16 @@ */ package net.snowflake.client.jdbc; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java index de5539b33..c667b7a3f 100644 --- a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java @@ -9,7 +9,10 @@ import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.core.SFSession; import net.snowflake.client.core.SFStatement; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.BaseJDBCTest; +import net.snowflake.client.jdbc.SnowflakeConnectionV1; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; +import net.snowflake.client.jdbc.SnowflakeSQLLoggedException; import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial; import org.junit.Test; diff --git a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java index fb3d2005e..ab6276ec3 100644 --- a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java @@ -3,7 +3,8 @@ */ package net.snowflake.client.jdbc.cloud.storage; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import com.amazonaws.AmazonServiceException; import com.amazonaws.ClientConfiguration; @@ -16,7 +17,9 @@ import net.snowflake.client.RunningOnGithubAction; import net.snowflake.client.core.SFSession; import net.snowflake.client.core.SFStatement; -import net.snowflake.client.jdbc.*; +import net.snowflake.client.jdbc.BaseJDBCTest; +import net.snowflake.client.jdbc.SnowflakeConnectionV1; +import net.snowflake.client.jdbc.SnowflakeFileTransferAgent; import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial; import org.junit.Assert; import org.junit.Ignore; diff --git a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java index 6aff9577f..1d8ec8c9e 100644 --- a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java +++ b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java @@ -2,7 +2,9 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceTest.java b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceTest.java index 902bb6d97..5103348fa 100644 --- a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceTest.java +++ b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceTest.java @@ -1,6 +1,7 @@ package net.snowflake.client.jdbc.telemetryOOB; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; import java.util.HashMap; diff --git a/src/test/java/net/snowflake/client/loader/LoaderLatestIT.java b/src/test/java/net/snowflake/client/loader/LoaderLatestIT.java index b3764499b..6ac489300 100644 --- a/src/test/java/net/snowflake/client/loader/LoaderLatestIT.java +++ b/src/test/java/net/snowflake/client/loader/LoaderLatestIT.java @@ -1,6 +1,8 @@ package net.snowflake.client.loader; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; diff --git a/src/test/java/net/snowflake/client/log/JDK14JCLWrapperLatestIT.java b/src/test/java/net/snowflake/client/log/JDK14JCLWrapperLatestIT.java index 899b1ff63..033a15457 100644 --- a/src/test/java/net/snowflake/client/log/JDK14JCLWrapperLatestIT.java +++ b/src/test/java/net/snowflake/client/log/JDK14JCLWrapperLatestIT.java @@ -3,7 +3,9 @@ */ package net.snowflake.client.log; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.util.logging.Formatter; import java.util.logging.Handler; diff --git a/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java b/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java index 59bca38e7..faa809af4 100644 --- a/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java +++ b/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java @@ -1,6 +1,8 @@ package net.snowflake.client.log; -import static org.junit.Assert.*; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; diff --git a/src/test/java/net/snowflake/client/log/SLF4JJJCLWrapperLatestIT.java b/src/test/java/net/snowflake/client/log/SLF4JJJCLWrapperLatestIT.java index 55202d650..0b7d55a3c 100644 --- a/src/test/java/net/snowflake/client/log/SLF4JJJCLWrapperLatestIT.java +++ b/src/test/java/net/snowflake/client/log/SLF4JJJCLWrapperLatestIT.java @@ -3,7 +3,9 @@ */ package net.snowflake.client.log; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; diff --git a/src/test/java/net/snowflake/client/pooling/LogicalConnectionFeatureNotSupportedLatestIT.java b/src/test/java/net/snowflake/client/pooling/LogicalConnectionFeatureNotSupportedLatestIT.java index 00a1e4026..251d0006d 100644 --- a/src/test/java/net/snowflake/client/pooling/LogicalConnectionFeatureNotSupportedLatestIT.java +++ b/src/test/java/net/snowflake/client/pooling/LogicalConnectionFeatureNotSupportedLatestIT.java @@ -3,7 +3,11 @@ */ package net.snowflake.client.pooling; -import java.sql.*; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Savepoint; +import java.sql.Statement; import java.util.HashMap; import java.util.Map; import javax.sql.PooledConnection; diff --git a/src/test/java/net/snowflake/client/pooling/LogicalConnectionLatestIT.java b/src/test/java/net/snowflake/client/pooling/LogicalConnectionLatestIT.java index 78957c7b3..627f1db31 100644 --- a/src/test/java/net/snowflake/client/pooling/LogicalConnectionLatestIT.java +++ b/src/test/java/net/snowflake/client/pooling/LogicalConnectionLatestIT.java @@ -3,9 +3,20 @@ */ package net.snowflake.client.pooling; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; -import java.sql.*; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Collections; import java.util.Map; import java.util.Properties;