mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52: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:
parent
3891c738ad
commit
a7d73993b0
1 changed files with 12 additions and 8 deletions
|
@ -27,6 +27,7 @@ import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Packet;
|
||||||
import org.jivesoftware.smack.packet.XMPPError;
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smackx.packet.StreamInitiation;
|
import org.jivesoftware.smackx.packet.StreamInitiation;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -125,18 +126,21 @@ public class FileTransferManager {
|
||||||
* Creates an OutgoingFileTransfer to send a file to another user.
|
* Creates an OutgoingFileTransfer to send a file to another user.
|
||||||
*
|
*
|
||||||
* @param userID
|
* @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.
|
* send the file to.
|
||||||
* @return The send file object on which the negotiated transfer can be run.
|
* @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) {
|
public OutgoingFileTransfer createOutgoingFileTransfer(String userID) {
|
||||||
// Why is this only accepting fully qualified JID?
|
if (userID == null) {
|
||||||
// if (userID == null || StringUtils.parseName(userID).length() <= 0
|
throw new IllegalArgumentException("userID was null");
|
||||||
// || StringUtils.parseServer(userID).length() <= 0
|
}
|
||||||
// || StringUtils.parseResource(userID).length() <= 0) {
|
// We need to create outgoing file transfers with a full JID since this method will later
|
||||||
// throw new IllegalArgumentException(
|
// use XEP-0095 to negotiate the stream. This is done with IQ stanzas that need to be addressed to a full JID
|
||||||
// "The provided user id was not fully qualified");
|
// 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,
|
return new OutgoingFileTransfer(connection.getUser(), userID,
|
||||||
fileTransferNegotiator.getNextStreamID(),
|
fileTransferNegotiator.getNextStreamID(),
|
||||||
|
|
Loading…
Reference in a new issue