src/main/java/org/jamppa/component/utils/XMPPUtils.java
public static IQ createErrorResponse(final IQ request,
            final String message, Condition condition, Type type) {
        final IQ result = request.createCopy();
        result.setID(request.getID());
        result.setFrom(request.getTo());
        result.setTo(request.getFrom());

        PacketError e = new PacketError(condition, type);
        if (message != null) {
            e.setText(message);
        }
        result.setError(e);

        return result;
    }
public static IQ createErrorResponse(final IQ request,
            final String message, Condition condition, Type type) {
        final IQ result = request.createCopy();
        result.setID(request.getID());
        result.setFrom(request.getTo());
        result.setTo(request.getFrom());

        PacketError e = new PacketError(condition, type);
        if (message != null) {
            e.setText(message);
        }
        result.setError(e);

        return result;
    }
Creates an error response for a given IQ request.

@param request
@param message
@param condition
@param type
@return