1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

SMACK-430 Re-activated code that throws an exception if createOutgoingFileTransfer() was called with a bare JID

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13580 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-03-22 18:15:06 +00:00 committed by flow
parent 3891c738ad
commit a7d73993b0

View file

@ -27,6 +27,7 @@ import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.packet.StreamInitiation;
import java.util.ArrayList;
@ -125,18 +126,21 @@ public class FileTransferManager {
* Creates an OutgoingFileTransfer to send a file to another user.
*
* @param userID
* The fully qualified jabber ID with resource of the user to
* The fully qualified jabber ID (i.e. full JID) with resource of the user to
* send the file to.
* @return The send file object on which the negotiated transfer can be run.
* @exception IllegalArgumentException if userID is null or not a full JID
*/
public OutgoingFileTransfer createOutgoingFileTransfer(String userID) {
// Why is this only accepting fully qualified JID?
// if (userID == null || StringUtils.parseName(userID).length() <= 0
// || StringUtils.parseServer(userID).length() <= 0
// || StringUtils.parseResource(userID).length() <= 0) {
// throw new IllegalArgumentException(
// "The provided user id was not fully qualified");
// }
if (userID == null) {
throw new IllegalArgumentException("userID was null");
}
// We need to create outgoing file transfers with a full JID since this method will later
// use XEP-0095 to negotiate the stream. This is done with IQ stanzas that need to be addressed to a full JID
// in order to reach an client entity.
else if (!StringUtils.isFullJID(userID)) {
throw new IllegalArgumentException("The provided user id was not a full JID (i.e. with resource part)");
}
return new OutgoingFileTransfer(connection.getUser(), userID,
fileTransferNegotiator.getNextStreamID(),