public void connectionClosedOnError(Exception e) { done = false; if (e instanceof XMPPException) { XMPPException xmppEx = (XMPPException) e; StreamError error = xmppEx.getStreamError(); // Make sure the error is not null if (error != null) { String reason = error.getCode(); if ("conflict".equals(reason)) { return; } } } if (this.isReconnectionAllowed()) { this.reconnect(); } }
public void connectionClosedOnError(Exception ex) { handleDisconnect(); String message = Res.getString("message.disconnected.error"); if (ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { message = Res.getString("message.disconnected.conflict.error"); } } getTranscriptWindow().insertNotificationMessage(message, ChatManager.ERROR_COLOR); }
/** * Parses stream error packets. * * @param parser the XML parser. * @return an stream error packet. * @throws Exception if an exception occurs while parsing the packet. */ public static StreamError parseStreamError(XmlPullParser parser) throws IOException, XmlPullParserException { final int depth = parser.getDepth(); boolean done = false; String code = null; String text = null; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { String namespace = parser.getNamespace(); if (StreamError.NAMESPACE.equals(namespace)) { String name = parser.getName(); if (name.equals("text") && !parser.isEmptyElementTag()) { parser.next(); text = parser.getText(); } else { // If it's not a text element, that is qualified by the StreamError.NAMESPACE, // then it has to be the stream error code code = name; } } } else if (eventType == XmlPullParser.END_TAG && depth == parser.getDepth()) { done = true; } } return new StreamError(code, text); }
/** * Parses stream error packets. * * @param doc * the XML parser. * @return an stream error packet. * @throws Exception * if an exception occurs while parsing the packet. */ public static StreamError parseStreamError(Element el) throws IOException, XmlPullParserException { String code = null; Element condEl = (Element) el.elements().iterator().next(); if (condEl.getNamespace().getURI().equals(StreamError.NAMESPACE)) { code = condEl.getName(); } String text = condEl.elementText("text"); return new StreamError(code, text); }
public void connectionClosedOnError(final Exception ex) { String errorMessage = Res.getString("message.disconnected.error"); if (ex != null && ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException) ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { errorMessage = Res .getString("message.disconnected.conflict.error"); } else if ("system-shutdown".equals(reason)) { errorMessage = Res.getString("message.disconnected.shutdown"); } else { errorMessage = Res.getString("message.general.error", reason); } } switch (localPreferences.getReconnectPanelType()) { case 0: final String message = errorMessage; SwingUtilities.invokeLater(new Runnable() { public void run() { _reconnectPanel.setClosedOnError(true); reconnect(message); } }); break; case 1: switchAllUserOffline(true); _reconnectpanelsmall.setReconnectText(errorMessage); break; case 2: switchAllUserOfflineNoGroupEntry(true); _reconnectpanelicon.setReconnectText(errorMessage); break; } }
/** * Parses stream error packets. * * @param parser the XML parser. * @return an stream error packet. * @throws XmlPullParserException if an exception occurs while parsing the packet. * @throws SmackException */ public static StreamError parseStreamError(XmlPullParser parser) throws IOException, XmlPullParserException, SmackException { final int initialDepth = parser.getDepth(); List<ExtensionElement> extensions = new ArrayList<ExtensionElement>(); Map<String, String> descriptiveTexts = null; StreamError.Condition condition = null; String conditionText = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); String namespace = parser.getNamespace(); switch (namespace) { case StreamError.NAMESPACE: switch (name) { case "text": descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); break; default: // If it's not a text element, that is qualified by the StreamError.NAMESPACE, // then it has to be the stream error code condition = StreamError.Condition.fromString(name); if (!parser.isEmptyElementTag()) { conditionText = parser.nextText(); } break; } break; default: PacketParserUtils.addExtensionElement(extensions, parser, name, namespace); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return new StreamError(condition, conditionText, descriptiveTexts, extensions); }
/** * Creates a new XMPPException with the stream error that was the root case of the * exception. When a stream error is received from the server then the underlying connection * will be closed by the server. * * @param streamError the root cause of the exception. */ public StreamErrorException(StreamError streamError) { super(streamError.getCondition().toString() + " You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions\n" + streamError.toString()); this.streamError = streamError; }
/** * Returns the StreamError associated with this exception. The underlying TCP connection is * closed by the server after sending the stream error to the client. * * @return the StreamError associated with this exception. */ public StreamError getStreamError() { return streamError; }
/** * Cretaes a new XMPPException with the stream error that was the root case of the * exception. When a stream error is received from the server then the underlying * TCP connection will be closed by the server. * * @param streamError the root cause of the exception. */ public XMPPException(StreamError streamError) { super(); this.streamError = streamError; }
/** * Returns the StreamError asscociated with this exception, or <tt>null</tt> if there * isn't one. The underlying TCP connection is closed by the server after sending the * stream error to the client. * * @return the StreamError asscociated with this exception. */ public StreamError getStreamError() { return streamError; }
/** * Cretaes a new XMPPException with the stream error that was the root case * of the exception. When a stream error is received from the server then * the underlying TCP connection will be closed by the server. * * @param streamError * the root cause of the exception. */ public XMPPException(StreamError streamError) { super(); this.streamError = streamError; }
/** * Returns the StreamError asscociated with this exception, or <tt>null</tt> * if there isn't one. The underlying TCP connection is closed by the server * after sending the stream error to the client. * * @return the StreamError asscociated with this exception. */ public StreamError getStreamError() { return streamError; }
/** * Creates a new XMPPException with the stream error that was the root case * of the exception. When a stream error is received from the server then * the underlying TCP connection will be closed by the server. * * @param streamError * the root cause of the exception. */ public XMPPException(StreamError streamError) { super(); this.streamError = streamError; }
/** * Creates a new XMPPException with the stream error that was the root case of the * exception. When a stream error is received from the server then the underlying * TCP connection will be closed by the server. * * @param streamError the root cause of the exception. */ public XMPPException(StreamError streamError) { super(); this.streamError = streamError; }