Skip to content

Commit

Permalink
Strings literals should be placed on the left side when checking for …
Browse files Browse the repository at this point in the history
…equality
  • Loading branch information
xiangyushawn committed May 15, 2017
1 parent 2c3887d commit 9b7e127
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/microsoft/sqlserver/jdbc/DLLException.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ private static void buildMsgParams(String errMessage,
String parameter2,
String parameter3) {

if (errMessage.equalsIgnoreCase("R_AECertLocBad")) {
if ("R_AECertLocBad".equalsIgnoreCase(errMessage)) {
msgArgs[0] = parameter1;
msgArgs[1] = parameter1 + "/" + parameter2 + "/" + parameter3;
}
else if (errMessage.equalsIgnoreCase("R_AECertStoreBad")) {
else if ("R_AECertStoreBad".equalsIgnoreCase(errMessage)) {
msgArgs[0] = parameter2;
msgArgs[1] = parameter1 + "/" + parameter2 + "/" + parameter3;
}
else if (errMessage.equalsIgnoreCase("R_AECertHashEmpty")) {
else if ("R_AECertHashEmpty".equalsIgnoreCase(errMessage)) {
msgArgs[0] = parameter1 + "/" + parameter2 + "/" + parameter3;

}
Expand Down

1 comment on commit 9b7e127

@sehrope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this method expect the caller to allocate the String array? I think it's only used in one place (directly above the method definition one line 93) but it seems odd to do it like that. It's particularly weird as the modifiable parameter, msgArgs, isn't the first argument of buildMsgParams(...) either.

I say change the method to return String[], allocate it within the method, and remove msgArgs parameter.

Please sign in to comment.