TooLargePackException.java

  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. package org.eclipse.jgit.errors;

  11. import java.text.MessageFormat;

  12. import org.eclipse.jgit.internal.JGitText;
  13. import org.eclipse.jgit.transport.URIish;

  14. /**
  15.  * Thrown when a pack exceeds a given size limit
  16.  *
  17.  * @since 3.3
  18.  */
  19. public class TooLargePackException extends TransportException {
  20.     private static final long serialVersionUID = 1L;

  21.     /**
  22.      * Construct a too large pack exception.
  23.      *
  24.      * @param packSizeLimit
  25.      *            the pack size limit (in bytes) that was exceeded
  26.      */
  27.     public TooLargePackException(long packSizeLimit) {
  28.         super(MessageFormat.format(JGitText.get().receivePackTooLarge,
  29.                 Long.valueOf(packSizeLimit)));
  30.     }

  31.     /**
  32.      * Construct a too large pack exception.
  33.      *
  34.      * @param uri
  35.      *            URI used for transport
  36.      * @param s
  37.      *            message
  38.      * @since 4.0
  39.      */
  40.     public TooLargePackException(URIish uri, String s) {
  41.         super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
  42.     }
  43. }