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.

MissingBundlePrerequisiteException.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2008, Google Inc.
  3. * Copyright (C) 2009, Sasa Zivkov <sasa.zivkov@sap.com> and others
  4. *
  5. * This program and the accompanying materials are made available under the
  6. * terms of the Eclipse Distribution License v. 1.0 which is available at
  7. * https://www.eclipse.org/org/documents/edl-v10.php.
  8. *
  9. * SPDX-License-Identifier: BSD-3-Clause
  10. */
  11. package org.eclipse.jgit.errors;
  12. import java.util.Map;
  13. import org.eclipse.jgit.internal.JGitText;
  14. import org.eclipse.jgit.lib.ObjectId;
  15. import org.eclipse.jgit.transport.URIish;
  16. /**
  17. * Indicates a base/common object was required, but is not found.
  18. */
  19. public class MissingBundlePrerequisiteException extends TransportException {
  20. private static final long serialVersionUID = 1L;
  21. private static String format(Map<ObjectId, String> missingCommits) {
  22. final StringBuilder r = new StringBuilder();
  23. r.append(JGitText.get().missingPrerequisiteCommits);
  24. for (Map.Entry<ObjectId, String> e : missingCommits.entrySet()) {
  25. r.append("\n "); //$NON-NLS-1$
  26. r.append(e.getKey().name());
  27. if (e.getValue() != null)
  28. r.append(" ").append(e.getValue()); //$NON-NLS-1$
  29. }
  30. return r.toString();
  31. }
  32. /**
  33. * Constructs a MissingBundlePrerequisiteException for a set of objects.
  34. *
  35. * @param uri
  36. * URI used for transport
  37. * @param missingCommits
  38. * the Map of the base/common object(s) we don't have. Keys are
  39. * ids of the missing objects and values are short descriptions.
  40. */
  41. public MissingBundlePrerequisiteException(final URIish uri,
  42. final Map<ObjectId, String> missingCommits) {
  43. super(uri, format(missingCommits));
  44. }
  45. }