Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-38557] Don' use an empty category or type anymore.
  • Loading branch information
uhafner committed Jan 4, 2017
1 parent 2beb380 commit f210dee1f6f77ca485bf695376f330e997dc3505
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java
@@ -40,6 +40,8 @@ public abstract class AbstractAnnotation implements FileAnnotation, Serializable
public static final String WORKSPACE_FILES = "workspace-files";
/** Unique identifier of this class. */
private static final long serialVersionUID = -1092014926477547148L;
public static final String DEFAULT_CATEGORY = "-";

/** Current key of this annotation. */
private static long currentKey = new Random().nextLong();

@@ -100,8 +102,8 @@ public abstract class AbstractAnnotation implements FileAnnotation, Serializable
@SuppressFBWarnings("ST")
public AbstractAnnotation(final String message, final int start, final int end, final String category, final String type) {
this.message = TreeString.of(StringUtils.strip(message));
this.category = StringUtils.defaultString(category);
this.type = StringUtils.defaultString(type);
this.category = defaultString(category);
this.type = defaultString(type);

key = currentKey++;

@@ -112,6 +114,10 @@ public AbstractAnnotation(final String message, final int start, final int end,
contextHashCode = currentKey;
}

private static String defaultString(final String value) {
return StringUtils.defaultIfBlank(value, DEFAULT_CATEGORY);
}

/**
* Creates a new instance of <code>AbstractAnnotation</code>.
*

0 comments on commit f210dee

Please sign in to comment.