in wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java [228:263]
protected void finishPutTransfer(Resource resource, InputStream input, OutputStream output)
throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException {
try {
String reasonPhrase = putConnection.getResponseMessage();
int statusCode = putConnection.getResponseCode();
switch (statusCode) {
// Success Codes
case HttpURLConnection.HTTP_OK: // 200
case HttpURLConnection.HTTP_CREATED: // 201
case HttpURLConnection.HTTP_ACCEPTED: // 202
case HttpURLConnection.HTTP_NO_CONTENT: // 204
break;
// TODO Move 401/407 to AuthenticationException after WAGON-587
case HttpURLConnection.HTTP_FORBIDDEN:
case HttpURLConnection.HTTP_UNAUTHORIZED:
case HttpURLConnection.HTTP_PROXY_AUTH:
throw new AuthorizationException(
formatAuthorizationMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
case HttpURLConnection.HTTP_NOT_FOUND:
case HttpURLConnection.HTTP_GONE:
throw new ResourceDoesNotExistException(formatResourceDoesNotExistMessage(
buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
// add more entries here
default:
throw new TransferFailedException(
formatTransferFailedMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
}
} catch (IOException e) {
fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
throw convertHttpUrlConnectionException(e, putConnection, buildUrl(resource));
}
}