/** * Creates a new exception with the specified artifact and repository. * * @param artifact The missing artifact, may be {@code null}. * @param repository The involved remote repository, may be {@code null}. */ public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository ) { super( artifact, repository, getMessage( artifact, repository ) ); }
private static String getMessage( Artifact artifact, RemoteRepository repository ) { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( "Could not find artifact " ).append( artifact ); buffer.append( getString( " in ", repository ) ); if ( artifact != null ) { String localPath = artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ); if ( localPath != null && repository == null ) { buffer.append( " at specified path " ).append( localPath ); } String downloadUrl = artifact.getProperty( ArtifactProperties.DOWNLOAD_URL, null ); if ( downloadUrl != null ) { buffer.append( ", try downloading from " ).append( downloadUrl ); } } return buffer.toString(); }
private ArtifactTransferException newException(String error, Artifact artifact, RemoteRepository repository) { if (error == null || error.length() <= 0) { return new ArtifactNotFoundException(artifact, repository, "Failure to find " + artifact + " in " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced"); } else { return new ArtifactTransferException(artifact, repository, "Failure to transfer " + artifact + " from " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced. Original error: " + error); } }
private ArtifactTransferException newException(String error, Artifact artifact, RemoteRepository repository) { if (error == null || error.length() <= 0) { return new ArtifactNotFoundException(artifact, repository, "Failure to find " + artifact + " in " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced"); } else { return new ArtifactTransferException(artifact, repository, "Failure to transfer " + artifact + " from " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced. Original error: " + error); } }
private ArtifactTransferException newException( String error, Artifact artifact, RemoteRepository repository ) { if ( error == null || error.length() <= 0 ) { return new ArtifactNotFoundException( artifact, repository, "Failure to find " + artifact + " in " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced", true ); } else { return new ArtifactTransferException( artifact, repository, "Failure to transfer " + artifact + " from " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced. Original error: " + error, true ); } }
/** * Creates a new exception with the specified artifact and repository. * * @param artifact The missing artifact, may be {@code null}. * @param repository The involved remote repository, may be {@code null}. */ public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository ) { super( artifact, repository, getMessage( artifact, repository ) ); }
private static String getMessage( Artifact artifact, RemoteRepository repository ) { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( "Could not find artifact " ).append( artifact ); buffer.append( getString( " in ", repository ) ); if ( artifact != null ) { String localPath = artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ); if ( localPath != null && repository == null ) { buffer.append( " at specified path " ).append( localPath ); } String downloadUrl = artifact.getProperty( ArtifactProperties.DOWNLOAD_URL, null ); if ( downloadUrl != null ) { buffer.append( ", try downloading from " ).append( downloadUrl ); } } return buffer.toString(); }
private ArtifactTransferException newException( String error, Artifact artifact, RemoteRepository repository ) { if ( error == null || error.length() <= 0 ) { return new ArtifactNotFoundException( artifact, repository, "Failure to find " + artifact + " in " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced", true ); } else { return new ArtifactTransferException( artifact, repository, "Failure to transfer " + artifact + " from " + repository.getUrl() + " was cached in the local repository, " + "resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced. Original error: " + error, true ); } }
public Exception wrap( ArtifactTransfer transfer, Exception e, RemoteRepository repository ) { ArtifactTransferException ex = null; e = WagonCancelledException.unwrap( e ); if ( e instanceof ResourceDoesNotExistException ) { ex = new ArtifactNotFoundException( transfer.getArtifact(), repository ); } else if ( e != null ) { ex = new ArtifactTransferException( transfer.getArtifact(), repository, e ); } transfer.setException( ex ); return ex; }
@Override public void transferFailed( Exception exception, int classification ) { ArtifactTransferException e; if ( classification == Transporter.ERROR_NOT_FOUND ) { e = new ArtifactNotFoundException( getTransfer().getArtifact(), repository ); } else { e = new ArtifactTransferException( getTransfer().getArtifact(), repository, exception ); } getTransfer().setException( e ); super.transferFailed( e, classification ); }
@Override public void transferFailed( Exception exception, int classification ) { ArtifactTransferException e; if ( classification == Transporter.ERROR_NOT_FOUND ) { e = new ArtifactNotFoundException( getTransfer().getArtifact(), repository ); } else { e = new ArtifactTransferException( getTransfer().getArtifact(), repository, exception ); } getTransfer().setException( e ); super.transferFailed( e, classification ); }
if ( Direction.DOWNLOAD.equals( direction ) ) artEx = new ArtifactNotFoundException( transfer.getArtifact(), repository );
result.addException( new ArtifactNotFoundException( artifact, null ) ); new ArtifactNotFoundException( artifact, repo, "Cannot access " + repo.getId() + " (" + repo.getUrl() + ") in offline mode and the artifact " + artifact + " has not been downloaded from it before.", e ); if ( result.getExceptions().isEmpty() ) Exception exception = new ArtifactNotFoundException( request.getArtifact(), null ); result.addException( exception );
result.addException( new ArtifactNotFoundException( artifact, null ) ); new ArtifactNotFoundException( artifact, repo, "Cannot access " + repo.getId() + " (" + repo.getUrl() + ") in offline mode and the artifact " + artifact + " has not been downloaded from it before.", e ); if ( result.getExceptions().isEmpty() ) Exception exception = new ArtifactNotFoundException( request.getArtifact(), null ); result.addException( exception );