This is an automated email from the ASF dual-hosted git repository.
weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new bc1dfb8 HDDS-5538. Uncaught NPE in GrpcReplicationService. (#2503)
bc1dfb8 is described below
commit bc1dfb8adcbfc4d3516d624dd0afb1bb3598993f
Author: Sammi Chen <[email protected]>
AuthorDate: Mon Aug 9 14:50:14 2021 +0800
HDDS-5538. Uncaught NPE in GrpcReplicationService. (#2503)
---
.../replication/OnDemandContainerReplicationSource.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/OnDemandContainerReplicationSource.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/OnDemandContainerReplicationSource.java
index 40d8e48..58485ef 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/OnDemandContainerReplicationSource.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/OnDemandContainerReplicationSource.java
@@ -20,12 +20,14 @@ package org.apache.hadoop.ozone.container.replication;
import java.io.IOException;
import java.io.OutputStream;
+import
org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException;
import org.apache.hadoop.ozone.container.common.interfaces.Container;
import org.apache.hadoop.ozone.container.keyvalue.TarContainerPacker;
-import com.google.common.base.Preconditions;
import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import static
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.CONTAINER_NOT_FOUND;
+
/**
* A naive implementation of the replication source which creates a tar file
* on-demand without pre-create the compressed archives.
@@ -53,8 +55,10 @@ public class OnDemandContainerReplicationSource
Container container = controller.getContainer(containerId);
- Preconditions.checkNotNull(
- container, "Container is not found " + containerId);
+ if (container == null) {
+ throw new StorageContainerException("Container " + containerId +
+ " is not found.", CONTAINER_NOT_FOUND);
+ }
controller.exportContainer(
container.getContainerType(), containerId, destination, packer);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]