1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-14 06:51:08 +01:00

Expose InterruptedException

SMACK-632
This commit is contained in:
Florian Schmaus 2015-02-14 09:43:44 +01:00
parent 43b99a2a85
commit bc61527bd2
124 changed files with 977 additions and 597 deletions

View file

@ -79,7 +79,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
"method");
}
public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException {
public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException, InterruptedException {
PacketCollector collector = connection.createPacketCollectorAndSend(
getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()),
super.createInitiationAccept(initiation, getNamespaces()));
@ -144,7 +144,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
}
public OutputStream createOutgoingStream(String streamID, String initiator, String target)
throws SmackException, XMPPException {
throws SmackException, XMPPException, InterruptedException {
OutputStream stream;
try {
stream = primaryNegotiator.createOutgoingStream(streamID, initiator, target);

View file

@ -163,8 +163,9 @@ public class FileTransferManager extends Manager {
* </p>
* @param request
* @throws NotConnectedException
* @throws InterruptedException
*/
protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {
protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException, InterruptedException {
StreamInitiation initiation = request.getStreamInitiation();
// Reject as specified in XEP-95 4.2. Note that this is not to be confused with the Socks 5

View file

@ -181,9 +181,10 @@ public class FileTransferNegotiator extends Manager {
* there is not an appropriate stream method.
* @throws NotConnectedException
* @throws NoAcceptableTransferMechanisms
* @throws InterruptedException
*/
public StreamNegotiator selectStreamNegotiator(
FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms {
FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms, InterruptedException {
StreamInitiation si = request.getStreamInitiation();
FormField streamMethodField = getStreamMethodField(si
.getFeatureNegotiationForm());
@ -299,10 +300,11 @@ public class FileTransferNegotiator extends Manager {
* @throws NotConnectedException
* @throws NoResponseException
* @throws NoAcceptableTransferMechanisms
* @throws InterruptedException
*/
public StreamNegotiator negotiateOutgoingTransfer(final String userID,
final String streamID, final String fileName, final long size,
final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms {
final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms, InterruptedException {
StreamInitiation si = new StreamInitiation();
si.setSessionID(streamID);
si.setMimeType(URLConnection.guessContentTypeFromName(fileName));

View file

@ -129,8 +129,9 @@ public class FileTransferRequest {
/**
* Rejects the file transfer request.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void reject() throws NotConnectedException {
public void reject() throws NotConnectedException, InterruptedException {
manager.rejectIncomingFileTransfer(this);
}

View file

@ -63,14 +63,14 @@ public class IBBTransferNegotiator extends StreamNegotiator {
}
public OutputStream createOutgoingStream(String streamID, String initiator,
String target) throws NoResponseException, XMPPErrorException, NotConnectedException {
String target) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
InBandBytestreamSession session = this.manager.establishSession(target, streamID);
session.setCloseBothStreamsEnabled(true);
return session.getOutputStream();
}
public InputStream createIncomingStream(StreamInitiation initiation)
throws NoResponseException, XMPPErrorException, NotConnectedException {
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
/*
* In-Band Bytestream initiation listener must ignore next in-band bytestream request with
* given session ID
@ -96,7 +96,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
return new String[] { DataPacketExtension.NAMESPACE };
}
InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException {
InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException, InterruptedException {
// build In-Band Bytestream request
InBandBytestreamRequest request = new ByteStreamRequest(this.manager,
(Open) streamInitiation);

View file

@ -76,8 +76,9 @@ public class IncomingFileTransfer extends FileTransfer {
* @throws SmackException
* @throws XMPPErrorException If there is an error in the negotiation process an exception
* is thrown.
* @throws InterruptedException
*/
public InputStream recieveFile() throws SmackException, XMPPErrorException {
public InputStream recieveFile() throws SmackException, XMPPErrorException, InterruptedException {
if (inputStream != null) {
throw new IllegalStateException("Transfer already negotiated!");
}
@ -174,7 +175,7 @@ public class IncomingFileTransfer extends FileTransfer {
transferThread.start();
}
private InputStream negotiateStream() throws SmackException, XMPPErrorException {
private InputStream negotiateStream() throws SmackException, XMPPErrorException, InterruptedException {
setStatus(Status.negotiating_transfer);
final StreamNegotiator streamNegotiator = negotiator
.selectStreamNegotiator(recieveRequest);

View file

@ -120,9 +120,10 @@ public class OutgoingFileTransfer extends FileTransfer {
* Thrown if an error occurs during the file transfer
* negotiation process.
* @throws SmackException if there was no response from the server.
* @throws InterruptedException
*/
public synchronized OutputStream sendFile(String fileName, long fileSize,
String description) throws XMPPException, SmackException {
String description) throws XMPPException, SmackException, InterruptedException {
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotation process has already"
@ -373,7 +374,7 @@ public class OutgoingFileTransfer extends FileTransfer {
}
private OutputStream negotiateStream(String fileName, long fileSize,
String description) throws SmackException, XMPPException {
String description) throws SmackException, XMPPException, InterruptedException {
// Negotiate the file transfer profile
if (!updateStatus(Status.initial, Status.negotiating_transfer)) {

View file

@ -72,7 +72,7 @@ public abstract class StreamNegotiator {
return response;
}
Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException {
Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
StreamInitiation response = createInitiationAccept(initiation,
getNamespaces());
@ -134,9 +134,10 @@ public abstract class StreamNegotiator {
* exception will be thrown.
* @throws SmackException
* @throws XMPPException
* @throws InterruptedException
*/
public abstract OutputStream createOutgoingStream(String streamID,
String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException;
String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException, InterruptedException;
/**
* Returns the XMPP namespace reserved for this particular type of file