mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Rework XMPP Error class design
Introduce AbstractError, change 'Conditions' to enums. Because of AbstractError, it was necessary that PlainStreamElement and TopLevelStreamElement becomes an interface. Thus the implementation of TopLevelStreamElement.toString() had to be removed. This adds - policy-violation - unexpected-request to XMPPError.Condition, and removes the - payment-required - remote-server-error - unexpected-condition - request-timeout Conditions The file transfer code does now no longer throw XMPPErrorExceptions, but SmackExceptions. Fixes SMACK-608. Makes it possible to resolves SMACK-386.
This commit is contained in:
parent
cc09192095
commit
9286a1decb
31 changed files with 582 additions and 548 deletions
|
@ -33,7 +33,6 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.JingleListener;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.JingleMediaListener;
|
||||
|
@ -1030,9 +1029,8 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
public IQ createJingleError(IQ iq, JingleError jingleError) {
|
||||
IQ errorPacket = null;
|
||||
if (jingleError != null) {
|
||||
List<PacketExtension> extList = new ArrayList<PacketExtension>();
|
||||
extList.add(jingleError);
|
||||
XMPPError error = new XMPPError(XMPPError.Type.CANCEL, jingleError.toString(), "", extList);
|
||||
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
|
||||
XMPPError error = new XMPPError(XMPPError.Condition.undefined_condition, jingleError);
|
||||
|
||||
errorPacket = IQ.createErrorResponse(iq, error);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
setNegotiatorState(JingleNegotiatorState.FAILED);
|
||||
triggerMediaClosed(getBestCommonAudioPt());
|
||||
// This next line seems wrong, and may subvert the normal closing process.
|
||||
throw new JingleException(iq.getError().getMessage());
|
||||
throw new JingleException(iq.getError().getDescriptiveText());
|
||||
} else if (iq.getType().equals(IQ.Type.result)) {
|
||||
// Process ACKs
|
||||
if (isExpectedId(iq.getPacketID())) {
|
||||
|
|
|
@ -603,7 +603,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
setNegotiatorState(JingleNegotiatorState.FAILED);
|
||||
triggerTransportClosed(null);
|
||||
// This next line seems wrong, and may subvert the normal closing process.
|
||||
throw new JingleException(iq.getError().getMessage());
|
||||
throw new JingleException(iq.getError().getDescriptiveText());
|
||||
} else if (iq.getType().equals(IQ.Type.result)) {
|
||||
// Process ACKs
|
||||
if (isExpectedId(iq.getPacketID())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue