UnmergedPathException.java

  1. /*
  2.  * Copyright (C) 2008-2009, 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. import java.io.IOException;
  12. import java.text.MessageFormat;

  13. import org.eclipse.jgit.dircache.DirCacheEntry;
  14. import org.eclipse.jgit.internal.JGitText;

  15. /**
  16.  * Indicates one or more paths in a DirCache have non-zero stages present.
  17.  */
  18. public class UnmergedPathException extends IOException {
  19.     private static final long serialVersionUID = 1L;

  20.     private final DirCacheEntry entry;

  21.     /**
  22.      * Create a new unmerged path exception.
  23.      *
  24.      * @param dce
  25.      *            the first non-zero stage of the unmerged path.
  26.      */
  27.     public UnmergedPathException(DirCacheEntry dce) {
  28.         super(MessageFormat.format(JGitText.get().unmergedPath, dce.getPathString()));
  29.         entry = dce;
  30.     }

  31.     /**
  32.      * Get the first non-zero stage of the unmerged path
  33.      *
  34.      * @return the first non-zero stage of the unmerged path
  35.      */
  36.     public DirCacheEntry getDirCacheEntry() {
  37.         return entry;
  38.     }
  39. }