Source:
private static JSONObject getReplicasForBlobId(RestRequestMetadata restRequestMetadata, ClusterMap clusterMap, AdminMetrics adminMetrics) throws RestServiceException { Map<String, List<String>> parameters = restRequestMetadata.getArgs(); if (parameters != null && parameters.containsKey(BLOB_ID_KEY)) { String blobIdStr = parameters.get(BLOB_ID_KEY).get(0); logger.debug("BlobId for request is {}", restRequestMetadata.getUri(), blobIdStr); try { BlobId blobId = new BlobId(blobIdStr, clusterMap); return packageResult(blobId.getPartition().getReplicaIds()); } catch (IllegalArgumentException e) { logger.warn("Invalid blob id received for getReplicasForBlobId request. Throwing exception..", blobIdStr, e); adminMetrics.getReplicasForBlobIdInvalidBlobId.inc(); throw new RestServiceException("Invalid blob id", e, RestServiceErrorCode.InvalidArgs); } catch (IOException e) { logger.error("BlobId object creation for threw exception during handling of getReplicasForBlobId", blobIdStr, e); adminMetrics.getReplicasForBlobIdObjectCreationError.inc(); throw new RestServiceException("Unable to create blob id object ", e, RestServiceErrorCode.BlobIdCreationError); } catch (JSONException e) { logger.error("Exception during response construction for getReplicasForBlobId. Blob id - ", e, blobIdStr); adminMetrics.getReplicasForBlobIdResponseBuildingError.inc(); throw new RestServiceException("Unable to construct result object", e, RestServiceErrorCode.ResponseBuildingFailure); } } else { logger.warn("Request for getReplicasForBlobId missing parameter - {}", BLOB_ID_KEY); adminMetrics.getReplicasForBlobIdMissingParameter.inc(); throw new RestServiceException("Request missing parameter - " + BLOB_ID_KEY, RestServiceErrorCode.MissingArgs); } }

Target:
private static JSONObject getReplicasForBlobId(RestRequestMetadata restRequestMetadata, ClusterMap clusterMap, AdminMetrics adminMetrics) throws RestServiceException { Map<String, List<String>> parameters = restRequestMetadata.getArgs(); if (parameters != null && parameters.containsKey(BLOB_ID_KEY)) { String blobIdStr = parameters.get(BLOB_ID_KEY).get(0); logger.trace("BlobId for request is {}", restRequestMetadata.getUri(), blobIdStr); try { PartitionId partitionId = new BlobId(blobIdStr, clusterMap).getPartition(); if (partitionId == null) { logger.warn("Partition for blob id is null. The blob id might be invalid", blobIdStr); adminMetrics.getReplicasForBlobIdPartitionNullError.inc(); throw new RestServiceException("Partition for blob id " + blobIdStr + " is null. The id might be invalid", RestServiceErrorCode.InvalidArgs); } return packageResult(partitionId.getReplicaIds()); } catch (IllegalArgumentException e) { adminMetrics.getReplicasForBlobIdInvalidBlobIdError.inc(); throw new RestServiceException("Invalid blob id received for getReplicasForBlob request - " + blobIdStr, e, RestServiceErrorCode.InvalidArgs); } catch (IOException e) { adminMetrics.getReplicasForBlobIdObjectCreationError.inc(); throw new RestServiceException( "BlobId object creation failed for getReplicasForBlobId request for blob id " + blobIdStr, e, RestServiceErrorCode.InternalObjectCreationError); } catch (JSONException e) { adminMetrics.getReplicasForBlobIdResponseBuildingError.inc(); throw new RestServiceException("Unable to construct result JSON object during getReplicasForBlobId", e, RestServiceErrorCode.ResponseBuildingFailure); } } else { adminMetrics.getReplicasForBlobIdMissingParameterError.inc(); throw new RestServiceException("Request for getReplicasForBlobId missing parameter - " + BLOB_ID_KEY, RestServiceErrorCode.MissingArgs); } }