private void sendErrorPacket(IQ originalPacket, PacketError.Condition condition) {
        if (IQ.Type.error == originalPacket.getType()) {
            Log.error("Cannot reply an IQ error to another IQ error: " + originalPacket.toXML());
            return;
        }
        if (originalPacket.getFrom() == null) {
            if (Log.isDebugEnabled()) {
                Log.debug("Original IQ has no sender for reply; dropped: " + originalPacket.toXML());
            }
            return;
        }
        IQ reply = IQ.createResultIQ(originalPacket);
        reply.setChildElement(originalPacket.getChildElement().createCopy());
        reply.setError(condition);
        // Check if the server was the sender of the IQ
        if (serverName.equals(originalPacket.getFrom().toString())) {
            // Just let the IQ router process the IQ error reply
            handle(reply);
            return;
        }
        // Route the error packet to the original sender of the IQ.
        XMPPServer.getInstance().getPacketRouter().route(reply);
    }
A JID is considered local if:
1) is null or
2) has no domain or domain is empty
or
if it's not a full JID and it was sent to the server itself.

@param recipientJID address to check.
@return true if the specified address belongs to the local server.
xmppserver/src/main/java/org/jivesoftware/openfire/IQRouter.java