Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code quality fix - Strings literals should be placed on the left side when checking for equality #1041

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

Closed
faisal-hameed wants to merge 1 commit into AsyncHttpClient:master from DevFactory:release/strings-literals-should-be-on-left-side
Closed
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
8 changes: 4 additions & 4 deletions client/src/main/java/org/asynchttpclient/Realm.java
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ private String parseRawQop(String rawQop) {

// prefer auth over auth-int
for (String rawServerSupportedQop : serverSupportedQops) {
if (rawServerSupportedQop.equals("auth"))
if ("auth".equals(rawServerSupportedQop))
return rawServerSupportedQop;
}

for (String rawServerSupportedQop : serverSupportedQops) {
if (rawServerSupportedQop.equals("auth-int"))
if ("auth-int".equals(rawServerSupportedQop))
return rawServerSupportedQop;
}

Expand Down Expand Up @@ -407,7 +407,7 @@ private byte[] secretDigest(StringBuilder sb, MessageDigest md) {
sb.append(principal).append(':').append(realmName).append(':').append(password);
byte[] ha1 = md5FromRecycledStringBuilder(sb, md);

if (algorithm == null || algorithm.equals("MD5")) {
if (algorithm == null || "MD5".equals(algorithm)) {
return ha1;
} else if ("MD5-sess".equals(algorithm)) {
appendBase16(sb, ha1);
Expand All @@ -424,7 +424,7 @@ private byte[] dataDigest(StringBuilder sb, String digestUri, MessageDigest md)
if ("auth-int".equals(qop)) {
sb.append(':').append(EMPTY_ENTITY_MD5);

} else if (qop != null && !qop.equals("auth")) {
} else if (qop != null && !"auth".equals(qop)) {
throw new UnsupportedOperationException("Digest qop not supported: " + qop);
}

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public void setCurrentRequest(Request currentRequest) {
* @return true if that {@link Future} cannot be recovered.
*/
public boolean canBeReplayed() {
return !isDone() && canRetry() && !(Channels.isChannelValid(channel) && !getUri().getScheme().equalsIgnoreCase("https")) && !inAuth.get() && !inProxyAuth.get();
return !isDone() && canRetry() && !(Channels.isChannelValid(channel) && !"https".equalsIgnoreCase(getUri().getScheme())) && !inAuth.get() && !inProxyAuth.get();
}

public long getStart() {
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void ntlmChallenge(String authenticateHeader,//
Realm realm,//
NettyResponseFuture<?> future) {

if (authenticateHeader.equals("NTLM")) {
if ("NTLM".equals(authenticateHeader)) {
// server replied bare NTLM => we didn't preemptively sent Type1Msg
String challengeHeader = NtlmEngine.INSTANCE.generateType1Msg();
// FIXME we might want to filter current NTLM and add (leave other
Expand All @@ -112,7 +112,7 @@ private void ntlmProxyChallenge(String authenticateHeader,//
HttpHeaders headers,//
NettyResponseFuture<?> future) {

if (authenticateHeader.equals("NTLM")) {
if ("NTLM".equals(authenticateHeader)) {
// server replied bare NTLM => we didn't preemptively sent Type1Msg
String challengeHeader = NtlmEngine.INSTANCE.generateType1Msg();
// FIXME we might want to filter current NTLM and add (leave other
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ private String baseUrl(Uri uri) {
sb.append(scheme).append("://").append(uri.getHost());

int port = uri.getPort();
if (scheme.equals("http")) {
if ("http".equals(scheme)) {
if (port == 80)
port = -1;
} else if (scheme.equals("https")) {
} else if ("https".equals(scheme)) {
if (port == 443)
port = -1;
}
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void handle(String pathInContext, Request request, HttpServletRequest htt
httpResponse.setContentType(TestUtils.TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET);
}

if (request.getMethod().equalsIgnoreCase("OPTIONS")) {
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
httpResponse.addHeader("Allow", "GET,HEAD,POST,OPTIONS,TRACE");
}

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void onWebSocketText(String message) {
return;
}
try {
if (message.equals("CLOSE"))
if ("CLOSE".equals(message))
getSession().close();
else
getRemote().sendString(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private Future<Response> execute(RequestBuilder rb, BodyConsumer bodyConsumer, T
ProgressAsyncHandler<Response> handler = new BodyConsumerAsyncHandler(bodyConsumer, throwableHandler, errorDocumentBehaviour,
request.getUri(), listener);

if (resumeEnabled && request.getMethod().equals("GET") && bodyConsumer != null && bodyConsumer instanceof ResumableBodyConsumer) {
if (resumeEnabled && "GET".equals(request.getMethod()) && bodyConsumer != null && bodyConsumer instanceof ResumableBodyConsumer) {
ResumableBodyConsumer fileBodyConsumer = (ResumableBodyConsumer) bodyConsumer;
long length = fileBodyConsumer.getTransferredBytes();
fileBodyConsumer.resume();
Expand Down

AltStyle によって変換されたページ (->オリジナル) /