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.

NoClosingBracketException.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2008, Florian Köberle <florianskarten@web.de>
  3. * Copyright (C) 2009, Vasyl' Vavrychuk <vvavrychuk@gmail.com>
  4. * Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com> and others
  5. *
  6. * This program and the accompanying materials are made available under the
  7. * terms of the Eclipse Distribution License v. 1.0 which is available at
  8. * https://www.eclipse.org/org/documents/edl-v10.php.
  9. *
  10. * SPDX-License-Identifier: BSD-3-Clause
  11. */
  12. package org.eclipse.jgit.errors;
  13. import java.text.MessageFormat;
  14. import org.eclipse.jgit.internal.JGitText;
  15. /**
  16. * Thrown when a pattern contains a character group which is open to the right
  17. * side or a character class which is open to the right side.
  18. */
  19. public class NoClosingBracketException extends InvalidPatternException {
  20. private static final long serialVersionUID = 1L;
  21. /**
  22. * Constructor for NoClosingBracketException
  23. *
  24. * @param indexOfOpeningBracket
  25. * the position of the [ character which has no ] character.
  26. * @param openingBracket
  27. * the unclosed bracket.
  28. * @param closingBracket
  29. * the missing closing bracket.
  30. * @param pattern
  31. * the invalid pattern.
  32. */
  33. public NoClosingBracketException(final int indexOfOpeningBracket,
  34. final String openingBracket, final String closingBracket,
  35. final String pattern) {
  36. super(createMessage(indexOfOpeningBracket, openingBracket,
  37. closingBracket), pattern);
  38. }
  39. private static String createMessage(final int indexOfOpeningBracket,
  40. final String openingBracket, final String closingBracket) {
  41. return MessageFormat.format(JGitText.get().noClosingBracket,
  42. closingBracket, openingBracket,
  43. Integer.valueOf(indexOfOpeningBracket));
  44. }
  45. }