Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify overly complex boolean expressions #472

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -4996,7 +4996,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 @@ -397,7 +397,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 @@ -2518,7 +2518,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 @@ -1788,7 +1788,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 @@ -2592,7 +2592,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