Skip to content

Commit

Permalink
Fix | Fixes for issues reported by static analysis tools (SonarQube +…
Browse files Browse the repository at this point in the history
… Fortify) (#747)
  • Loading branch information
rene-ye authored and cheenamalhotra committed Jul 12, 2018
1 parent 521e6b3 commit 9e697a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2579,11 +2579,11 @@ private void writeSqlVariant(TDSWriter tdsWriter, Object colValue, ResultSet sou
break;

case TIMEN:
bulkScale = variantType.getScale();
int timeBulkScale = variantType.getScale();
int timeHeaderLength = 0x08; // default
if (2 >= bulkScale) {
if (2 >= timeBulkScale) {
timeHeaderLength = 0x06;
} else if (4 >= bulkScale) {
} else if (4 >= timeBulkScale) {
timeHeaderLength = 0x07;
} else {
timeHeaderLength = 0x08;
Expand All @@ -2595,8 +2595,8 @@ private void writeSqlVariant(TDSWriter tdsWriter, Object colValue, ResultSet sou
// header
// length
// defers
tdsWriter.writeByte((byte) bulkScale);
tdsWriter.writeTime((java.sql.Timestamp) colValue, bulkScale);
tdsWriter.writeByte((byte) timeBulkScale);
tdsWriter.writeTime((java.sql.Timestamp) colValue, timeBulkScale);
break;

case DATETIME8:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public void setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert) {
private boolean sendTimeAsDatetime = SQLServerDriverBooleanProperty.SEND_TIME_AS_DATETIME.getDefaultValue();

@Override
public synchronized final boolean getSendTimeAsDatetime() {
public final boolean getSendTimeAsDatetime() {
return !isKatmaiOrLater() || sendTimeAsDatetime;
}

Expand Down Expand Up @@ -3132,7 +3132,7 @@ public void abort(Executor executor) throws SQLException {

setState(State.Closed);

if (null != tdsChannel)
if (null != tdsChannel && null != executor)
executor.execute(() -> tdsChannel.close());

loggerExternal.exiting(getClassNameLogging(), "abort");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public java.util.UUID getClientConnectionId() throws SQLServerException {
}

@Override
public synchronized void setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue) throws SQLServerException {
public void setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue) throws SQLServerException {
checkClosed();
wrappedConnection.setSendTimeAsDatetime(sendTimeAsDateTimeValue);
}
Expand Down

0 comments on commit 9e697a5

Please sign in to comment.