Skip to content

Commit

Permalink
check style
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jf committed Dec 19, 2024
1 parent 1a56a76 commit 1764882
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ public StorageObjectSummaryCollection listObjects(String remoteStorageLocation,
Page<Blob> blobs = this.gcsClient.list(remoteStorageLocation, BlobListOption.prefix(prefix));
// Normal flow will never hit here. This is only for testing purposes
if (isInjectedExceptionEnabled()
&& SnowflakeGCSClient.injectedException
instanceof StorageProviderException) {
throw (StorageProviderException)
SnowflakeGCSClient.injectedException;
&& SnowflakeGCSClient.injectedException instanceof StorageProviderException) {
throw (StorageProviderException) SnowflakeGCSClient.injectedException;
}
return new StorageObjectSummaryCollection(blobs);
} catch (Exception e) {
Expand Down
13 changes: 9 additions & 4 deletions src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,12 @@ public void testFailOverOrgAccount() throws SQLException {
public void testDiagnosticCheckFailsWithNoAllowlistFileProvided() throws SQLException {
Properties props = new Properties();
props.put("ENABLE_DIAGNOSTICS", true);
try(Connection con = getConnection(props)) {
try (Connection con = getConnection(props)) {
fail();
} catch (SnowflakeSQLException e) {
assertTrue(e.getMessage().contains("Diagnostics was enabled but an allowlist file was not provided"));
assertTrue(
e.getMessage()
.contains("Diagnostics was enabled but an allowlist file was not provided"));
}
}

Expand All @@ -1030,10 +1032,13 @@ public void testDiagnosticCheckWithFakeAllowlistFileProvided() throws SQLExcepti
Properties props = new Properties();
props.put("ENABLE_DIAGNOSTICS", true);
props.put("DIAGNOSTICS_ALLOWLIST_FILE", "/some/path/allowlist.json");
try(Connection con = getConnection(props)) {
try (Connection con = getConnection(props)) {
fail();
} catch (Exception e) {
assertTrue(e.getMessage().contains("A connection was not created because the driver is running in diagnostics mode."));
assertTrue(
e.getMessage()
.contains(
"A connection was not created because the driver is running in diagnostics mode."));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,16 +878,16 @@ public void testListObjectsException() throws Exception {
Properties paramProperties = new Properties();
paramProperties.put("GCS_USE_DOWNSCOPED_CREDENTIAL", true);
SnowflakeGCSClient.setInjectedException(
new StorageProviderException(new Exception("could not list objects")));
new StorageProviderException(new Exception("could not list objects")));

try (Connection con = getConnection("gcpaccount", paramProperties);
Statement statement = con.createStatement()) {
Statement statement = con.createStatement()) {
try {
statement.execute("create or replace stage testStage");
SFSession sfSession = con.unwrap(SnowflakeConnectionV1.class).getSfSession();
String command = "PUT file://" + getFullPathFileInResource(TEST_DATA_FILE) + " @testStage";
SnowflakeFileTransferAgent sfAgent =
new SnowflakeFileTransferAgent(command, sfSession, new SFStatement(sfSession));
new SnowflakeFileTransferAgent(command, sfSession, new SFStatement(sfSession));

sfAgent.execute();
} catch (SnowflakeSQLException err) {
Expand Down

0 comments on commit 1764882

Please sign in to comment.