1 package org.apache.maven.model.resolution; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.maven.model.Repository; 23 24 /** 25 * Signals an error when adding a repository to the model resolver. 26 * 27 * @author Benjamin Bentmann 28 */ 29 public class InvalidRepositoryException 30 extends Exception 31 { 32 33 /** 34 * The repository that raised this error, can be {@code null}. 35 */ 36 private Repository repository; 37 38 /** 39 * Creates a new exception with specified detail message and cause for the given repository. 40 * 41 * @param message The detail message, may be {@code null}. 42 * @param repository The repository that caused the error, may be {@code null}. 43 * @param cause The cause, may be {@code null}. 44 */ 45 public InvalidRepositoryException( String message, Repository repository, Throwable cause ) 46 { 47 super( message, cause ); 48 this.repository = repository; 49 } 50 51 /** 52 * Creates a new exception with specified detail message for the given repository. 53 * 54 * @param message The detail message, may be {@code null}. 55 * @param repository The repository that caused the error, may be {@code null}. 56 */ 57 public InvalidRepositoryException( String message, Repository repository ) 58 { 59 super( message ); 60 this.repository = repository; 61 } 62 63 /** 64 * Gets the repository that causes this error (if any). 65 * 66 * @return The repository that causes this error or {@code null} if not known. 67 */ 68 public Repository getRepository() 69 { 70 return repository; 71 } 72 73 }