This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new b8cfbc4 AMBARI-22771. Ambari loads ambari.properties using ISO 8859-1
encoding (adoroszlai)
b8cfbc4 is described below
commit b8cfbc49e8a70efd917debb04111ffa3fbead7ed
Author: Doroszlai, Attila <[email protected]>
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 6a7e041..d78ed7c 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,6 +24,7 @@ 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;
@@ -90,6 +91,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;
@@ -2839,7 +2841,7 @@ public class Configuration {
// load the properties
try {
- properties.load(inputStream);
+ properties.load(new InputStreamReader(inputStream, Charsets.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 acd4771..5d6573e 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
@@ -925,4 +925,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
['"[email protected]" <[email protected]>'].