From f214a9961fdeeebc6157992ed54a777983e218e9 Mon Sep 17 00:00:00 2001 From: Mingliang Liu Date: Thu, 15 Jun 2017 11:16:16 -0700 Subject: [PATCH] HADOOP-14494. ITestJets3tNativeS3FileSystemContract tests NPEs in teardown if store undefined. Contributed by Steve Loughran --- .../fs/s3native/NativeS3FileSystemContractBaseTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java index a6dc2d3319..bfbca71421 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java @@ -44,19 +44,21 @@ public abstract class NativeS3FileSystemContractBaseTest @Before public void setUp() throws Exception { Configuration conf = new Configuration(); - store = getNativeFileSystemStore(); - fs = new NativeS3FileSystem(store); String fsname = conf.get(KEY_TEST_FS); if (StringUtils.isEmpty(fsname)) { throw new AssumptionViolatedException( "No test FS defined in :" + KEY_TEST_FS); } + store = getNativeFileSystemStore(); + fs = new NativeS3FileSystem(store); fs.initialize(URI.create(fsname), conf); } @After public void tearDown() throws Exception { - store.purge("test"); + if (store != null) { + store.purge("test"); + } } @Test