Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-38557] Don' use an empty category or type anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 4, 2017
1 parent 2beb380 commit f210dee
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -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();

Expand Down Expand Up @@ -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++;

Expand All @@ -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>.
*
Expand Down

0 comments on commit f210dee

Please sign in to comment.