/** * Complete and send an error. Complete all the null fields in an IQ error * response, using the session information we have or some info from the * incoming packet. * * @param iq * The Jingle stanza we are responding to * @param jingleError * the IQ stanza we want to complete and send */ public IQ createJingleError(IQ iq, JingleError jingleError) { IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition); builder.addExtension(jingleError); errorPacket = IQ.createErrorResponse(iq, builder); // errorPacket.addExtension(jingleError); // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); LOGGER.severe("Error sent: " + errorPacket.toXML(null)); } return errorPacket; }
/** * Responds an error with an specific condition. * * @param response the response to send. * @param condition the condition of the error. * @param specificCondition the adhoc command error condition. * @throws NotConnectedException */ private static IQ respondError(AdHocCommandData response, StanzaError.Condition condition, AdHocCommand.SpecificErrorCondition specificCondition) { StanzaError.Builder error = StanzaError.getBuilder(condition).addExtension(new AdHocCommandData.SpecificError(specificCondition)); return respondError(response, error); }
public IQ createErrorUnknownSession(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.item_not_found) .addExtension(JingleError.UNKNOWN_SESSION); return IQ.createErrorResponse(request, error); }
public IQ createErrorOutOfOrder(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.unexpected_request) .addExtension(JingleError.OUT_OF_ORDER); return IQ.createErrorResponse(request, error); }
public IQ createErrorUnsupportedInfo(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.feature_not_implemented) .addExtension(JingleError.UNSUPPORTED_INFO); return IQ.createErrorResponse(request, error); }
public IQ createErrorTieBreak(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.conflict) .addExtension(JingleError.TIE_BREAK); return IQ.createErrorResponse(request, error); }