diff options
author | sliebig | 2007-12-04 07:50:21 +0000 |
---|---|---|
committer | sliebig | 2007-12-04 07:50:21 +0000 |
commit | f14a41f4539236d1d474d3647794993816fdaf95 (patch) | |
tree | 0b5e8fa30f5643f65853b7c84c952b0d42556e3a /bundles | |
parent | 971fb7585cdd4fa7c4fddc65446312042ab3ce2e (diff) | |
download | rt.equinox.p2-f14a41f4539236d1d474d3647794993816fdaf95.tar.gz rt.equinox.p2-f14a41f4539236d1d474d3647794993816fdaf95.tar.xz rt.equinox.p2-f14a41f4539236d1d474d3647794993816fdaf95.zip |
fixing bug 200716
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java index dd26df402..10ffb21e9 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java @@ -63,7 +63,8 @@ public class ECFTransport extends Transport { public IStatus download(String toDownload, OutputStream target, IProgressMonitor monitor) { IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory) retrievalFactoryTracker.getService(); if (factory == null) - return new Status(IStatus.ERROR, Activator.ID, "ECF Transfer manager not available"); + return statusOn(target, new Status(IStatus.ERROR, Activator.ID, "ECF Transfer manager not available")); + return transfer(factory.newInstance(), toDownload, target, monitor); } @@ -78,7 +79,11 @@ public class ECFTransport extends Transport { rse.receive(target); } } catch (IOException e) { - e.printStackTrace(); + IStatus status = convertToStatus(e); + synchronized (result) { + result[0] = status; + result.notify(); + } } } if (event instanceof IIncomingFileTransferReceiveDataEvent) { @@ -120,9 +125,9 @@ public class ECFTransport extends Transport { try { retrievalContainer.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getRetrieveNamespace(), toDownload), listener, null); } catch (IncomingFileTransferException e) { - return new Status(IStatus.ERROR, Activator.ID, "error during transfer", e); + return statusOn(target, new Status(IStatus.ERROR, Activator.ID, "error during transfer", e)); } catch (FileCreateException e) { - return new Status(IStatus.ERROR, Activator.ID, "error during transfer - could not create file", e); + return statusOn(target, new Status(IStatus.ERROR, Activator.ID, "error during transfer - could not create file", e)); } synchronized (result) { while (result[0] == null) { @@ -136,9 +141,12 @@ public class ECFTransport extends Transport { } } - if (target instanceof IStateful) { - ((IStateful) target).setStatus(result[0]); - } - return result[0]; + return statusOn(target, result[0]); + } + + private static IStatus statusOn(OutputStream target, IStatus status) { + if (target instanceof IStateful) + ((IStateful) target).setStatus(status); + return status; } } |