diff --git a/src/main/java/org/ice4j/ice/sdp/CandidateAttribute.java b/src/main/java/org/ice4j/ice/sdp/CandidateAttribute.java index 578e21e..f2deb76 100644 --- a/src/main/java/org/ice4j/ice/sdp/CandidateAttribute.java +++ b/src/main/java/org/ice4j/ice/sdp/CandidateAttribute.java @@ -32,6 +32,7 @@ public class CandidateAttribute extends AttributeField protected CandidateAttribute() { + this(null); } /** @@ -44,6 +45,29 @@ public class CandidateAttribute extends AttributeField this.candidate = candidate; } + /** + * {@inheritDoc} + */ + public NameValue getAttribute() + { + // We've overridden the method getValue() of AttributeField. The + // NameValue pair of the method getAttribute() should return the value of + // the method getValue() of AttributeField then. Unfortunately, NameValue + // accesses its field value in multiple places so it is not a question of + // simply overriding a method or two. As a compromise, initialize a new + // NameValue with the current name and value upon each invocation. + NameValue attribute = super.getAttribute(); + String name = getName(); + + if ((attribute == null) + || (name.equals(attribute.getName()) + && (attribute.getValue() == null))) + { + attribute = new NameValue(name, getValue()); + } + return attribute; + } + /** * Returns the name of this attribute *