diff --git a/moskito-core/src/main/java/net/anotheria/moskito/core/tag/Tag.java b/moskito-core/src/main/java/net/anotheria/moskito/core/tag/Tag.java index 6696d2adf..1cc3aabb1 100644 --- a/moskito-core/src/main/java/net/anotheria/moskito/core/tag/Tag.java +++ b/moskito-core/src/main/java/net/anotheria/moskito/core/tag/Tag.java @@ -15,6 +15,10 @@ */ public class Tag implements Comparable { + /** + * String null value. + */ + private final static String NULL = "null"; /** * Tag name. */ @@ -68,7 +72,8 @@ public void addValue(String value) { lock.writeLock().lock(); try { - if (lastValues.peekLast() != null && lastValues.peekLast().equals(value)) { + final String lastValue = value != null ? value : NULL; + if (lastValues.contains(lastValue)) { return; } @@ -76,7 +81,7 @@ public void addValue(String value) { lastValues.removeFirst(); } - lastValues.add(value != null ? value : ""); + lastValues.add(lastValue); } finally { lock.writeLock().unlock(); } @@ -84,7 +89,7 @@ public void addValue(String value) { } @Override - public int compareTo(Tag o){ + public int compareTo(Tag o) { if (getType().equals(o.getType())) return getName().compareTo(o.getName()); return getType().compareTo(o.getType());