You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2018/01/12 17:18:48 UTC

[ambari] branch branch-2.6 updated (af5ce3f -> e8ddc61)

This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a change to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git.


    from af5ce3f  AMBARI-20797 : Ambari Metrics Storm Sink compilation error due to storm-1.1.0-SNAPSHOT. (Masahiro Tanaka via avijayan) (#97)
     new 74d038e  AMBARI-22771. Ambari loads ambari.properties using ISO 8859-1 encoding (adoroszlai)
     new e8ddc61  AMBARI-22771. Use constant from Charsets instead of Charset.forName

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/ambari/server/configuration/Configuration.java   | 4 +++-
 .../org/apache/ambari/server/configuration/ConfigurationTest.java    | 5 +++++
 ambari-server/src/test/resources/ambari.properties                   | 4 +++-
 3 files changed, 11 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@ambari.apache.org" <co...@ambari.apache.org>'].

[ambari] 01/02: AMBARI-22771. Ambari loads ambari.properties using ISO 8859-1 encoding (adoroszlai)

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 74d038ef4a0a550b1a1d5c008be223cd12569d98
Author: Doroszlai, Attila <ad...@apache.org>
AuthorDate: Fri Jan 12 12:37:20 2018 +0100

    AMBARI-22771. Ambari loads ambari.properties using ISO 8859-1 encoding (adoroszlai)
---
 .../java/org/apache/ambari/server/configuration/Configuration.java   | 4 +++-
 .../org/apache/ambari/server/configuration/ConfigurationTest.java    | 5 +++++
 ambari-server/src/test/resources/ambari.properties                   | 4 +++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 2590a83..df5f5a6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -24,12 +24,14 @@ import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.Writer;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.reflect.Field;
+import java.nio.charset.Charset;
 import java.security.cert.CertificateException;
 import java.security.interfaces.RSAPublicKey;
 import java.util.ArrayList;
@@ -3198,7 +3200,7 @@ public class Configuration {
 
     // load the properties
     try {
-      properties.load(inputStream);
+      properties.load(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
       inputStream.close();
     } catch (FileNotFoundException fnf) {
       LOG.info("No configuration file " + CONFIG_FILE + " found in classpath.", fnf);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
index 971c33a..f456094 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
@@ -1074,4 +1074,9 @@ public class ConfigurationTest {
     Assert.assertEquals(1024, new Configuration(properties).getTlsEphemeralDhKeySize());
   }
 
+  @Test
+  public void canReadNonLatin1Properties() {
+    Assert.assertEquals("árvíztűrő tükörfúrógép", new Configuration().getProperty("encoding.test"));
+  }
+
 }
diff --git a/ambari-server/src/test/resources/ambari.properties b/ambari-server/src/test/resources/ambari.properties
index f1b96c7..8ba72e0 100644
--- a/ambari-server/src/test/resources/ambari.properties
+++ b/ambari-server/src/test/resources/ambari.properties
@@ -14,4 +14,6 @@
 # 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.
\ No newline at end of file
+# limitations under the License.
+
+encoding.test=árvíztűrő tükörfúrógép

-- 
To stop receiving notification emails like this one, please contact
"commits@ambari.apache.org" <co...@ambari.apache.org>.

[ambari] 02/02: AMBARI-22771. Use constant from Charsets instead of Charset.forName

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit e8ddc618582e9dc7cc6087399f2fae594665ee5f
Author: Doroszlai, Attila <ad...@apache.org>
AuthorDate: Fri Jan 12 14:07:31 2018 +0100

    AMBARI-22771. Use constant from Charsets instead of Charset.forName
---
 .../java/org/apache/ambari/server/configuration/Configuration.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index df5f5a6..1dfcfd9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -31,7 +31,6 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.reflect.Field;
-import java.nio.charset.Charset;
 import java.security.cert.CertificateException;
 import java.security.interfaces.RSAPublicKey;
 import java.util.ArrayList;
@@ -93,6 +92,7 @@ import org.apache.commons.lang.math.NumberUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Charsets;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
 import com.google.gson.Gson;
@@ -3200,7 +3200,7 @@ public class Configuration {
 
     // load the properties
     try {
-      properties.load(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
+      properties.load(new InputStreamReader(inputStream, Charsets.UTF_8));
       inputStream.close();
     } catch (FileNotFoundException fnf) {
       LOG.info("No configuration file " + CONFIG_FILE + " found in classpath.", fnf);

-- 
To stop receiving notification emails like this one, please contact
"commits@ambari.apache.org" <co...@ambari.apache.org>.