Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.XMPPError


        }
    }
   
    protected boolean roomDoesNotExist(XMPPException exception)
    {
        XMPPError error = exception.getXMPPError();
        if ((error.getCode() == 404) &&
            error.getCondition().equals(XMPPError.Condition.recipient_unavailable.toString()))
        {
            return true;
        }
        return false;
    }
View Full Code Here


        Message result = new Message();

        if (muleMessage.getExceptionPayload() != null)
        {
            result.setError(
                new XMPPError(XMPPError.Condition.service_unavailable,
                    muleMessage.getExceptionPayload().getMessage()));
        }

        for (String propertyName : muleMessage.getOutboundPropertyNames())
        {
View Full Code Here

        else
        {
            response.setTo(message.getUri());
        }
       
        XMPPError error = (XMPPError) context.getProperty(XMPPFaultHandler.XMPP_ERROR);
        if (error != null)
            response.setError(error);

        conn.sendPacket(response);
    }
View Full Code Here

         * env:Receiver             500          <internal-server-error/>
         * env:DataEncodingUnknown  500          <internal-server-error/>
         */

        XFireFault fault = (XFireFault) context.getExchange().getFaultMessage().getBody();
        XMPPError error = null;
        if (fault.getFaultCode().equals(XFireFault.SENDER))
        {
            error = new XMPPError(400);
        }
        else
        {
            error = new XMPPError(500);
        }
       
        context.setProperty(XMPP_ERROR, error);
    }
View Full Code Here

    @Override
    public void processPacket(Packet packet) {
      Message errorMsg = (Message)packet;
//      Util.showPacketInfo("MessageError", packet);
//      Util.showMsgInfo("MessageError", errorMsg);
      XMPPError error = packet.getError();
      if(error != null){
        Util.showErrMsg("\n信息发送失败。错误类型:" + error.getType().toString() + "\t错误代码:"+ error.getCode());
      }
    }
View Full Code Here

 
    /**
     * Check the creation of a new xmppError locally.
    */
    public void testLocalErrorCreation() {
      XMPPError error = new XMPPError(XMPPError.Condition.item_not_found);
        error.toXML();

      assertEquals(error.getCondition(), "item-not-found");
      assertEquals(error.getCode(), 404);
      assertEquals(error.getType(), XMPPError.Type.CANCEL);
      assertNull(error.getMessage());
    }
View Full Code Here

    /**
     * Check the creation of a new xmppError locally.
    */
    public void testLocalErrorWithCommentCreation() {
        String message = "Error Message";
        XMPPError error = new XMPPError(XMPPError.Condition.item_not_found, message);
        error.toXML();

        assertEquals(error.getCondition(), "item-not-found");
        assertEquals(error.getCode(), 404);
        assertEquals(error.getType(), XMPPError.Type.CANCEL);
        assertEquals(error.getMessage(), message);
    }
View Full Code Here

    /**
     * Check the creation of a new xmppError locally where there is not a default defined.
    */
    public void testUserDefinedErrorWithCommentCreation() {
        String message = "Error Message";
        XMPPError error = new XMPPError(new XMPPError.Condition("my_own_error"), message);
        error.toXML();

        assertEquals(error.getCondition(), "my_own_error");
        assertEquals(error.getCode(), 0);
        assertNull(error.getType());
        assertEquals(error.getMessage(), message);
    }
View Full Code Here

          "</error></iq>";
        try {
          // Create the xml parser
          XmlPullParser parser = getParserFromXML(xml);
          // Create a packet from the xml
          XMPPError packet = parseError(parser);
         
            assertNotNull(packet);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

          "</error>";
        try {
          // Create the xml parser
          XmlPullParser parser = getParserFromXML(xml);
          // Create a packet from the xml
          XMPPError error = parseError(parser);
         
            assertNotNull(error);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
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.