HDFS-13371. NPE for FsServerDefaults.getKeyProviderUri() for clientProtocol communication between 2.7 and 3.X. Contributed by Sherwood Zheng.
This commit is contained in:
parent
38a560c6f1
commit
b76b843c8b
|
@ -2265,7 +2265,7 @@ public class PBHelperClient {
|
||||||
|
|
||||||
public static FsServerDefaultsProto convert(FsServerDefaults fs) {
|
public static FsServerDefaultsProto convert(FsServerDefaults fs) {
|
||||||
if (fs == null) return null;
|
if (fs == null) return null;
|
||||||
return FsServerDefaultsProto.newBuilder().
|
FsServerDefaultsProto.Builder builder = FsServerDefaultsProto.newBuilder().
|
||||||
setBlockSize(fs.getBlockSize()).
|
setBlockSize(fs.getBlockSize()).
|
||||||
setBytesPerChecksum(fs.getBytesPerChecksum()).
|
setBytesPerChecksum(fs.getBytesPerChecksum()).
|
||||||
setWritePacketSize(fs.getWritePacketSize())
|
setWritePacketSize(fs.getWritePacketSize())
|
||||||
|
@ -2274,9 +2274,11 @@ public class PBHelperClient {
|
||||||
.setEncryptDataTransfer(fs.getEncryptDataTransfer())
|
.setEncryptDataTransfer(fs.getEncryptDataTransfer())
|
||||||
.setTrashInterval(fs.getTrashInterval())
|
.setTrashInterval(fs.getTrashInterval())
|
||||||
.setChecksumType(convert(fs.getChecksumType()))
|
.setChecksumType(convert(fs.getChecksumType()))
|
||||||
.setKeyProviderUri(fs.getKeyProviderUri())
|
.setPolicyId(fs.getDefaultStoragePolicyId());
|
||||||
.setPolicyId(fs.getDefaultStoragePolicyId())
|
if (fs.getKeyProviderUri() != null) {
|
||||||
.build();
|
builder.setKeyProviderUri(fs.getKeyProviderUri());
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSetWritable<CreateFlag> convertCreateFlag(int flag) {
|
public static EnumSetWritable<CreateFlag> convertCreateFlag(int flag) {
|
||||||
|
|
Loading…
Reference in New Issue