Skip to content

Commit 6ba66c2

Browse files
committed
fixup! JCL-403: SolidClient builds ProblemDetails
1 parent b8b6490 commit 6ba66c2

File tree

1 file changed

+1
-108
lines changed

1 file changed

+1
-108
lines changed

solid/src/main/java/com/inrupt/client/solid/SolidClientException.java

Lines changed: 1 addition & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public class SolidClientException extends ClientHttpException {
3333

3434
private static final long serialVersionUID = 2868432164225689934L;
3535

36-
private final URI uri;
37-
private final int statusCode;
38-
private final String body;
39-
private final transient Headers headers;
40-
4136
/**
4237
* Create a SolidClient exception.
4338
*
@@ -46,65 +41,10 @@ public class SolidClientException extends ClientHttpException {
4641
* @param statusCode the HTTP status code
4742
* @param headers the response headers
4843
* @param body the body
49-
* @deprecated
5044
*/
5145
public SolidClientException(final String message, final URI uri, final int statusCode,
5246
final Headers headers, final String body) {
53-
super(null, message);
54-
this.uri = uri;
55-
this.statusCode = statusCode;
56-
this.headers = headers;
57-
this.body = body;
58-
}
59-
60-
public SolidClientException(
61-
final String message,
62-
final ProblemDetails pd,
63-
final URI uri,
64-
final Headers headers,
65-
final String body
66-
) {
67-
super(pd, message);
68-
this.uri = uri;
69-
this.statusCode = pd.getStatus();
70-
this.headers = headers;
71-
this.body = body;
72-
}
73-
74-
/**
75-
* Retrieve the URI associated with this exception.
76-
*
77-
* @return the uri
78-
*/
79-
public URI getUri() {
80-
return uri;
81-
}
82-
83-
/**
84-
* Retrieve the status code associated with this exception.
85-
*
86-
* @return the status code
87-
*/
88-
public int getStatusCode() {
89-
return statusCode;
90-
}
91-
92-
/**
93-
* Retrieve the headers associated with this exception.
94-
*
95-
* @return the headers
96-
*/
97-
public Headers getHeaders() {
98-
return headers;
99-
}
100-
101-
/**
102-
* Retrieve the body associated with this exception.
103-
*
104-
* @return the body
105-
*/
106-
public String getBody() {
107-
return body;
47+
super(message, uri, statusCode, headers, body);
10848
}
10949

11050
/**
@@ -115,7 +55,6 @@ public String getBody() {
11555
* @param headers the response {@link Headers}
11656
* @param body the response body
11757
* @return an appropriate exception based on the status code.
118-
* @deprecated
11958
*/
12059
public static SolidClientException handle(
12160
final String message,
@@ -152,51 +91,5 @@ public static SolidClientException handle(
15291
return new SolidClientException(message, uri, statusCode, headers, body);
15392
}
15493
}
155-
156-
/**
157-
*
158-
* @param message the resulting exception message
159-
* @param pd the {@link ProblemDetails} instance
160-
* @param uri the request URL
161-
* @param headers the response {@link Headers}
162-
* @param body the response body
163-
* @return an appropriate exception based on the status code.
164-
*/
165-
public static SolidClientException handle(
166-
final String message,
167-
final ProblemDetails pd,
168-
final URI uri,
169-
final Headers headers,
170-
final String body
171-
) {
172-
switch (pd.getStatus()) {
173-
case BadRequestException.STATUS_CODE:
174-
return new BadRequestException(message, pd, uri, headers, body);
175-
case UnauthorizedException.STATUS_CODE:
176-
return new UnauthorizedException(message, pd, uri, headers, body);
177-
case ForbiddenException.STATUS_CODE:
178-
return new ForbiddenException(message, pd, uri, headers, body);
179-
case NotFoundException.STATUS_CODE:
180-
return new NotFoundException(message, pd, uri, headers, body);
181-
case MethodNotAllowedException.STATUS_CODE:
182-
return new MethodNotAllowedException(message, pd, uri, headers, body);
183-
case NotAcceptableException.STATUS_CODE:
184-
return new NotAcceptableException(message, pd, uri, headers, body);
185-
case ConflictException.STATUS_CODE:
186-
return new ConflictException(message, pd, uri, headers, body);
187-
case GoneException.STATUS_CODE:
188-
return new GoneException(message, pd, uri, headers, body);
189-
case PreconditionFailedException.STATUS_CODE:
190-
return new PreconditionFailedException(message, pd, uri, headers, body);
191-
case UnsupportedMediaTypeException.STATUS_CODE:
192-
return new UnsupportedMediaTypeException(message, pd, uri, headers, body);
193-
case TooManyRequestsException.STATUS_CODE:
194-
return new TooManyRequestsException(message, pd, uri, headers, body);
195-
case InternalServerErrorException.STATUS_CODE:
196-
return new InternalServerErrorException(message, pd, uri, headers, body);
197-
default:
198-
return new SolidClientException(message, pd, uri, headers, body);
199-
}
200-
}
20194
}
20295

0 commit comments

Comments
 (0)