You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by dw...@apache.org on 2019/03/11 14:28:43 UTC
[flink] branch release-1.7 updated: [FLINK-11867][datastream] Fixed
preconditions for filePath's value
This is an automated email from the ASF dual-hosted git repository.
dwysakowicz pushed a commit to branch release-1.7
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.7 by this push:
new a933813 [FLINK-11867][datastream] Fixed preconditions for filePath's value
a933813 is described below
commit a93381360c06a67cd8dca16e3fb5df228c7a63bf
Author: Tom Goong <To...@users.noreply.github.com>
AuthorDate: Mon Mar 11 22:24:46 2019 +0800
[FLINK-11867][datastream] Fixed preconditions for filePath's value
---
.../streaming/api/environment/StreamExecutionEnvironment.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
index ed69ed4..9303166 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
@@ -77,6 +77,7 @@ import org.apache.flink.streaming.api.operators.StreamSource;
import org.apache.flink.streaming.api.transformations.StreamTransformation;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.SplittableIterator;
+import org.apache.flink.util.StringUtils;
import com.esotericsoftware.kryo.Serializer;
@@ -958,8 +959,7 @@ public abstract class StreamExecutionEnvironment {
* @return The data stream that represents the data read from the given file as text lines
*/
public DataStreamSource<String> readTextFile(String filePath, String charsetName) {
- Preconditions.checkNotNull(filePath, "The file path must not be null.");
- Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty.");
+ Preconditions.checkArgument(!StringUtils.isNullOrWhitespaceOnly(filePath), "The file path must not be null or blank.");
TextInputFormat format = new TextInputFormat(new Path(filePath));
format.setFilesFilter(FilePathFilter.createDefaultFilter());
@@ -1156,8 +1156,7 @@ public abstract class StreamExecutionEnvironment {
TypeInformation<OUT> typeInformation) {
Preconditions.checkNotNull(inputFormat, "InputFormat must not be null.");
- Preconditions.checkNotNull(filePath, "The file path must not be null.");
- Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty.");
+ Preconditions.checkArgument(!StringUtils.isNullOrWhitespaceOnly(filePath), "The file path must not be null or blank.");
inputFormat.setFilePath(filePath);
return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);