26
26
27
27
/**
28
28
* Global cache for account-id based URI. Prevent calling new URI constructor for the same string, which can cause performance
29
- * issues with some uri pattern.
30
- * Do not directly depend on this class, it will be removed in the future.
29
+ * issues with some uri pattern. Do not directly depend on this class, it will be removed in the future.
31
30
*/
32
31
@ SdkProtectedApi
33
32
public final class SdkURI {
34
- private final String HTTPS_PREFIX = "https://" ;
35
- private final String HTTP_PREFIX = "http://" ;
33
+ private static final String HTTPS_PREFIX = "https://" ;
34
+ private static final String HTTP_PREFIX = "http://" ;
36
35
37
36
private static final Logger log = Logger .loggerFor (SdkURI .class );
38
37
@@ -71,7 +70,7 @@ public URI newURI(String s) throws URISyntaxException {
71
70
return uri ;
72
71
} catch (IllegalArgumentException e ) {
73
72
// URI.create() wraps the URISyntaxException thrown by new URI in a IllegalArgumentException, we need to unwrap it
74
- if (e .getCause () != null && e . getCause () instanceof URISyntaxException ) {
73
+ if (e .getCause () instanceof URISyntaxException ) {
75
74
throw (URISyntaxException ) e .getCause ();
76
75
}
77
76
throw e ;
@@ -81,7 +80,7 @@ public URI newURI(String s) throws URISyntaxException {
81
80
public URI newURI (String scheme ,
82
81
String userInfo , String host , int port ,
83
82
String path , String query , String fragment )
84
- throws URISyntaxException {
83
+ throws URISyntaxException {
85
84
if (!isAccountIdUri (host )) {
86
85
log .trace (() -> "skipping cache for host" + host );
87
86
return new URI (scheme , userInfo , host , port , path , query , fragment );
@@ -96,7 +95,7 @@ public URI newURI(String scheme,
96
95
public URI newURI (String scheme ,
97
96
String authority ,
98
97
String path , String query , String fragment )
99
- throws URISyntaxException {
98
+ throws URISyntaxException {
100
99
if (!isAccountIdUri (authority )) {
101
100
log .trace (() -> "skipping cache for authority" + authority );
102
101
return new URI (scheme , authority , path , query , fragment );
@@ -208,7 +207,9 @@ public boolean equals(Object o) {
208
207
}
209
208
210
209
HostConstructorArgs that = (HostConstructorArgs ) o ;
211
- return port == that .port && Objects .equals (scheme , that .scheme ) && Objects .equals (userInfo , that .userInfo ) && Objects .equals (host , that .host ) && Objects .equals (path , that .path ) && Objects .equals (query , that .query ) && Objects .equals (fragment , that .fragment );
210
+ return port == that .port && Objects .equals (scheme , that .scheme ) && Objects .equals (userInfo , that .userInfo )
211
+ && Objects .equals (host , that .host ) && Objects .equals (path , that .path ) && Objects .equals (query , that .query )
212
+ && Objects .equals (fragment , that .fragment );
212
213
}
213
214
214
215
@ Override
@@ -255,8 +256,9 @@ public boolean equals(Object o) {
255
256
}
256
257
257
258
AuthorityConstructorArgs that = (AuthorityConstructorArgs ) o ;
258
- return Objects .equals (scheme , that .scheme ) && Objects .equals (authority , that .authority ) && Objects .equals (path ,
259
- that .path ) && Objects .equals (query , that .query ) && Objects .equals (fragment , that .fragment );
259
+ return Objects .equals (scheme , that .scheme ) && Objects .equals (authority , that .authority )
260
+ && Objects .equals (path , that .path ) && Objects .equals (query , that .query )
261
+ && Objects .equals (fragment , that .fragment );
260
262
}
261
263
262
264
@ Override
0 commit comments