translatedException = new StorageException(request.getResult().getErrorCode(), responseMessage, responseCode, extendedError, cause);
@SuppressWarnings("incomplete-switch") public void validateLocation() { if (this.getStorageUri() != null) { if (!this.getStorageUri().validateLocationMode(this.locationMode)) { throw new UnsupportedOperationException(SR.STORAGE_URI_MISSING_LOCATION); } } // If the command only allows for a specific location, we should target // that location no matter what the retry policy says. switch (this.getRequestLocationMode()) { case PRIMARY_ONLY: if (this.getLocationMode() == LocationMode.SECONDARY_ONLY) { throw new IllegalArgumentException(SR.PRIMARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.PRIMARY); this.setLocationMode(LocationMode.PRIMARY_ONLY); break; case SECONDARY_ONLY: if (this.getLocationMode() == LocationMode.PRIMARY_ONLY) { throw new IllegalArgumentException(SR.SECONDARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.SECONDARY); this.setLocationMode(LocationMode.SECONDARY_ONLY); break; } this.getResult().setTargetLocation(this.currentLocation); }
@SuppressWarnings("incomplete-switch") public void validateLocation() { if (this.getStorageUri() != null) { if (!this.getStorageUri().validateLocationMode(this.locationMode)) { throw new UnsupportedOperationException(SR.STORAGE_URI_MISSING_LOCATION); } } // If the command only allows for a specific location, we should target // that location no matter what the retry policy says. switch (this.getRequestLocationMode()) { case PRIMARY_ONLY: if (this.getLocationMode() == LocationMode.SECONDARY_ONLY) { throw new IllegalArgumentException(SR.PRIMARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.PRIMARY); this.setLocationMode(LocationMode.PRIMARY_ONLY); break; case SECONDARY_ONLY: if (this.getLocationMode() == LocationMode.PRIMARY_ONLY) { throw new IllegalArgumentException(SR.SECONDARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.SECONDARY); this.setLocationMode(LocationMode.SECONDARY_ONLY); break; } this.getResult().setTargetLocation(this.currentLocation); }
RequestResult currResult = task.getResult(); currResult.setStartDate(new Date()); ExecutionEngine.fireResponseReceivedEvent(opContext, request, task.getResult()); Logger.info(opContext, LogConstants.ERROR_RECEIVING_RESPONSE); if (!responseReceivedEventTriggered) { if (task.getResult().getStartDate() == null) { task.getResult().setStartDate(new Date()); ExecutionEngine.fireErrorReceivingResponseEvent(opContext, request, task.getResult()); if ((task.getResult().getStatusCode() >= 200) && (task.getResult().getStatusCode() < 300)) { if (request != null) { InputStream inStream = request.getInputStream(); task.getResult().setException(translatedException); if (task.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_IMPLEMENTED || task.getResult().getStatusCode() == HttpURLConnection.HTTP_VERSION || translatedException.getErrorCode().equals(StorageErrorCodeStrings.INVALID_BLOB_TYPE)) { throw translatedException; task.getResult().setStatusCode(e.getHttpStatusCode()); task.getResult().setStatusMessage(e.getMessage()); task.getResult().setException(e); task.getResult().setException(translatedException);
RequestResult currResult = task.getResult(); currResult.setStartDate(new Date()); ExecutionEngine.fireResponseReceivedEvent(opContext, request, task.getResult()); Logger.info(opContext, LogConstants.ERROR_RECEIVING_RESPONSE); if (!responseReceivedEventTriggered) { if (task.getResult().getStartDate() == null) { task.getResult().setStartDate(new Date()); ExecutionEngine.fireErrorReceivingResponseEvent(opContext, request, task.getResult()); if ((task.getResult().getStatusCode() >= 200) && (task.getResult().getStatusCode() < 300)) { if (request != null) { InputStream inStream = request.getInputStream(); task.getResult().setException(translatedException); if (task.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_IMPLEMENTED || task.getResult().getStatusCode() == HttpURLConnection.HTTP_VERSION || translatedException.getErrorCode().equals(StorageErrorCodeStrings.INVALID_BLOB_TYPE)) { throw translatedException; task.getResult().setException(translatedException); Logger.error(opContext, LogConstants.UNRETRYABLE_EXCEPTION, e.getClass().getName(), e.getMessage()); throw translatedException; task.getResult().setStatusCode(e.getHttpStatusCode()); task.getResult().setStatusMessage(e.getMessage());
ExecutionEngine.fireSendingRequestEvent(opContext, request, task.getResult()); task.setIsSent(true);
ExecutionEngine.fireSendingRequestEvent(opContext, request, task.getResult()); task.setIsSent(true);