View Javadoc

1   package org.sonatype.aether.transfer;
2   
3   /*******************************************************************************
4    * Copyright (c) 2010-2011 Sonatype, Inc.
5    * All rights reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    *   http://www.eclipse.org/legal/epl-v10.html
9    *******************************************************************************/
10  
11  import org.sonatype.aether.RepositoryException;
12  
13  /**
14   * Thrown in case of a checksum failure during an artifact/metadata download.
15   * 
16   * @author Benjamin Bentmann
17   */
18  public class ChecksumFailureException
19      extends RepositoryException
20  {
21  
22      private final String expected;
23  
24      private final String actual;
25  
26      public ChecksumFailureException( String expected, String actual )
27      {
28          super( "Checksum validation failed, expected " + expected + " but is " + actual );
29  
30          this.expected = expected;
31          this.actual = actual;
32      }
33  
34      public ChecksumFailureException( String message )
35      {
36          super( message );
37          expected = actual = "";
38      }
39  
40      public ChecksumFailureException( Throwable cause )
41      {
42          super( "Checksum validation failed, could not read expected checksum" + getMessage( ": ", cause ), cause );
43          expected = actual = "";
44      }
45  
46      public ChecksumFailureException( String message, Throwable cause )
47      {
48          super( message, cause );
49          expected = actual = "";
50      }
51  
52      public String getExpected()
53      {
54          return expected;
55      }
56  
57      public String getActual()
58      {
59          return actual;
60      }
61  
62  }