]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 14 Mar 2012 22:50:01 +0000 (23:50 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 14 Mar 2012 22:58:01 +0000 (23:58 +0100)
sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java

index 3833590a216d93c45e94a61a304cb76841512a61..781f8691f8462df678a5996cf4f989a1a1de7d03 100644 (file)
@@ -36,7 +36,7 @@ public final class DatabaseUtils {
    * This list is hardcoded because we didn't succeed in using java.sql.DatabaseMetaData#getTables() in the same way
    * for all the supported databases, particularly due to Oracle results.
    */
-  public static final String[] TABLE_NAMES = {
+  static final String[] TABLE_NAMES = {
     "action_plans",
     "action_plans_reviews",
     "active_dashboards",
index 1d3b431a4e613ec61ea48aad29d24d734d6bee67..3f2d1bd38f003602907494f629d625c41084f5f0 100644 (file)
@@ -53,7 +53,7 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
         return versions.get(versions.size() - 1);
       }
       return null;
-    } catch (Exception e) {
+    } catch (RuntimeException e) {
       // The table SCHEMA_MIGRATIONS does not exist.
       // Ignore this exception -> it will be created by Ruby on Rails migrations.
       return null;
index 5789a23e24e79431eb26675e063574e001199778..336a370696399bf36540e01df53367827c76e00a 100644 (file)
@@ -38,6 +38,14 @@ public class PicoUtilsTest {
     assertThat(th.getMessage(), Is.is("A good reason to fail"));
   }
 
+  @Test
+  public void shouldSanitizePicoLifecycleException_no_wrapper_message() {
+    Throwable th = PicoUtils.sanitize(new PicoLifecycleException(null, null, new IllegalStateException("msg")));
+
+    assertThat(th, Is.is(IllegalStateException.class));
+    assertThat(th.getMessage(), Is.is("msg"));
+  }
+
   @Test
   public void shouldNotSanitizeOtherExceptions() {
     Throwable th = PicoUtils.sanitize(new IllegalArgumentException("foo"));