View Javadoc
1   /*
2    * Copyright (C) 2014, Sasa Zivkov <sasa.zivkov@sap.com>, SAP AG and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  
11  package org.eclipse.jgit.errors;
12  
13  import java.text.MessageFormat;
14  
15  import org.eclipse.jgit.internal.JGitText;
16  import org.eclipse.jgit.transport.URIish;
17  
18  /**
19   * Thrown when a pack exceeds a given size limit
20   *
21   * @since 3.3
22   */
23  public class TooLargePackException extends TransportException {
24  	private static final long serialVersionUID = 1L;
25  
26  	/**
27  	 * Construct a too large pack exception.
28  	 *
29  	 * @param packSizeLimit
30  	 *            the pack size limit (in bytes) that was exceeded
31  	 */
32  	public TooLargePackException(long packSizeLimit) {
33  		super(MessageFormat.format(JGitText.get().receivePackTooLarge,
34  				Long.valueOf(packSizeLimit)));
35  	}
36  
37  	/**
38  	 * Construct a too large pack exception.
39  	 *
40  	 * @param uri
41  	 *            URI used for transport
42  	 * @param s
43  	 *            message
44  	 * @since 4.0
45  	 */
46  	public TooLargePackException(URIish uri, String s) {
47  		super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
48  	}
49  }