Skip to content

Commit 8f5a812

Browse files
committed
Handle google-cloud-storage 412
1 parent fc400b1 commit 8f5a812

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/gaul/s3proxy/S3ProxyHandlerJetty.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ public void handle(String target, Request baseRequest,
129129
iae.getMessage());
130130
baseRequest.setHandled(true);
131131
return;
132+
} catch (IllegalStateException ise) {
133+
// google-cloud-storage uses a different exception
134+
if (ise.getMessage().startsWith("PreconditionFailed")) {
135+
sendS3Exception(request, response,
136+
new S3Exception(S3ErrorCode.PRECONDITION_FAILED));
137+
return;
138+
}
139+
logger.debug("IllegalStateException:", ise);
140+
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
141+
ise.getMessage());
142+
baseRequest.setHandled(true);
143+
return;
132144
} catch (KeyNotFoundException knfe) {
133145
S3ErrorCode code = S3ErrorCode.NO_SUCH_KEY;
134146
handler.sendSimpleErrorResponse(request, response, code,

0 commit comments

Comments
 (0)