public void setUp() { stanzaError = new PacketError(Condition.not_acceptable); applicationError = new PacketError( Condition.undefined_condition, Type.modify, ERROR_TEXT, "en"); }
/** * Sets the packet error using the specified condition. Calling this * method will automatically set the packet "type" attribute to "error". * This is a convenience method equivalent to calling: * * <tt>setError(new PacketError(condition));</tt> * * @param condition the error condition. */ public void SetError(PacketError.Condition condition) { SetError(new PacketError(condition)); }
/** * Sets the packet error. Calling this method will automatically set * the packet "type" attribute to "error". * * @param error the packet error. */ public void SetError(PacketError error) { if (element == null) { throw new NullReferenceException("Error cannot be null"); } // Force the packet type to "error". element.Add(new XAttribute("type", "error")); // Remove an existing error packet. if (element.Element("error") != null) { element.Element("error").Remove(); } // Add the error element. element.Add(error.GetElement()); }