diff --git a/pom.xml b/pom.xml index 928f0c5e8..ce766e3c6 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 1.8 1.8 - + false @@ -202,7 +202,7 @@ org.apache.tsfile,,javax,java,\# - + UNIX @@ -301,7 +301,7 @@ validate - + diff --git a/tsfile/src/main/java/org/apache/tsfile/read/query/executor/TsFileExecutor.java b/tsfile/src/main/java/org/apache/tsfile/read/query/executor/TsFileExecutor.java index e599e7650..fb4d1802c 100644 --- a/tsfile/src/main/java/org/apache/tsfile/read/query/executor/TsFileExecutor.java +++ b/tsfile/src/main/java/org/apache/tsfile/read/query/executor/TsFileExecutor.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; public class TsFileExecutor implements QueryExecutor { @@ -50,8 +51,8 @@ public class TsFileExecutor implements QueryExecutor { private IChunkLoader chunkLoader; public TsFileExecutor(IMetadataQuerier metadataQuerier, IChunkLoader chunkLoader) { - this.metadataQuerier = metadataQuerier; - this.chunkLoader = chunkLoader; + this.metadataQuerier = Objects.requireNonNull(metadataQuerier, "metadataQuerier"); + this.chunkLoader = Objects.requireNonNull(chunkLoader, "chunkLoader"); } @Override diff --git a/tsfile/src/test/java/org/apache/tsfile/read/query/executor/TsFileExecutorTest.java b/tsfile/src/test/java/org/apache/tsfile/read/query/executor/TsFileExecutorTest.java new file mode 100644 index 000000000..eda6e32d1 --- /dev/null +++ b/tsfile/src/test/java/org/apache/tsfile/read/query/executor/TsFileExecutorTest.java @@ -0,0 +1,34 @@ +/* + * 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.tsfile.read.query.executor; + +import org.junit.Assert; +import org.junit.Test; + +public class TsFileExecutorTest { + @Test + public void constructorNullTest() { + Assert.assertThrows( + NullPointerException.class, + () -> { + new TsFileExecutor(null, null); + }); + } +}