Skip to content

Commit

Permalink
FIR-32120: removed redundant throws declarations and fixed some warni…
Browse files Browse the repository at this point in the history
…ngs (#415)
  • Loading branch information
Alexander Radzin authored May 26, 2024
1 parent 38312cd commit e409bee
Show file tree
Hide file tree
Showing 17 changed files with 462 additions and 575 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/firebolt/FireboltDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class FireboltDriver implements Driver {

public static final String JDBC_FIREBOLT = "jdbc:firebolt:";
private static Logger rootLog;
private static final Logger rootLog;
private static final Logger log;

static {
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/firebolt/jdbc/GenericWrapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.firebolt.jdbc;

import java.sql.SQLException;
import java.sql.Wrapper;

public interface GenericWrapper extends Wrapper {
@Override
default <T> T unwrap(@SuppressWarnings("SpellCheckingInspection") Class<T> iface) throws SQLException {
if (iface.isAssignableFrom(getClass())) {
return iface.cast(this);
}
throw new SQLException("Cannot unwrap to " + iface.getName());
}

@Override
default boolean isWrapperFor(@SuppressWarnings("SpellCheckingInspection") Class<?> iface) {
return iface.isAssignableFrom(getClass());
}
}
17 changes: 1 addition & 16 deletions src/main/java/com/firebolt/jdbc/JdbcBase.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
package com.firebolt.jdbc;

import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Wrapper;

public class JdbcBase implements Wrapper {
public abstract class JdbcBase implements GenericWrapper {
private SQLWarning firstWarning;

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface.isAssignableFrom(getClass())) {
return iface.cast(this);
}
throw new SQLException("Cannot unwrap to " + iface.getName());
}

@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isAssignableFrom(getClass());
}

public synchronized SQLWarning getWarnings() {
return firstWarning;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public FireboltAccount(String id, String region, int infraVersion) {
this.infraVersion = infraVersion;
}

@SuppressWarnings("unused") // used by FireboltAccountRetriever that in turn calls its base class` method FireboltClient.jsonToObject() that calls this constructor by reflection
FireboltAccount(JSONObject json) {
this(json.getString("id"), json.getString("region"), json.optInt("infraVersion", 1));
}
Expand Down
Loading

0 comments on commit e409bee

Please sign in to comment.