private void sendErrorPacket(Route packet, PacketError.Condition error, Element extraError) {
        Route reply = new Route(packet.getStreamID());
        reply.setID(packet.getID());
        reply.setFrom(packet.getTo());
        reply.setTo(packet.getFrom());
        reply.setError(error);
        if (extraError != null) {
            // Add specific application error if available
            reply.getError().getElement().add(extraError);
        }
        deliver(reply);
    }
Sends an IQ error with the specified condition to the sender of the original
IQ packet.

@param packet     the packet to be bounced.
@param extraError application specific error or null if none.
@param error the error.
xmppserver/src/main/java/org/jivesoftware/openfire/multiplex/MultiplexerPacketHandler.java