Repository: kylin Updated Branches: refs/heads/KYLIN-2535 [created] 29265aff2
#470 Support unicode in kylin.properties Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/8fa82771 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/8fa82771 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/8fa82771 Branch: refs/heads/KYLIN-2535 Commit: 8fa827716eb66a40e2561433d58f13a4605e3796 Parents: a0b537b Author: nichunen <[email protected]> Authored: Wed Apr 26 17:57:39 2017 +0800 Committer: nichunen <[email protected]> Committed: Wed Apr 26 17:57:54 2017 +0800 ---------------------------------------------------------------------- .../main/java/org/apache/kylin/common/KylinConfig.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/8fa82771/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java index a9a0c45..c00054f 100644 --- a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java +++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java @@ -18,14 +18,17 @@ package org.apache.kylin.common; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringReader; +import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.Enumeration; import java.util.Map; @@ -248,22 +251,24 @@ public class KylinConfig extends KylinConfigBase { } } catch (FileNotFoundException e) { throw new RuntimeException(e); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); } return conf; } - private static OrderedProperties getKylinOrderedProperties() throws FileNotFoundException { + private static OrderedProperties getKylinOrderedProperties() throws FileNotFoundException, UnsupportedEncodingException { File propFile = getKylinPropertiesFile(); if (propFile == null || !propFile.exists()) { logger.error("fail to locate " + KYLIN_CONF_PROPERTIES_FILE); throw new RuntimeException("fail to locate " + KYLIN_CONF_PROPERTIES_FILE); } - final InputStream is = new FileInputStream(propFile); + final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(propFile), "UTF-8")); try { OrderedProperties orderedProperties = new OrderedProperties(); - orderedProperties.load(is); + orderedProperties.load(reader); orderedProperties = BCC.check(orderedProperties); File propOverrideFile = new File(propFile.getParentFile(), propFile.getName() + ".override"); @@ -281,7 +286,7 @@ public class KylinConfig extends KylinConfigBase { } catch (IOException e) { throw new RuntimeException(e); } finally { - IOUtils.closeQuietly(is); + IOUtils.closeQuietly(reader); } }
