import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.Duration;
import org.sonar.api.utils.KeyValueFormat;
-import org.sonar.core.util.Uuids;
import org.sonar.core.issue.DefaultIssue;
+import org.sonar.core.util.Uuids;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.protobuf.DbIssues;
import org.sonar.db.rule.RuleDto;
+import static com.google.common.base.Preconditions.checkArgument;
import static org.sonar.api.utils.DateUtils.dateToLong;
import static org.sonar.api.utils.DateUtils.longToDate;
}
public IssueDto setMessage(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 4000, "Value is too long for column ISSUES.MESSAGE: %s", s);
this.message = s;
return this;
}
}
public IssueDto setReporter(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 255, "Value is too long for column ISSUES.REPORTER: %s", s);
this.reporter = s;
return this;
}
}
public IssueDto setAssignee(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 255, "Value is too long for column ISSUES.ASSIGNEE: %s", s);
this.assignee = s;
return this;
}
return authorLogin;
}
- public IssueDto setAuthorLogin(@Nullable String authorLogin) {
- this.authorLogin = authorLogin;
+ public IssueDto setAuthorLogin(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 255, "Value is too long for column ISSUES.AUTHOR_LOGIN: %s", s);
+ this.authorLogin = s;
return this;
}
}
public IssueDto setIssueAttributes(@Nullable String s) {
- Preconditions.checkArgument(s == null || s.length() <= 4000,
- "Issue attributes must not exceed 4000 characters: " + s);
+ checkArgument(s == null || s.length() <= 4000, "Value is too long for column ISSUES.ATTRIBUTES: %s", s);
this.issueAttributes = s;
return this;
}
* <p/>
* Please use {@link #setComponent(ComponentDto)} instead
*/
- public IssueDto setComponentUuid(@Nullable String componentUuid) {
- this.componentUuid = componentUuid;
+ public IssueDto setComponentUuid(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 50, "Value is too long for column ISSUES.COMPONENT_UUID: %s", s);
+ this.componentUuid = s;
return this;
}
* <p/>
* Please use {@link #setProject(ComponentDto)} instead
*/
- public IssueDto setProjectUuid(@Nullable String projectUuid) {
- this.projectUuid = projectUuid;
+ public IssueDto setProjectUuid(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 50, "Value is too long for column ISSUES.PROJECT_UUID: %s", s);
+ this.projectUuid = s;
return this;
}
return ImmutableSet.copyOf(TAGS_SPLITTER.split(tags == null ? "" : tags));
}
- public IssueDto setTags(Collection<String> tags) {
- if (tags.isEmpty()) {
- this.tags = null;
+ public IssueDto setTags(@Nullable Collection<String> tags) {
+ if (tags == null || tags.isEmpty()) {
+ setTagsString(null);
} else {
- this.tags = TAGS_JOINER.join(tags);
+ setTagsString(TAGS_JOINER.join(tags));
}
return this;
}
- public String getTagsString() {
- return tags;
+ public IssueDto setTagsString(@Nullable String s) {
+ checkArgument(s == null || s.length() <= 4000, "Value is too long for column ISSUES.TAGS: %s", s);
+ this.tags = s;
+ return this;
}
- public IssueDto setTagsString(String tags) {
- this.tags = tags;
- return this;
+ public String getTagsString() {
+ return tags;
}
@CheckForNull