aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-03-14 23:50:01 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-03-14 23:58:01 +0100
commit94f0a69457d1ec7f72b1603e5409ace2c6d99b81 (patch)
tree99374f4f054e63d86ba23dcb24259f9f959a4043 /sonar-core
parentb7c7b336023b6813ac8a16292f5c1557aa2f2bef (diff)
downloadsonarqube-94f0a69457d1ec7f72b1603e5409ace2c6d99b81.tar.gz
sonarqube-94f0a69457d1ec7f72b1603e5409ace2c6d99b81.zip
Fix some quality flaws
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java8
3 files changed, 10 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
index 3833590a216..781f8691f84 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
@@ -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",
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 1d3b431a4e6..3f2d1bd38f0 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -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;
diff --git a/sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java
index 5789a23e24e..336a3706963 100644
--- a/sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/PicoUtilsTest.java
@@ -39,6 +39,14 @@ public class PicoUtilsTest {
}
@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"));