Skip to content

Commit 1f8d8f0

Browse files
committed
Rename class
1 parent d22f07d commit 1f8d8f0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

pkl-core/src/main/java/org/pkl/core/http/JdkHttpClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import javax.net.ssl.SSLHandshakeException;
5050
import javax.net.ssl.TrustManagerFactory;
5151
import org.pkl.core.util.ErrorMessages;
52-
import org.pkl.core.util.ExceptionUtils;
52+
import org.pkl.core.util.Exceptions;
5353

5454
@ThreadSafe
5555
final class JdkHttpClient implements HttpClient {
@@ -94,7 +94,7 @@ public <T> HttpResponse<T> send(HttpRequest request, BodyHandler<T> responseBody
9494
} catch (SSLHandshakeException e) {
9595
throw new SSLHandshakeException(
9696
ErrorMessages.create(
97-
"errorSslHandshake", request.uri().getHost(), ExceptionUtils.getRootReason(e)));
97+
"errorSslHandshake", request.uri().getHost(), Exceptions.getRootReason(e)));
9898
} catch (InterruptedException e) {
9999
// next best thing after letting (checked) InterruptedException bubble up
100100
Thread.currentThread().interrupt();
@@ -140,7 +140,7 @@ private static SSLContext createSslContext(
140140
return sslContext;
141141
} catch (GeneralSecurityException e) {
142142
throw new HttpClientInitException(
143-
ErrorMessages.create("cannotInitHttpClient", ExceptionUtils.getRootReason(e)), e);
143+
ErrorMessages.create("cannotInitHttpClient", Exceptions.getRootReason(e)), e);
144144
}
145145
}
146146

@@ -155,7 +155,7 @@ private static Set<TrustAnchor> createTrustAnchors(
155155
throw new HttpClientInitException(ErrorMessages.create("cannotFindCertFile", file));
156156
} catch (IOException e) {
157157
throw new HttpClientInitException(
158-
ErrorMessages.create("cannotReadCertFile", ExceptionUtils.getRootReason(e)));
158+
ErrorMessages.create("cannotReadCertFile", Exceptions.getRootReason(e)));
159159
}
160160
}
161161

@@ -164,7 +164,7 @@ private static Set<TrustAnchor> createTrustAnchors(
164164
collectTrustAnchors(anchors, factory, stream, url);
165165
} catch (IOException e) {
166166
throw new HttpClientInitException(
167-
ErrorMessages.create("cannotReadCertFile", ExceptionUtils.getRootReason(e)));
167+
ErrorMessages.create("cannotReadCertFile", Exceptions.getRootReason(e)));
168168
}
169169
}
170170

@@ -182,7 +182,7 @@ private static void collectTrustAnchors(
182182
certificates = (Collection<X509Certificate>) factory.generateCertificates(stream);
183183
} catch (CertificateException e) {
184184
throw new HttpClientInitException(
185-
ErrorMessages.create("cannotParseCertFile", source, ExceptionUtils.getRootReason(e)));
185+
ErrorMessages.create("cannotParseCertFile", source, Exceptions.getRootReason(e)));
186186
}
187187
if (certificates.isEmpty()) {
188188
throw new HttpClientInitException(ErrorMessages.create("emptyCertFile", source));

pkl-core/src/main/java/org/pkl/core/util/ExceptionUtils.java renamed to pkl-core/src/main/java/org/pkl/core/util/Exceptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616
package org.pkl.core.util;
1717

18-
public final class ExceptionUtils {
19-
private ExceptionUtils() {}
18+
public final class Exceptions {
19+
private Exceptions() {}
2020

2121
public static Throwable getRootCause(Throwable t) {
2222
var result = t;

pkl-core/src/test/kotlin/org/pkl/core/util/ExceptionUtilsTest.kt renamed to pkl-core/src/test/kotlin/org/pkl/core/util/ExceptionsTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import org.junit.jupiter.api.Test
55
import java.io.IOException
66
import java.lang.Error
77

8-
class ExceptionUtilsTest {
8+
class ExceptionsTest {
99
@Test
1010
fun `get root cause of simple exception`() {
1111
val e = IOException("io")
12-
assertThat(ExceptionUtils.getRootCause(e)).isSameAs(e)
12+
assertThat(Exceptions.getRootCause(e)).isSameAs(e)
1313
}
1414

1515
@Test
@@ -19,30 +19,30 @@ class ExceptionUtilsTest {
1919
val e3 = Error("error")
2020
e.initCause(e2)
2121
e2.initCause(e3)
22-
assertThat(ExceptionUtils.getRootCause(e)).isSameAs(e3)
22+
assertThat(Exceptions.getRootCause(e)).isSameAs(e3)
2323
}
2424

2525
@Test
2626
fun `get root reason`() {
2727
val e = IOException("io")
2828
val e2 = RuntimeException("the root reason")
2929
e.initCause(e2)
30-
assertThat(ExceptionUtils.getRootReason(e)).isEqualTo("the root reason")
30+
assertThat(Exceptions.getRootReason(e)).isEqualTo("the root reason")
3131
}
3232

3333
@Test
3434
fun `get root reason if null`() {
3535
val e = IOException("io")
3636
val e2 = RuntimeException(null as String?)
3737
e.initCause(e2)
38-
assertThat(ExceptionUtils.getRootReason(e)).isEqualTo("(unknown reason)")
38+
assertThat(Exceptions.getRootReason(e)).isEqualTo("(unknown reason)")
3939
}
4040

4141
@Test
4242
fun `get root reason if empty`() {
4343
val e = IOException("io")
4444
val e2 = RuntimeException("")
4545
e.initCause(e2)
46-
assertThat(ExceptionUtils.getRootReason(e)).isEqualTo("(unknown reason)")
46+
assertThat(Exceptions.getRootReason(e)).isEqualTo("(unknown reason)")
4747
}
4848
}

0 commit comments

Comments
 (0)