1package org.apache.archiva.policies;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import org.apache.archiva.common.ArchivaException;
2324import java.util.Collections;
25import java.util.Map;
2627/**28 * One or more exceptions occurred downloading from a remote repository during the proxy phase.29 */30publicclassProxyDownloadException31extends ArchivaException
32 {
33/**34 * A list of failures keyed by repository ID.35 */36privatefinal Map<String, Exception> failures;
3738publicProxyDownloadException( String message, String repositoryId, Exception cause )
39 {
40super( constructMessage( message, Collections.singletonMap( repositoryId, cause ) ), cause );
4142 failures = Collections.singletonMap( repositoryId, cause );
43 }
4445publicProxyDownloadException( String message, Map<String, Exception> failures )
46 {
47super( constructMessage( message, failures ) );
4849this.failures = failures;
50 }
5152privatestatic String constructMessage( String message, Map<String, Exception> failures )
53 {
54 StringBuilder msg = new StringBuilder( message );
55 msg.append( ":" );
56for ( Map.Entry<String, Exception> entry : failures.entrySet() )
57 {
58 msg.append( "\n\t" ).append( entry.getKey() ).append( ": " ).append( entry.getValue().getMessage() );
59 }
60return msg.toString();
61 }
6263public Map<String, Exception> getFailures()
64 {
65return failures;
66 }
67 }