HDDS-908: NPE in TestOzoneRpcClient.

Contributed by Ajay Kumar.
This commit is contained in:
Anu Engineer 2018-12-17 12:17:09 -08:00
parent 71e0b0d800
commit 5426653819
1 changed files with 8 additions and 5 deletions

View File

@ -1438,11 +1438,14 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
.setNodeType(HddsProtos.NodeType.DATANODE)
.setHostname(datanode.getHostName());
dnServiceInfoBuilder.addServicePort(ServicePort.newBuilder()
.setType(ServicePort.Type.HTTP)
.setValue(DatanodeDetails.getFromProtoBuf(datanode)
.getPort(DatanodeDetails.Port.Name.REST).getValue())
.build());
if(DatanodeDetails.getFromProtoBuf(datanode)
.getPort(DatanodeDetails.Port.Name.REST) != null) {
dnServiceInfoBuilder.addServicePort(ServicePort.newBuilder()
.setType(ServicePort.Type.HTTP)
.setValue(DatanodeDetails.getFromProtoBuf(datanode)
.getPort(DatanodeDetails.Port.Name.REST).getValue())
.build());
}
services.add(dnServiceInfoBuilder.build());
}