Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.XMPPError


    }, "File Transfer " + streamID);
    transferThread.start();
  }

  private void handleXMPPException(XMPPException e) {
    XMPPError error = e.getXMPPError();
    if (error != null) {
      int code = error.getCode();
      if (code == 403) {
        setStatus(Status.refused);
        return;
      }
            else if (code == 400) {
View Full Code Here


                            parser.getAttributeValue("", "type"));
                    String value = parser.nextText();
                    adHocCommandData.addNote(new AdHocCommandNote(type, value));
                }
                else if (parser.getName().equals("error")) {
                    XMPPError error = PacketParserUtils.parseError(parser);
                    adHocCommandData.setError(error);
                }
            }
            else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("command")) {
View Full Code Here

    public static String getConnectionMessage(XMPPConnection connection) {
        return connection.getHost() + ":" + connection.getPort() + "/" + connection.getServiceName();
    }

    public static String getXmppExceptionLogMessage(XMPPException e) {
        XMPPError xmppError = e.getXMPPError();
        Throwable t = e.getWrappedThrowable();
        StringBuilder strBuff = new StringBuilder();
        if (xmppError != null) {
            strBuff.append("[ ").append(xmppError.getCode()).append(" ] ")
                .append(xmppError.getCondition()).append(" : ")
                .append(xmppError.getMessage());
        }
        if (t != null) {
            strBuff.append(" ( ").append(e.getWrappedThrowable().getMessage()).append(" )");
        }
        return strBuff.toString();
View Full Code Here

        try {
            result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

            if (result == null) {
                String errorMessage = "Timeout getting VCard information";
                throw new XMPPException(errorMessage, new XMPPError(
                        XMPPError.Condition.request_timeout, errorMessage));
            }
            if (result.getError() != null) {
                throw new XMPPException(result.getError());
            }
View Full Code Here

                this.socket = config.getSocketFactory().createSocket(host, port);
            }
        }
        catch (UnknownHostException uhe) {
            String errorMessage = "Could not connect to " + host + ":" + port + ".";
            throw new XMPPException(errorMessage, new XMPPError(
                    XMPPError.Condition.remote_server_timeout, errorMessage),
                    uhe);
        }
        catch (IOException ioe) {
            String errorMessage = "XMPPError connecting to " + host + ":"
                    + port + ".";
            throw new XMPPException(errorMessage, new XMPPError(
                    XMPPError.Condition.remote_server_error, errorMessage), ioe);
        }
        this.serviceName = config.getServiceName();
        initConnection();
    }
View Full Code Here

            }
        }
        catch (IOException ioe) {
            throw new XMPPException(
                    "XMPPError establishing connection with server.",
                    new XMPPError(XMPPError.Condition.remote_server_error,
                            "XMPPError establishing connection with server."),
                    ioe);
        }

        // If debugging is enabled, we open a window and write out all network traffic.
View Full Code Here

        FormField streamMethodField = getStreamMethodField(si
                .getFeatureNegotiationForm());

        if (streamMethodField == null) {
            String errorMessage = "No stream methods contained in packet.";
            XMPPError error = new XMPPError(XMPPError.Condition.bad_request, errorMessage);
            IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
                    IQ.Type.ERROR);
            iqPacket.setError(error);
            connection.sendPacket(iqPacket);
            throw new XMPPException(errorMessage, error);
View Full Code Here

                isIBB = true;
            }
        }

        if (!isByteStream && !isIBB) {
            XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                    "No acceptable transfer mechanism");
            throw new XMPPException(error.getMessage(), error);
        }

        if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
            return new FaultTolerantNegotiator(connection,
                    byteStreamTransferManager.createNegotiator(),
View Full Code Here

     * Reject a stream initiation request from a remote user.
     *
     * @param si The Stream Initiation request to reject.
     */
    public void rejectStream(final StreamInitiation si) {
        XMPPError error = new XMPPError(XMPPError.Condition.forbidden, "Offer Declined");
        IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
                IQ.Type.ERROR);
        iqPacket.setError(error);
        connection.sendPacket(iqPacket);
    }
View Full Code Here

                isIBB = true;
            }
        }

        if (!isByteStream && !isIBB) {
            XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                    "No acceptable transfer mechanism");
            throw new XMPPException(error.getMessage(), error);
        }

        if (isByteStream && isIBB) {
            return new FaultTolerantNegotiator(connection,
                    byteStreamTransferManager.createNegotiator(), inbandTransferManager);
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.packet.XMPPError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.