Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
None
Description
keyLocation may not be initialized if allocateBlock fails in the following function:
public AllocateBlockResponse allocateBlock(RpcController controller, AllocateBlockRequest request) throws ServiceException { AllocateBlockResponse.Builder resp = AllocateBlockResponse.newBuilder(); try { KeyArgs keyArgs = request.getKeyArgs(); OmKeyArgs omKeyArgs = new OmKeyArgs.Builder() .setVolumeName(keyArgs.getVolumeName()) .setBucketName(keyArgs.getBucketName()) .setKeyName(keyArgs.getKeyName()) .build(); OmKeyLocationInfo newLocation = impl.allocateBlock(omKeyArgs, request.getClientID()); resp.setKeyLocation(newLocation.getProtobuf()); resp.setStatus(Status.OK); } catch (IOException e) { resp.setStatus(exceptionToResponseStatus(e)); } return resp.build(); }
Hence it must be an optional field. Else the protobuf builder exception suppresses the real issue.