]> source.dussan.org Git - sonarqube.git/commitdiff
Remove bad comment of sonar.properties about encoding
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Mar 2015 21:21:45 +0000 (23:21 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Mar 2015 21:21:45 +0000 (23:21 +0200)
Encoding is UTF-8, but not ISO-8859-1 as documented.

sonar-application/src/main/assembly/conf/sonar.properties
sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java

index d5209054161de457367c3f14fc37ed62d0910530..a022c3c1021bbf3e5062c0429c75fd9030b6b2b3 100644 (file)
@@ -1,11 +1,7 @@
-# This file must contain only ISO 8859-1 characters.
-# See http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
-#
 # Property values can:
 # - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}
 # - be encrypted. See http://redirect.sonarsource.com/doc/settings-encryption.html
 
-
 #--------------------------------------------------------------------------------------------------
 # DATABASE
 #
index 91f5d6f15d15d39c379813521e5943b1fec72044..82c0cd8c99d19ffc81262322ba0d8f49affc619a 100644 (file)
@@ -101,6 +101,11 @@ public class PropsBuilderTest {
     }
   }
 
+  //Remove bad comment of sonar.properties about encoding
+
+  //Encoding is UTF-8, but not ISO-8859-1 as documented
+
+
   @Test
   public void load_properties_file_if_exists() throws Exception {
     FileUtils.write(new File(homeDir, "conf/sonar.properties"), "sonar.jdbc.username=angela\nsonar.origin=file");
@@ -112,11 +117,20 @@ public class PropsBuilderTest {
     rawProperties.setProperty("sonar.origin", "raw");
     Props props = new PropsBuilder(rawProperties, jdbcSettings, homeDir).build();
 
+    // properties loaded from file
     assertThat(props.value("sonar.jdbc.username")).isEqualTo("angela");
+
     // command-line arguments override sonar.properties file
     assertThat(props.value("sonar.origin")).isEqualTo("raw");
   }
 
+  @Test
+  public void utf8_file_encoding() throws Exception {
+    FileUtils.write(new File(homeDir, "conf/sonar.properties"), "utf8prop=Thônes");
+    Props props = new PropsBuilder(new Properties(), jdbcSettings, homeDir).build();
+    assertThat(props.value("utf8prop")).isEqualTo("Thônes");
+  }
+
   @Test
   public void do_not_load_properties_file_if_not_exists() throws Exception {
     FileUtils.forceMkdir(dataDir);