You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IncorrectObjectTypeException.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) 2009, Google Inc.
  3. * Copyright (C) 2008, Jonas Fonseca <fonseca@diku.dk>
  4. * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
  5. * Copyright (C) 2006-2007, Shawn O. Pearce <spearce@spearce.org> and others
  6. *
  7. * This program and the accompanying materials are made available under the
  8. * terms of the Eclipse Distribution License v. 1.0 which is available at
  9. * https://www.eclipse.org/org/documents/edl-v10.php.
  10. *
  11. * SPDX-License-Identifier: BSD-3-Clause
  12. */
  13. package org.eclipse.jgit.errors;
  14. import java.io.IOException;
  15. import java.text.MessageFormat;
  16. import org.eclipse.jgit.internal.JGitText;
  17. import org.eclipse.jgit.lib.Constants;
  18. import org.eclipse.jgit.lib.ObjectId;
  19. /**
  20. * An inconsistency with respect to handling different object types.
  21. *
  22. * This most likely signals a programming error rather than a corrupt
  23. * object database.
  24. */
  25. public class IncorrectObjectTypeException extends IOException {
  26. private static final long serialVersionUID = 1L;
  27. /**
  28. * Construct an IncorrectObjectTypeException for the specified object id.
  29. *
  30. * Provide the type to make it easier to track down the problem.
  31. *
  32. * @param id SHA-1
  33. * @param type object type
  34. */
  35. public IncorrectObjectTypeException(ObjectId id, String type) {
  36. super(MessageFormat.format(JGitText.get().objectIsNotA, id.name(), type));
  37. }
  38. /**
  39. * Construct an IncorrectObjectTypeException for the specified object id.
  40. *
  41. * Provide the type to make it easier to track down the problem.
  42. *
  43. * @param id SHA-1
  44. * @param type object type
  45. */
  46. public IncorrectObjectTypeException(ObjectId id, int type) {
  47. this(id, Constants.typeString(type));
  48. }
  49. }