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 13 package org.eclipse.jgit.errors; 14 15 import java.text.MessageFormat; 16 17 import org.eclipse.jgit.internal.JGitText; 18 19 /** 20 * Thrown when a pattern contains a character group which is open to the right 21 * side or a character class which is open to the right side. 22 */ 23 public class NoClosingBracketException extends InvalidPatternException { 24 private static final long serialVersionUID = 1L; 25 26 /** 27 * Constructor for NoClosingBracketException 28 * 29 * @param indexOfOpeningBracket 30 * the position of the [ character which has no ] character. 31 * @param openingBracket 32 * the unclosed bracket. 33 * @param closingBracket 34 * the missing closing bracket. 35 * @param pattern 36 * the invalid pattern. 37 */ 38 public NoClosingBracketException(final int indexOfOpeningBracket, 39 final String openingBracket, final String closingBracket, 40 final String pattern) { 41 super(createMessage(indexOfOpeningBracket, openingBracket, 42 closingBracket), pattern); 43 } 44 45 private static String createMessage(final int indexOfOpeningBracket, 46 final String openingBracket, final String closingBracket) { 47 return MessageFormat.format(JGitText.get().noClosingBracket, 48 closingBracket, openingBracket, 49 Integer.valueOf(indexOfOpeningBracket)); 50 } 51 }