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.

RepositoryNotFoundException.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2009-2010, 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.File;
  12. import java.text.MessageFormat;
  13. import org.eclipse.jgit.internal.JGitText;
  14. /**
  15. * Indicates a local repository does not exist.
  16. */
  17. public class RepositoryNotFoundException extends TransportException {
  18. private static final long serialVersionUID = 1L;
  19. /**
  20. * Constructs an exception indicating a local repository does not exist.
  21. *
  22. * @param location
  23. * description of the repository not found, usually file path.
  24. */
  25. public RepositoryNotFoundException(File location) {
  26. this(location.getPath());
  27. }
  28. /**
  29. * Constructs an exception indicating a local repository does not exist.
  30. *
  31. * @param location
  32. * description of the repository not found, usually file path.
  33. * @param why
  34. * why the repository does not exist.
  35. */
  36. public RepositoryNotFoundException(File location, Throwable why) {
  37. this(location.getPath(), why);
  38. }
  39. /**
  40. * Constructs an exception indicating a local repository does not exist.
  41. *
  42. * @param location
  43. * description of the repository not found, usually file path.
  44. */
  45. public RepositoryNotFoundException(String location) {
  46. super(message(location));
  47. }
  48. /**
  49. * Constructs an exception indicating a local repository does not exist.
  50. *
  51. * @param location
  52. * description of the repository not found, usually file path.
  53. * @param why
  54. * why the repository does not exist.
  55. */
  56. public RepositoryNotFoundException(String location, Throwable why) {
  57. super(message(location), why);
  58. }
  59. private static String message(String location) {
  60. return MessageFormat.format(JGitText.get().repositoryNotFound, location);
  61. }
  62. }