Skip to content

Commit

Permalink
Fixes nullability and style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentgo committed Oct 14, 2024
1 parent 841708e commit bd6092e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public static AdbcException io(String message) {
return new AdbcException(message, /*cause*/ null, AdbcStatusCode.IO, null, 0);
}

/** Create a new exception with code {@link AdbcStatusCode#IO} from an existing exception. */
public static AdbcException io(Throwable cause) {
return new AdbcException(cause.getMessage(), cause, AdbcStatusCode.IO, null, 0);
}

/** Create a new exception with code {@link AdbcStatusCode#INVALID_STATE}. */
public static AdbcException invalidState(String message) {
return new AdbcException(message, /*cause*/ null, AdbcStatusCode.INVALID_STATE, null, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public String toString() {
@Override
public void close() throws AdbcException {
try {
reader.close();
reader.close();
} catch (IOException e) {
throw AdbcException.io(e.getMessage()).withCause(e);
throw AdbcException.io(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void close() throws AdbcException {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw AdbcException.io(e.getMessage()).withCause(e);
throw AdbcException.io(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public void close() throws AdbcException {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw AdbcException.io(e.getMessage()).withCause(e);
throw AdbcException.io(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void close() throws AdbcException {
try {
connection.close();
} catch (SQLException e) {
throw AdbcException.io(e.getMessage()).withCause(e);
throw AdbcException.io(e);
}
}
connection = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public void close() throws AdbcException {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw AdbcException.io(e.getMessage()).withCause(e);
throw AdbcException.io(e);
}
}

Expand Down

0 comments on commit bd6092e

Please sign in to comment.