RevisionSyntaxException.java

  1. /*
  2.  * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
  3.  * Copyright (C) 2006, Shawn O. Pearce <spearce@spearce.org>
  4.  * Copyright (C) 2009, Vasyl' Vavrychuk <vvavrychuk@gmail.com> and others
  5.  *
  6.  * This program and the accompanying materials are made available under the
  7.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  8.  * https://www.eclipse.org/org/documents/edl-v10.php.
  9.  *
  10.  * SPDX-License-Identifier: BSD-3-Clause
  11.  */

  12. package org.eclipse.jgit.errors;


  13. /**
  14.  * This signals a revision or object reference was not
  15.  * properly formatted.
  16.  */
  17. public class RevisionSyntaxException extends IllegalArgumentException {
  18.     private static final long serialVersionUID = 1L;

  19.     private final String revstr;

  20.     /**
  21.      * Construct a RevisionSyntaxException indicating a syntax problem with a
  22.      * revision (or object) string.
  23.      *
  24.      * @param revstr The problematic revision string
  25.      */
  26.     public RevisionSyntaxException(String revstr) {
  27.         this.revstr = revstr;
  28.     }

  29.     /**
  30.      * Construct a RevisionSyntaxException indicating a syntax problem with a
  31.      * revision (or object) string.
  32.      *
  33.      * @param message a specific reason
  34.      * @param revstr The problematic revision string
  35.      */
  36.     public RevisionSyntaxException(String message, String revstr) {
  37.         super(message);
  38.         this.revstr = revstr;
  39.     }

  40.     /** {@inheritDoc} */
  41.     @Override
  42.     public String toString() {
  43.         return super.toString() + ":" + revstr; //$NON-NLS-1$
  44.     }
  45. }