diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-09 15:08:37 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-09 15:08:37 +0200 |
commit | fc635a302c1d7b12f9d504d1315d82b247eef716 (patch) | |
tree | e38805846f92216910bc3a4c4d4644182cd5c644 | |
parent | 4a2ccbccdc1ddb45722abcfee6f4c0383d4d2c37 (diff) | |
download | sonarqube-fc635a302c1d7b12f9d504d1315d82b247eef716.tar.gz sonarqube-fc635a302c1d7b12f9d504d1315d82b247eef716.zip |
Fix compatibility with Oracle
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java index 87528e5c554..b46108b8840 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java @@ -66,7 +66,7 @@ public class CloseReviewsDecorator implements Decorator { } String generateSqlRequest(int resourceId, int snapshotId) { - return "UPDATE reviews SET status='CLOSED' " + "WHERE resource_id = " + resourceId + " AND rule_failure_permanent_id NOT IN " + return "UPDATE reviews SET status='CLOSED' WHERE resource_id = " + resourceId + " AND rule_failure_permanent_id NOT IN " + "(SELECT permanent_id FROM rule_failures WHERE snapshot_id = " + snapshotId + " AND permanent_id IS NOT NULL)"; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java index 920436892a9..9a5eac592ad 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java @@ -125,7 +125,7 @@ public class VariationDecorator implements Decorator { } static final class MeasureKey { - Integer metricId; + int metricId; Integer characteristicId; MeasureKey(Object[] pastFields) { @@ -133,7 +133,7 @@ public class VariationDecorator implements Decorator { characteristicId = PastMeasuresLoader.getCharacteristicId(pastFields); } - MeasureKey(Integer metricId, Integer characteristicId) { + MeasureKey(int metricId, Integer characteristicId) { this.metricId = metricId; this.characteristicId = characteristicId; } @@ -147,10 +147,10 @@ public class VariationDecorator implements Decorator { return false; } MeasureKey that = (MeasureKey) o; - if (characteristicId != null ? !characteristicId.equals(that.characteristicId) : that.characteristicId != null) { + if (metricId != that.metricId) { return false; } - if (!metricId.equals(that.metricId)) { + if (characteristicId != null ? !characteristicId.equals(that.characteristicId) : that.characteristicId != null) { return false; } return true; @@ -158,7 +158,7 @@ public class VariationDecorator implements Decorator { @Override public int hashCode() { - int result = metricId.hashCode(); + int result = metricId; result = 31 * result + (characteristicId != null ? characteristicId.hashCode() : 0); return result; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java index 95e5dff7bee..11683350a8b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java @@ -79,12 +79,15 @@ public class PastMeasuresLoader implements BatchExtension { return resource.getId() != null; } - public static Integer getMetricId(Object[] row) { - return (Integer) row[0]; + public static int getMetricId(Object[] row) { + // can be BigDecimal on Oracle + return ((Number)row[0]).intValue(); } public static Integer getCharacteristicId(Object[] row) { - return (Integer) row[1]; + // can be BigDecimal on Oracle + Number number = (Number) row[1]; + return number!=null ? number.intValue() : null; } public static boolean hasValue(Object[] row) { |