diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-07 09:29:57 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-07 09:29:57 +0100 |
commit | 169c63d511d2f657520c0c301da6ba984fb3b253 (patch) | |
tree | 0cce3904cae1454aae27d86dc5d1e1277261334b /sonar-core/src | |
parent | d25b9bf9edc9561a6d8917f2c236725d05256053 (diff) | |
download | sonarqube-169c63d511d2f657520c0c301da6ba984fb3b253.tar.gz sonarqube-169c63d511d2f657520c0c301da6ba984fb3b253.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-core/src')
4 files changed, 15 insertions, 6 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java index c0c00ae9be3..f08e78de9a4 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java +++ b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java @@ -188,7 +188,8 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM */ public boolean isCompatibleWith(String sonarVersion) { if (null == this.sonarVersion) { - return true; // Plugins without sonar version are so old, they are compatible with a version containing this code + // Plugins without sonar version are so old, they are compatible with a version containing this code + return true; } Version minimumVersion = Version.createRelease(this.sonarVersion); diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java b/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java index a5aaf015c3d..62d9219919e 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java +++ b/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java @@ -149,7 +149,8 @@ public class PluginClassloaders { LOG.warn("Plugin " + plugin.getKey() + " is ignored because base plugin is not installed: " + plugin.getBasePlugin()); return false; } - base.createChildRealm(plugin.getKey()); // we create new realm to be able to return it by key without conversion to baseKey + // we create new realm to be able to return it by key without conversion to baseKey + base.createChildRealm(plugin.getKey()); for (File file : plugin.getDeployedFiles()) { base.addURL(file.toURI().toURL()); } diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java index 56c09193bac..d24b1194510 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java @@ -127,7 +127,8 @@ public class PurgeDao { List<PurgeableSnapshotDto> result = Lists.newArrayList(); result.addAll(mapper.selectPurgeableSnapshotsWithEvents(resourceId)); result.addAll(mapper.selectPurgeableSnapshotsWithoutEvents(resourceId)); - Collections.sort(result);// sort by date + // sort by date + Collections.sort(result); return result; } finally { MyBatis.closeQuietly(session); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java index 70502a7f5a1..fd7d34270f9 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java @@ -24,8 +24,7 @@ import org.junit.Test; import java.util.Properties; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.fest.assertions.Assertions.assertThat; public class PostgreSQLSequenceGeneratorTest { @@ -37,7 +36,14 @@ public class PostgreSQLSequenceGeneratorTest { PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator(); generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect()); - assertThat(generator.getSequenceName(), is("my_table_id_seq")); + assertThat(generator.getSequenceName()).isEqualTo("my_table_id_seq"); } + @Test + public void should_not_fail_if_table_name_can_not_be_loaded() { + Properties props = new Properties(); + PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator(); + generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect()); + assertThat(generator.getSequenceName()).isNotEmpty(); + } } |