HDFS-8466. Refactor BlockInfoContiguous and fix NPE in TestBlockInfo#testCopyConstructor() (Contributed by Vinayakumar B)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2022a683 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2022a683 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2022a683 Branch: refs/heads/HDFS-7285-REBASE Commit: 2022a68391d58ffc62c4f05ef3fa344c1fbbebde Parents: bee1f04 Author: Vinayakumar B <[email protected]> Authored: Thu Jun 18 14:15:01 2015 +0530 Committer: Vinayakumar B <[email protected]> Committed: Thu Aug 13 17:09:37 2015 +0530 ---------------------------------------------------------------------- .../hdfs/server/blockmanagement/BlockInfoContiguous.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2022a683/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java index 1a091de..5199101 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java @@ -37,13 +37,13 @@ public class BlockInfoContiguous extends BlockInfo { } /** - * Copy construction. - * This is used to convert BlockReplicationInfoUnderConstruction + * Copy construction. This is used to convert + * BlockReplicationInfoUnderConstruction + * * @param from BlockReplicationInfo to copy from. */ protected BlockInfoContiguous(BlockInfoContiguous from) { - this(from, from.getBlockCollection().getPreferredBlockReplication()); - this.triplets = new Object[from.triplets.length]; + this(from, (short) (from.triplets.length / 3)); this.setBlockCollection(from.getBlockCollection()); }
