Commit f779e7e7 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Make sure to return an IQ error in case that something goes wrong. JM-954

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6968 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6daea70c
......@@ -11,6 +11,7 @@
package org.jivesoftware.wildfire.handler;
import org.jivesoftware.stringprep.IDNAException;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.*;
......@@ -116,9 +117,21 @@ public class IQRosterHandler extends IQHandler implements ServerFeaturesProvider
return result;
}
catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
if (e.getCause() instanceof IDNAException) {
Log.warn(LocaleUtils.getLocalizedString("admin.error"), e);
IQ result = IQ.createResultIQ(packet);
result.setChildElement(packet.getChildElement().createCopy());
result.setError(PacketError.Condition.jid_malformed);
return result;
}
else {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
IQ result = IQ.createResultIQ(packet);
result.setChildElement(packet.getChildElement().createCopy());
result.setError(PacketError.Condition.internal_server_error);
return result;
}
}
return null;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment