You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2018/08/15 17:24:36 UTC

asterixdb git commit: [NO ISSUE][EXT] Prevent NPE in close() when using TestTypedAdapter

Repository: asterixdb
Updated Branches:
  refs/heads/master 309c69c57 -> 4af131ada


[NO ISSUE][EXT] Prevent NPE in close() when using TestTypedAdapter

WARN ...CleanupUtils - Failure closing a closeable resource
java.lang.NullPointerException: null
  at org.apache.asterix.external.dataset.adapter.FeedAdapter.close(FeedAdapter.java:63)

Change-Id: If2d62ce00858ff9a9f8033bd21d5da5f1f207c56
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2903
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <ba...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/4af131ad
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/4af131ad
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/4af131ad

Branch: refs/heads/master
Commit: 4af131ada7f104cd8adddcabd8b5eb928f560f68
Parents: 309c69c
Author: Michael Blow <mb...@apache.org>
Authored: Tue Aug 14 18:03:46 2018 -0700
Committer: Michael Blow <mb...@apache.org>
Committed: Wed Aug 15 10:24:09 2018 -0700

----------------------------------------------------------------------
 .../library/adapter/TestTypedAdapter.java       |  3 +-
 .../TestTypedFeedDataFlowController.java        | 39 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4af131ad/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
index 90336fe..effd59f 100644
--- a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
+++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
@@ -55,7 +55,7 @@ public class TestTypedAdapter extends FeedAdapter {
 
     public TestTypedAdapter(ITupleParserFactory parserFactory, ARecordType sourceDatatype, IHyracksTaskContext ctx,
             Map<String, String> configuration, int partition) throws IOException {
-        super(null);
+        super(new TestTypedFeedDataFlowController(ctx));
         pos = new PipedOutputStream();
         pis = new PipedInputStream(pos);
         this.configuration = configuration;
@@ -150,4 +150,5 @@ public class TestTypedAdapter extends FeedAdapter {
     public boolean resume() {
         return false;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4af131ad/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedFeedDataFlowController.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedFeedDataFlowController.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedFeedDataFlowController.java
new file mode 100644
index 0000000..708cdd8
--- /dev/null
+++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedFeedDataFlowController.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.external.library.adapter;
+
+import org.apache.asterix.external.dataflow.AbstractFeedDataFlowController;
+import org.apache.hyracks.api.comm.IFrameWriter;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+class TestTypedFeedDataFlowController extends AbstractFeedDataFlowController {
+    TestTypedFeedDataFlowController(IHyracksTaskContext ctx) {
+        super(ctx, null, 0);
+    }
+
+    @Override
+    public String getStats() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void start(IFrameWriter writer) {
+        throw new UnsupportedOperationException();
+    }
+}