aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-db-dao/src/main')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java23
-rw-r--r--server/sonar-db-dao/src/main/protobuf/db-issues.proto2
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml12
3 files changed, 28 insertions, 9 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java
index 1cbc7ee2660..55dffc5b7c2 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java
@@ -115,7 +115,7 @@ public final class IssueDto implements Serializable {
.setLine(issue.line())
.setLocations((DbIssues.Locations) issue.getLocations())
.setMessage(issue.message())
- .setMessageFormattings((byte[]) null)
+ .setMessageFormattings((DbIssues.MessageFormattings) issue.getMessageFormattings())
.setGap(issue.gap())
.setEffort(issue.effortInMinutes())
.setResolution(issue.resolution())
@@ -142,7 +142,6 @@ public final class IssueDto implements Serializable {
.setQuickFixAvailable(issue.isQuickFixAvailable())
.setIsNewCodeReferenceIssue(issue.isNewCodeReferenceIssue())
-
// technical dates
.setCreatedAt(now)
.setUpdatedAt(now);
@@ -165,7 +164,7 @@ public final class IssueDto implements Serializable {
.setLine(issue.line())
.setLocations((DbIssues.Locations) issue.getLocations())
.setMessage(issue.message())
- .setMessageFormattings((byte[]) null)
+ .setMessageFormattings((DbIssues.MessageFormattings) issue.getMessageFormattings())
.setGap(issue.gap())
.setEffort(issue.effortInMinutes())
.setResolution(issue.resolution())
@@ -265,7 +264,11 @@ public final class IssueDto implements Serializable {
return this;
}
- public IssueDto setMessageFormattings(@Nullable byte[] messageFormattings) {
+ public byte[] getMessageFormattings() {
+ return messageFormattings;
+ }
+
+ public IssueDto setMessageFormattings(byte[] messageFormattings) {
this.messageFormattings = messageFormattings;
return this;
}
@@ -280,8 +283,15 @@ public final class IssueDto implements Serializable {
}
@CheckForNull
- public byte[] getMessageFormattings() {
- return messageFormattings;
+ public DbIssues.MessageFormattings parseMessageFormattings() {
+ if (messageFormattings != null) {
+ try {
+ return DbIssues.MessageFormattings.parseFrom(messageFormattings);
+ } catch (InvalidProtocolBufferException e) {
+ throw new IllegalStateException(String.format("Fail to read ISSUES.MESSAGE_FORMATTINGS [KEE=%s]", kee), e);
+ }
+ }
+ return null;
}
@CheckForNull
@@ -744,6 +754,7 @@ public final class IssueDto implements Serializable {
issue.setStatus(status);
issue.setResolution(resolution);
issue.setMessage(message);
+ issue.setMessageFormattings(parseMessageFormattings());
issue.setGap(gap);
issue.setEffort(effort != null ? Duration.create(effort) : null);
issue.setLine(line);
diff --git a/server/sonar-db-dao/src/main/protobuf/db-issues.proto b/server/sonar-db-dao/src/main/protobuf/db-issues.proto
index 8672388eecc..7632d34656a 100644
--- a/server/sonar-db-dao/src/main/protobuf/db-issues.proto
+++ b/server/sonar-db-dao/src/main/protobuf/db-issues.proto
@@ -54,7 +54,7 @@ message Location {
optional sonarqube.db.commons.TextRange text_range = 2;
optional string msg = 3;
optional string checksum = 4;
- repeated MessageFormatting msgFormattings = 5;
+ repeated MessageFormatting msgFormatting = 5;
}
message MessageFormattings {
repeated MessageFormatting messageFormatting = 1;
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
index ae2e340fa64..84824708ea9 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
@@ -10,6 +10,7 @@
i.severity as severity,
i.manual_severity as manualSeverity,
i.message as message,
+ i.message_formattings as messageFormattings,
i.line as line,
i.locations as locations,
i.gap as gap,
@@ -48,6 +49,7 @@
i.severity,
i.manual_severity,
i.message,
+ i.message_formattings,
i.line,
i.locations,
i.gap,
@@ -107,14 +109,17 @@
<insert id="insert" parameterType="Issue" useGeneratedKeys="false">
INSERT INTO issues (kee, rule_uuid, severity, manual_severity,
- message, line, locations, gap, effort, status, tags, rule_description_context_key,
+ message, message_formattings, line, locations, gap, effort, status, tags, rule_description_context_key,
resolution, checksum, assignee, author_login, issue_creation_date, issue_update_date,
issue_close_date, created_at, updated_at, component_uuid, project_uuid, issue_type, quick_fix_available)
VALUES (
#{kee,jdbcType=VARCHAR},
#{ruleUuid,jdbcType=VARCHAR},
#{severity,jdbcType=VARCHAR},
- #{manualSeverity,jdbcType=BOOLEAN}, #{message,jdbcType=VARCHAR}, #{line,jdbcType=INTEGER},
+ #{manualSeverity,jdbcType=BOOLEAN},
+ #{message,jdbcType=VARCHAR},
+ #{messageFormattings,jdbcType=BINARY},
+ #{line,jdbcType=INTEGER},
#{locations,jdbcType=BINARY},
#{gap,jdbcType=DOUBLE}, #{effort,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR},
#{tagsString,jdbcType=VARCHAR},
@@ -150,6 +155,7 @@
severity=#{severity,jdbcType=VARCHAR},
manual_severity=#{manualSeverity,jdbcType=BOOLEAN},
message=#{message,jdbcType=VARCHAR},
+ message_formattings=#{messageFormattings,jdbcType=BINARY},
line=#{line,jdbcType=INTEGER},
locations=#{locations,jdbcType=BINARY},
gap=#{gap,jdbcType=DOUBLE},
@@ -178,6 +184,7 @@
severity=#{severity,jdbcType=VARCHAR},
manual_severity=#{manualSeverity,jdbcType=BOOLEAN},
message=#{message,jdbcType=VARCHAR},
+ message_formattings=#{messageFormattings,jdbcType=BINARY},
line=#{line,jdbcType=INTEGER},
locations=#{locations,jdbcType=BINARY},
gap=#{gap,jdbcType=DOUBLE},
@@ -749,6 +756,7 @@
r.plugin_name as ruleRepo,
r.plugin_rule_key as ruleKey,
i.message as message,
+ i.message_formattings as messageFormattings,
i.severity as severity,
i.manual_severity as manualSeverity,
i.issue_type as type,