From a5a751b4187c69a6cda66466a3210d81ef54d929 Mon Sep 17 00:00:00 2001 From: Anu Engineer Date: Tue, 26 Feb 2019 14:33:54 -0800 Subject: [PATCH] HDDS-1174. Freon tests are failing with null pointer exception. Contributed by Shashikant Banerjee. --- .../org/apache/hadoop/ozone/freon/RandomKeyGenerator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java index 650d253b88..a255342679 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java @@ -215,7 +215,9 @@ public void init(OzoneConfiguration configuration) throws IOException { for (FreonOps ops : FreonOps.values()) { histograms.add(ops.ordinal(), new Histogram(new UniformReservoir())); } - freon.startHttpServer(); + if (freon != null) { + freon.startHttpServer(); + } } @Override @@ -296,7 +298,9 @@ private void addShutdownHook() { Runtime.getRuntime().addShutdownHook( new Thread(() -> { printStats(System.out); - freon.stopHttpServer(); + if (freon != null) { + freon.stopHttpServer(); + } })); } /**