Skip to content

Commit 57ecb83

Browse files
committed
MAX_INT_DIGITS_BASE_10 as constant
1 parent 019c2de commit 57ecb83

File tree

1 file changed

+5
-5
lines changed
  • utils/src/main/java/software/amazon/awssdk/utils/uri

1 file changed

+5
-5
lines changed

utils/src/main/java/software/amazon/awssdk/utils/uri/SdkUri.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public final class SdkUri {
3434

3535
private static final String HTTPS_PREFIX = "https://";
3636
private static final String HTTP_PREFIX = "http://";
37+
private static final int MAX_INT_DIGITS_BASE_10 = 10;
3738

3839
/*
3940
* The default LRUCache size is 100, but for a single service call we cache at least 3 different URIs so the cache size is
@@ -91,7 +92,7 @@ public URI newUri(String scheme,
9192
String userInfo, String host, int port,
9293
String path, String query, String fragment) throws URISyntaxException {
9394
if (!isAccountIdUri(host)) {
94-
log.trace(() -> "skipping cache for host" + host);
95+
log.trace(() -> "skipping cache for host " + host);
9596
return new URI(scheme, userInfo, host, port, path, query, fragment);
9697
}
9798
try {
@@ -112,7 +113,7 @@ public URI newUri(String scheme,
112113
String authority,
113114
String path, String query, String fragment) throws URISyntaxException {
114115
if (!isAccountIdUri(authority)) {
115-
log.trace(() -> "skipping cache for authority" + authority);
116+
log.trace(() -> "skipping cache for authority " + authority);
116117
return new URI(scheme, authority, path, query, fragment);
117118
}
118119
try {
@@ -139,16 +140,15 @@ public URI newUri(String scheme,
139140
*/
140141
private boolean isAccountIdUri(String s) {
141142
int firstCharAfterScheme = 0;
142-
int maxIntSizeBase10 = 10;
143143
if (s.startsWith(HTTPS_PREFIX)) {
144144
firstCharAfterScheme = HTTPS_PREFIX.length();
145145
} else if (s.startsWith(HTTP_PREFIX)) {
146146
firstCharAfterScheme = HTTP_PREFIX.length();
147147
}
148148

149-
if (s.length() > firstCharAfterScheme + maxIntSizeBase10) {
149+
if (s.length() > firstCharAfterScheme + MAX_INT_DIGITS_BASE_10) {
150150
return Character.isDigit(s.charAt(firstCharAfterScheme))
151-
&& Character.isDigit(s.charAt(firstCharAfterScheme + maxIntSizeBase10));
151+
&& Character.isDigit(s.charAt(firstCharAfterScheme + MAX_INT_DIGITS_BASE_10));
152152
}
153153
return false;
154154
}

0 commit comments

Comments
 (0)