Skip to content

Commit

Permalink
Merge pull request #472 from JamieMagee/simplify-boolean-expressions
Browse files Browse the repository at this point in the history
Simplify overly complex boolean expressions
  • Loading branch information
cheenamalhotra committed Sep 21, 2017
2 parents 377f77a + 0deeff6 commit 75d60b1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/AE.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ short getOrdinal() {
}

boolean IsAlgorithmInitialized() {
return (null != cipherAlgorithm) ? true : false;
return null != cipherAlgorithm;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4995,7 +4995,7 @@ else if (DataTypes.UNKNOWN_STREAM_LENGTH == dataLength)
}
break;
case SQL_VARIANT:
boolean isShiloh = (8 >= con.getServerMajorVersion() ? true : false);
boolean isShiloh = (8 >= con.getServerMajorVersion());
if (isShiloh) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_SQLVariantSupport"));
throw new SQLServerException(null, form.format(new Object[] {}), null, 0, false);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ boolean isNull() {
}

boolean isValueGotten() {
return (null != getterDTV) ? (true) : (false);
return null != getterDTV;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ private void getSourceMetadata() throws SQLServerException {
for (int i = 1; i <= srcColumnCount; ++i) {
srcColumnMetadata.put(i,
new BulkColumnMetaData(sourceResultSetMetaData.getColumnName(i),
((ResultSetMetaData.columnNoNulls == sourceResultSetMetaData.isNullable(i)) ? false : true),
(ResultSetMetaData.columnNoNulls != sourceResultSetMetaData.isNullable(i)),
sourceResultSetMetaData.getPrecision(i), sourceResultSetMetaData.getScale(i),
sourceResultSetMetaData.getColumnType(i), null));
}
Expand Down Expand Up @@ -2515,7 +2515,7 @@ else if (4 >= bulkScale)
}
break;
case microsoft.sql.Types.SQL_VARIANT:
boolean isShiloh = (8 >= connection.getServerMajorVersion() ? true : false);
boolean isShiloh = (8 >= connection.getServerMajorVersion());
if (isShiloh) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_SQLVariantSupport"));
throw new SQLServerException(null, form.format(new Object[] {}), null, 0, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ private void login(String primary,
long timerStart) throws SQLServerException {
// standardLogin would be false only for db mirroring scenarios. It would be true
// for all other cases, including multiSubnetFailover
final boolean isDBMirroring = (null == mirror && null == foActual) ? false : true;
final boolean isDBMirroring = null != mirror || null != foActual;
int sleepInterval = 100; // milliseconds to sleep (back off) between attempts.
long timeoutUnitInterval;

Expand Down Expand Up @@ -2622,7 +2622,7 @@ void Prelogin(String serverName,
// Or AccessToken is not null, mean token based authentication is used.
if (((null != authenticationString) && (!authenticationString.equalsIgnoreCase(SqlAuthentication.NotSpecified.toString())))
|| (null != accessTokenInByte)) {
fedAuthRequiredPreLoginResponse = (preloginResponse[optionOffset] == 1 ? true : false);
fedAuthRequiredPreLoginResponse = (preloginResponse[optionOffset] == 1);
}
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public synchronized void addRow(Object... values) throws SQLServerException {
Object val = null;

if ((null != values) && (currentColumn < values.length) && (null != values[currentColumn]))
val = (null == values[currentColumn]) ? null : values[currentColumn];
val = values[currentColumn];
currentColumn++;
Map.Entry<Integer, SQLServerDataColumn> pair = columnsIterator.next();
JDBCType jdbcType = JDBCType.of(pair.getValue().javaSqlType);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/dtv.java
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ void writeEncryptData(DTV dtv,
// the default length for decimal value
}

tdsWriter.writeByte((byte) ((0 != outScale) ? outScale : 0)); // send scale
tdsWriter.writeByte((byte) (outScale)); // send scale
}
else {
tdsWriter.writeByte((byte) 0x11); // maximum length
Expand Down

0 comments on commit 75d60b1

Please sign in to comment.