flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject flink git commit: [FLINK-5637] Avoid warning while parsing YAML configuration files
Date Wed, 25 Jan 2017 17:01:37 GMT
Repository: flink
Updated Branches:
  refs/heads/release-1.2 80c9f8018 -> f2240eb93


[FLINK-5637] Avoid warning while parsing YAML configuration files

This closes #3216


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

Branch: refs/heads/release-1.2
Commit: f2240eb9394b368b392ac83d37106482a005e0a2
Parents: 80c9f80
Author: Robert Metzger <rmetzger@apache.org>
Authored: Wed Jan 25 16:31:11 2017 +0100
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Wed Jan 25 18:01:25 2017 +0100

----------------------------------------------------------------------
 .../org/apache/flink/configuration/GlobalConfiguration.java | 9 +++++----
 .../apache/flink/configuration/GlobalConfigurationTest.java | 3 ++-
 flink-dist/src/main/resources/flink-conf.yaml               | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/f2240eb9/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
b/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
index dca6307..ea9f8bf 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
@@ -144,11 +144,12 @@ public final class GlobalConfiguration {
 		try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)))){
 
 			String line;
+			int lineNo = 0;
 			while ((line = reader.readLine()) != null) {
-
+				lineNo++;
 				// 1. check for comments
 				String[] comments = line.split("#", 2);
-				String conf = comments[0];
+				String conf = comments[0].trim();
 
 				// 2. get key and value
 				if (conf.length() > 0) {
@@ -156,7 +157,7 @@ public final class GlobalConfiguration {
 
 					// skip line with no valid key-value pair
 					if (kv.length == 1) {
-						LOG.warn("Error while trying to split key and value in configuration file " + file
+ ": " + line);
+						LOG.warn("Error while trying to split key and value in configuration file " + file
+ ":" + lineNo + ": \"" + line + "\"");
 						continue;
 					}
 
@@ -165,7 +166,7 @@ public final class GlobalConfiguration {
 
 					// sanity check
 					if (key.length() == 0 || value.length() == 0) {
-						LOG.warn("Error after splitting key and value in configuration file " + file + ": "
+ line);
+						LOG.warn("Error after splitting key and value in configuration file " + file + ":"
+ lineNo + ": \"" + line + "\"");
 						continue;
 					}
 

http://git-wip-us.apache.org/repos/asf/flink/blob/f2240eb9/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
b/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
index 6336a73..322e64d 100644
--- a/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
+++ b/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
@@ -56,7 +56,8 @@ public class GlobalConfigurationTest extends TestLogger {
 				pw.println("mykey3:myvalue3"); // SKIP, missing white space after colon
 				pw.println(" some nonsense without colon and whitespace separator"); // SKIP
 				pw.println(" :  "); // SKIP
-				pw.println("   "); // SKIP
+				pw.println("   "); // SKIP (silently)
+				pw.println(" "); // SKIP (silently)
 				pw.println("mykey4: myvalue4# some comments"); // OK, skip comments only
 				pw.println("   mykey5    :    myvalue5    "); // OK, trim unnecessary whitespace
 				pw.println("mykey6: my: value6"); // OK, only use first ': ' as separator

http://git-wip-us.apache.org/repos/asf/flink/blob/f2240eb9/flink-dist/src/main/resources/flink-conf.yaml
----------------------------------------------------------------------
diff --git a/flink-dist/src/main/resources/flink-conf.yaml b/flink-dist/src/main/resources/flink-conf.yaml
index f759db6..108bd58 100644
--- a/flink-dist/src/main/resources/flink-conf.yaml
+++ b/flink-dist/src/main/resources/flink-conf.yaml
@@ -64,7 +64,7 @@ parallelism.default: 1
 #==============================================================================
 # Web Frontend
 #==============================================================================
- 
+
 # The address under which the web-based runtime monitor listens.
 #
 #jobmanager.web.address: 0.0.0.0


Mime
View raw message