Source:
public static RequestPath parse(String path, Map<String, Object> args, List<String> prefixesToRemove, String clusterName) { int offset = 0; String prefixFound = ""; if (prefixesToRemove != null) { for (String prefix : prefixesToRemove) { int nextSegmentOffset = matchPathSegments(path, offset, prefix, false); if (nextSegmentOffset >= 0) { prefixFound = prefix; offset = nextSegmentOffset; break; } } } String clusterNameFound = ""; if (clusterName != null) { int nextSegmentOffset = matchPathSegments(path, offset, clusterName, true); if (nextSegmentOffset >= 0) { clusterNameFound = clusterName; offset = nextSegmentOffset; } } String pathAfterPrefixes = path.substring(offset); RestUtils.SubResource subResource = null; int lastSlashOffset = path.lastIndexOf('/'); long blobSegmentNum = NO_BLOB_SEGMENT_IDX_SPECIFIED; System.out.println(Arrays.asList(path.split("/"))); if (lastSlashOffset > offset) { try { String[] fields = path.split("/"); if (RestUtils.SubResource.Segment.toString().equals(fields[fields.length - 2])) { subResource = RestUtils.SubResource.valueOf(fields[fields.length - 2]); blobSegmentNum = Long.valueOf(fields[fields.length - 1]); lastSlashOffset = path.lastIndexOf('/', lastSlashOffset - 1); } else { subResource = RestUtils.SubResource.valueOf(path.substring(lastSlashOffset + 1)); } } catch (IllegalArgumentException e) { } } String operationOrBlobId = path.substring(offset, subResource == null ? path.length() : lastSlashOffset); if ((operationOrBlobId.isEmpty() || operationOrBlobId.equals("/")) && args.containsKey(RestUtils.Headers.BLOB_ID)) { operationOrBlobId = args.get(RestUtils.Headers.BLOB_ID).toString(); } return new RequestPath(prefixFound, clusterNameFound, pathAfterPrefixes, operationOrBlobId, subResource, blobSegmentNum); }

Target:
public static RequestPath parse(String path, Map<String, Object> args, List<String> prefixesToRemove, String clusterName) throws RestServiceException { int offset = 0; String prefixFound = ""; if (prefixesToRemove != null) { for (String prefix : prefixesToRemove) { int nextPathSegmentOffset = matchPathSegments(path, offset, prefix, false); if (nextPathSegmentOffset >= 0) { prefixFound = prefix; offset = nextPathSegmentOffset; break; } } } String clusterNameFound = ""; if (clusterName != null) { int nextPathSegmentOffset = matchPathSegments(path, offset, clusterName, true); if (nextPathSegmentOffset >= 0) { clusterNameFound = clusterName; offset = nextPathSegmentOffset; } } String pathAfterPrefixes = path.substring(offset); SubResource subResource = null; int lastSlashOffset = path.lastIndexOf(PATH_SEPARATOR_CHAR); int blobSegmentIdx = NO_BLOB_SEGMENT_IDX_SPECIFIED; boolean isSegment = false; if (lastSlashOffset > offset) { try { String[] fields = path.split(PATH_SEPARATOR_STRING); if (SEGMENT.equals(fields[fields.length - 2])) { isSegment = true; subResource = SubResource.Segment; blobSegmentIdx = Integer.valueOf(fields[fields.length - 1]); lastSlashOffset = path.lastIndexOf(PATH_SEPARATOR_CHAR, lastSlashOffset - 1); } else { subResource = SubResource.valueOf(path.substring(lastSlashOffset + 1)); } } catch (IllegalArgumentException e) { if (isSegment) { throw new RestServiceException("Segment index given is not an integer", RestServiceErrorCode.BadRequest); } } } String operationOrBlobId = path.substring(offset, subResource == null ? path.length() : lastSlashOffset); if ((operationOrBlobId.isEmpty() || operationOrBlobId.equals(PATH_SEPARATOR_STRING)) && args.containsKey( RestUtils.Headers.BLOB_ID)) { operationOrBlobId = args.get(RestUtils.Headers.BLOB_ID).toString(); } return new RequestPath(prefixFound, clusterNameFound, pathAfterPrefixes, operationOrBlobId, subResource, blobSegmentIdx); }