Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8353E200C09 for ; Wed, 25 Jan 2017 18:01:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 81E27160B4E; Wed, 25 Jan 2017 17:01:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CC112160B3D for ; Wed, 25 Jan 2017 18:01:38 +0100 (CET) Received: (qmail 31129 invoked by uid 500); 25 Jan 2017 17:01:38 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 31119 invoked by uid 99); 25 Jan 2017 17:01:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jan 2017 17:01:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CB03ADFB0E; Wed, 25 Jan 2017 17:01:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rmetzger@apache.org To: commits@flink.apache.org Message-Id: <1de93869e1224b4790f9faec57c17572@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: flink git commit: [FLINK-5637] Avoid warning while parsing YAML configuration files Date: Wed, 25 Jan 2017 17:01:37 +0000 (UTC) archived-at: Wed, 25 Jan 2017 17:01:39 -0000 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 Authored: Wed Jan 25 16:31:11 2017 +0100 Committer: Robert Metzger 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