1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.transfer
;
13 import org
.eclipse
.aether
.metadata
.Metadata
;
14 import org
.eclipse
.aether
.repository
.LocalRepository
;
15 import org
.eclipse
.aether
.repository
.RemoteRepository
;
18 * Thrown when metadata was not found in a particular repository.
20 public class MetadataNotFoundException
21 extends MetadataTransferException
25 * Creates a new exception with the specified metadata and local repository.
27 * @param metadata The missing metadata, may be {@code null}.
28 * @param repository The involved local repository, may be {@code null}.
30 public MetadataNotFoundException( Metadata metadata
, LocalRepository repository
)
32 super( metadata
, null, "Could not find metadata " + metadata
+ getString( " in ", repository
) );
35 private static String
getString( String prefix
, LocalRepository repository
)
37 if ( repository
== null )
43 return prefix
+ repository
.getId() + " (" + repository
.getBasedir() + ")";
48 * Creates a new exception with the specified metadata and repository.
50 * @param metadata The missing metadata, may be {@code null}.
51 * @param repository The involved remote repository, may be {@code null}.
53 public MetadataNotFoundException( Metadata metadata
, RemoteRepository repository
)
55 super( metadata
, repository
, "Could not find metadata " + metadata
+ getString( " in ", repository
) );
59 * Creates a new exception with the specified metadata, repository and detail message.
61 * @param metadata The missing metadata, may be {@code null}.
62 * @param repository The involved remote repository, may be {@code null}.
63 * @param message The detail message, may be {@code null}.
65 public MetadataNotFoundException( Metadata metadata
, RemoteRepository repository
, String message
)
67 super( metadata
, repository
, message
);
71 * Creates a new exception with the specified metadata, repository and detail message.
73 * @param metadata The missing metadata, may be {@code null}.
74 * @param repository The involved remote repository, may be {@code null}.
75 * @param message The detail message, may be {@code null}.
76 * @param fromCache {@code true} if the exception was played back from the error cache, {@code false} if the
77 * exception actually just occurred.
79 public MetadataNotFoundException( Metadata metadata
, RemoteRepository repository
, String message
, boolean fromCache
)
81 super( metadata
, repository
, message
, fromCache
);
85 * Creates a new exception with the specified metadata, repository, detail message and cause.
87 * @param metadata The missing metadata, may be {@code null}.
88 * @param repository The involved remote repository, may be {@code null}.
89 * @param message The detail message, may be {@code null}.
90 * @param cause The exception that caused this one, may be {@code null}.
92 public MetadataNotFoundException( Metadata metadata
, RemoteRepository repository
, String message
, Throwable cause
)
94 super( metadata
, repository
, message
, cause
);