Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
- Removed unused private fields and methods
- Minor optimizations in TextUtils
  • Loading branch information
jkmcl authored and ok2c committed Feb 10, 2024
1 parent 9556ed4 commit 877910e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
*/
public class WWWFormCodec {

private static final char QP_SEP_A = '&';

/**
* Returns a list of {@link NameValuePair} parameters parsed
* from the {@code application/x-www-form-urlencoded} content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicMarkableReference;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.Experimental;
Expand Down Expand Up @@ -363,8 +362,6 @@ private enum RequestServiceStrategy { FIRST_SUCCESSFUL, ALL }
private final AtomicInteger allocated;
private final AtomicLong releaseSeqNum;

private final ReentrantLock lock;

private volatile int max;

PerRoutePool(
Expand All @@ -389,7 +386,6 @@ private enum RequestServiceStrategy { FIRST_SUCCESSFUL, ALL }
this.allocated = new AtomicInteger(0);
this.releaseSeqNum = new AtomicLong(0);
this.max = max;
this.lock = new ReentrantLock();
}

public void shutdown(final CloseMode closeMode) {
Expand Down
4 changes: 0 additions & 4 deletions httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ private static IllegalArgumentException illegalArgumentExceptionNotEmpty(final S
return new IllegalArgumentException(name + " must not be empty");
}

private static NullPointerException NullPointerException(final String name) {
return new NullPointerException(name + " must not be null");
}

public static <T extends CharSequence> T notBlank(final T argument, final String name) {
notNull(argument, name);
if (TextUtils.isBlank(argument)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static boolean containsBlanks(final CharSequence s) {
if (strLen == 0) {
return false;
}
for (int i = 0; i < s.length(); i++) {
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(s.charAt(i))) {
return true;
}
Expand All @@ -119,7 +119,7 @@ public static String toHexString(final byte[] bytes) {
if (bytes == null) {
return null;
}
final StringBuilder buffer = new StringBuilder();
final StringBuilder buffer = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
final int unsignedB = bytes[i] & 0xff;
if (unsignedB < 16) {
Expand Down Expand Up @@ -153,7 +153,8 @@ public static String toLowerCase(final String s) {
* @since 5.3
*/
public static boolean isAllASCII(final CharSequence s) {
for (int i = 0; i < s.length(); i++) {
final int strLen = length(s);
for (int i = 0; i < strLen; i++) {
if (s.charAt(i) > 0x7F) {
return false;
}
Expand Down

0 comments on commit 877910e

Please sign in to comment.