summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2012-01-01 21:48:15 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2012-01-01 21:48:15 +0100
commit9215b60984179e3fc28cea11a032556de4f7abdf (patch)
tree9bff4660b874f5af517d8ed4a9380235e12c709a
parent7a87485a457afd837eb89a1df66d2287b122171d (diff)
downloadsonarqube-9215b60984179e3fc28cea11a032556de4f7abdf.tar.gz
sonarqube-9215b60984179e3fc28cea11a032556de4f7abdf.zip
Fix some quality flaws
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseMigrator.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java2
4 files changed, 12 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
index 5dcda3d3332..253ca73c2b2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java
@@ -155,7 +155,7 @@ public class DefaultSensorContext implements SensorContext {
return index.getOutgoingEdges(resourceOrProject(from));
}
- public void saveSource(Resource reference, String source) throws DuplicatedSourceException {
+ public void saveSource(Resource reference, String source) {
index.setSource(reference, source);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
index 57037c987fd..c9058d855bd 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
@@ -87,7 +87,7 @@ public final class DefaultResourcePersister implements ResourcePersister {
return snapshotsByResource.get(reference);
}
- public Snapshot getSnapshotOrFail(Resource resource) throws ResourceNotPersistedException {
+ public Snapshot getSnapshotOrFail(Resource resource) {
Snapshot snapshot = getSnapshot(resource);
if (snapshot == null) {
throw new ResourceNotPersistedException(resource);
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseMigrator.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseMigrator.java
index 889bcd2014f..3e6e5623862 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseMigrator.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseMigrator.java
@@ -51,7 +51,15 @@ public class DatabaseMigrator implements ServerComponent {
try {
DdlUtils.createSchema(connection, database.getDialect().getId());
} finally {
- session.close();
+ try {
+ session.close();
+
+ // The connection is probably already closed by session.close()
+ // but it's not documented in mybatis javadoc.
+ connection.close();
+ } catch (Exception e) {
+ // ignore
+ }
}
return true;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
index c0a56de9dd3..3c3a94bd4b9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java
@@ -184,7 +184,7 @@ public class MeasureModel implements Cloneable {
*
* @throws IllegalArgumentException in case value is not a valid double
*/
- public MeasureModel setValue(Double value) throws IllegalArgumentException {
+ public MeasureModel setValue(Double value) {
if (value != null && (value.isNaN() || value.isInfinite())) {
throw new IllegalArgumentException();
}