You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by gg...@apache.org on 2023/06/23 17:51:00 UTC

[juneau] 03/11: [juneau-rest-mock] Throw a specialized RuntimeException instead of RuntimeException

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git

commit d51d57d01aa9edb3355a62ac617f7bf23d0deb8a
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Fri Jun 23 12:47:38 2023 -0400

    [juneau-rest-mock] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../src/main/java/org/apache/juneau/rest/mock/MockRestClient.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java
index 454dcc81f..fe2388b26 100644
--- a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java
+++ b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java
@@ -2143,7 +2143,7 @@ public class MockRestClient extends RestClient implements HttpClientConnection {
 
 			MockPathResolver pr = new MockPathResolver(target, contextPath, servletPath, path, null);
 			if (pr.getError() != null)
-				throw new RuntimeException(pr.getError());
+				throw new IllegalStateException(pr.getError());
 
 			MockServletRequest r = MockServletRequest
 				.create(request.getRequestLine().getMethod(), pr.getURI())
@@ -2207,7 +2207,7 @@ public class MockRestClient extends RestClient implements HttpClientConnection {
 
 			// If the status isn't set, something's broken.
 			if (res.getStatus() == 0)
-				throw new RuntimeException("Response status was 0.");
+				throw new IllegalStateException("Response status was 0.");
 
 			// A bug in HttpClient causes an infinite loop if the response is less than 200.
 			// As a workaround, just add 1000 to the status code (which is better than an infinite loop).