HDFS-13371. NPE for FsServerDefaults.getKeyProviderUri() for clientProtocol communication between 2.7 and 3.X. Contributed by Sherwood Zheng.

This commit is contained in:
Inigo Goiri 2019-06-24 17:52:33 -07:00
parent 38a560c6f1
commit b76b843c8b
1 changed files with 6 additions and 4 deletions

View File

@ -2265,7 +2265,7 @@ public static DataEncryptionKeyProto convert(DataEncryptionKey bet) {
public static FsServerDefaultsProto convert(FsServerDefaults fs) {
if (fs == null) return null;
return FsServerDefaultsProto.newBuilder().
FsServerDefaultsProto.Builder builder = FsServerDefaultsProto.newBuilder().
setBlockSize(fs.getBlockSize()).
setBytesPerChecksum(fs.getBytesPerChecksum()).
setWritePacketSize(fs.getWritePacketSize())
@ -2274,9 +2274,11 @@ public static FsServerDefaultsProto convert(FsServerDefaults fs) {
.setEncryptDataTransfer(fs.getEncryptDataTransfer())
.setTrashInterval(fs.getTrashInterval())
.setChecksumType(convert(fs.getChecksumType()))
.setKeyProviderUri(fs.getKeyProviderUri())
.setPolicyId(fs.getDefaultStoragePolicyId())
.build();
.setPolicyId(fs.getDefaultStoragePolicyId());
if (fs.getKeyProviderUri() != null) {
builder.setKeyProviderUri(fs.getKeyProviderUri());
}
return builder.build();
}
public static EnumSetWritable<CreateFlag> convertCreateFlag(int flag) {