diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-23 14:06:12 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-23 14:06:12 +0100 |
commit | e79441c60f92861462124347bdf2d598aaeb18c3 (patch) | |
tree | fbf8f6062c8cced3c60fbb82ab1bf679735303cf /sonar-db | |
parent | 59eeb3eb17ea51588f3b2f1d998bd6ddaaab3f14 (diff) | |
download | sonarqube-e79441c60f92861462124347bdf2d598aaeb18c3.tar.gz sonarqube-e79441c60f92861462124347bdf2d598aaeb18c3.zip |
SONAR-7129 Fix snapshot path builder for Oracle
Diffstat (limited to 'sonar-db')
-rw-r--r-- | sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java index 749c21e3aff..7fe84cd77c1 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java @@ -54,7 +54,7 @@ public class ComponentTreeQuery { this.page = builder.page; this.pageSize = builder.pageSize; this.baseSnapshot = builder.baseSnapshot; - this.baseSnapshotPath = buildLikeValue(baseSnapshot.getPath() + baseSnapshot.getId() + ".", WildcardPosition.AFTER); + this.baseSnapshotPath = buildBaseSnapshotPath(baseSnapshot); this.direction = builder.asc ? "ASC" : "DESC"; this.sqlSort = sortFieldsToSqlSort(builder.sortFields, direction); } @@ -112,6 +112,11 @@ public class ComponentTreeQuery { return Joiner.on(", ").join(sqlSortFields); } + private String buildBaseSnapshotPath(SnapshotDto baseSnapshot) { + String existingSnapshotPath = baseSnapshot.getPath() == null ? "" : baseSnapshot.getPath(); + return buildLikeValue(existingSnapshotPath + baseSnapshot.getId() + ".", WildcardPosition.AFTER); + } + public static class Builder { @CheckForNull private String nameOrKeyQuery; |