Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-04-09 13:53:58 -0400
committerslewis2008-04-09 13:53:58 -0400
commit9e526c7f8169c36c64549cc8184261b3ffa549a8 (patch)
tree21ca088a5125930c226d3b10ad14df6b13dcf504
parenta95ee0bc899cc90046e0f03f28991a9bf1d90cc7 (diff)
downloadorg.eclipse.ecf-9e526c7f8169c36c64549cc8184261b3ffa549a8.tar.gz
org.eclipse.ecf-9e526c7f8169c36c64549cc8184261b3ffa549a8.tar.xz
org.eclipse.ecf-9e526c7f8169c36c64549cc8184261b3ffa549a8.zip
Fix failure case so that fails if problem other than Invalid RangeException occurs.
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.filetransfer/src/org/eclipse/ecf/tests/filetransfer/URLPartialRetrieveTest.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.filetransfer/src/org/eclipse/ecf/tests/filetransfer/URLPartialRetrieveTest.java b/tests/bundles/org.eclipse.ecf.tests.filetransfer/src/org/eclipse/ecf/tests/filetransfer/URLPartialRetrieveTest.java
index bd9b8925c..c27d5dec2 100755
--- a/tests/bundles/org.eclipse.ecf.tests.filetransfer/src/org/eclipse/ecf/tests/filetransfer/URLPartialRetrieveTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.filetransfer/src/org/eclipse/ecf/tests/filetransfer/URLPartialRetrieveTest.java
@@ -19,6 +19,8 @@ import org.eclipse.ecf.filetransfer.IFileRangeSpecification;
import org.eclipse.ecf.filetransfer.IFileTransferListener;
import org.eclipse.ecf.filetransfer.IFileTransferPausable;
import org.eclipse.ecf.filetransfer.IIncomingFileTransfer;
+import org.eclipse.ecf.filetransfer.IncomingFileTransferException;
+import org.eclipse.ecf.filetransfer.InvalidFileRangeSpecificationException;
import org.eclipse.ecf.filetransfer.events.IFileTransferEvent;
import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveDataEvent;
import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveDoneEvent;
@@ -92,20 +94,20 @@ public class URLPartialRetrieveTest extends ContainerAbstractTestCase {
public void handleTransferEvent(IFileTransferEvent event) {
if (event instanceof IIncomingFileTransferReceiveResumedEvent) {
try {
- IIncomingFileTransferReceiveResumedEvent rse = (IIncomingFileTransferReceiveResumedEvent) event;
+ final IIncomingFileTransferReceiveResumedEvent rse = (IIncomingFileTransferReceiveResumedEvent) event;
session = rse.receive(outs);
- } catch (Exception e) {
+ } catch (final Exception e) {
fail(e.getLocalizedMessage());
}
} else if (event instanceof IIncomingFileTransferReceiveStartEvent) {
- IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
+ final IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
try {
outs = new FileOutputStream(FILENAME);
session = rse.receive(outs);
pausable = (IFileTransferPausable) session.getAdapter(IFileTransferPausable.class);
if (pausable == null)
fail("pausable is null");
- } catch (IOException e) {
+ } catch (final IOException e) {
fail(e.getLocalizedMessage());
}
} else if (event instanceof IIncomingFileTransferReceiveDataEvent) {
@@ -182,7 +184,11 @@ public class URLPartialRetrieveTest extends ContainerAbstractTestCase {
// should fail with invalid range spec
testReceiveHttp(10, 5, HTTP_RETRIEVE);
fail();
- } catch (final Exception e) {
+ } catch (final IncomingFileTransferException e) {
+ final Throwable t = e.getCause();
+ if (t != null && t instanceof InvalidFileRangeSpecificationException)
+ return;
+ fail();
}
}

Back to the top