DirCacheNameConflictException.java

  1. /*
  2.  * Copyright (C) 2015, Google Inc. 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. /**
  12.  * Thrown by DirCache code when entries overlap in impossible way.
  13.  *
  14.  * @since 4.2
  15.  */
  16. public class DirCacheNameConflictException extends IllegalStateException {
  17.     private static final long serialVersionUID = 1L;

  18.     private final String path1;
  19.     private final String path2;

  20.     /**
  21.      * Construct an exception for a specific path.
  22.      *
  23.      * @param path1
  24.      *            one path that conflicts.
  25.      * @param path2
  26.      *            another path that conflicts.
  27.      */
  28.     public DirCacheNameConflictException(String path1, String path2) {
  29.         super(path1 + ' ' + path2);
  30.         this.path1 = path1;
  31.         this.path2 = path2;
  32.     }

  33.     /**
  34.      * Get one of the paths that has a conflict
  35.      *
  36.      * @return one of the paths that has a conflict
  37.      */
  38.     public String getPath1() {
  39.         return path1;
  40.     }

  41.     /**
  42.      * Get another path that has a conflict
  43.      *
  44.      * @return another path that has a conflict
  45.      */
  46.     public String getPath2() {
  47.         return path2;
  48.     }
  49. }