1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.connector.basic;
20
21 import org.eclipse.aether.repository.RemoteRepository;
22 import org.eclipse.aether.spi.connector.ArtifactTransfer;
23 import org.eclipse.aether.spi.connector.transport.Transporter;
24 import org.eclipse.aether.transfer.ArtifactNotFoundException;
25 import org.eclipse.aether.transfer.ArtifactTransferException;
26 import org.eclipse.aether.transfer.TransferEvent;
27
28 final class ArtifactTransportListener extends TransferTransportListener<ArtifactTransfer> {
29
30 private final RemoteRepository repository;
31
32 ArtifactTransportListener(
33 ArtifactTransfer transfer, RemoteRepository repository, TransferEvent.Builder eventBuilder) {
34 super(transfer, eventBuilder);
35 this.repository = repository;
36 }
37
38 @Override
39 public void transferFailed(Exception exception, int classification) {
40 ArtifactTransferException e;
41 if (classification == Transporter.ERROR_NOT_FOUND) {
42 e = new ArtifactNotFoundException(getTransfer().getArtifact(), repository);
43 } else {
44 e = new ArtifactTransferException(getTransfer().getArtifact(), repository, exception);
45 }
46 getTransfer().setException(e);
47 super.transferFailed(e, classification);
48 }
49 }