1 /*
2 * Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com> 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
12 import java.util.Locale;
13
14 /**
15 * Common base class for all translation bundle related exceptions.
16 */
17 public abstract class TranslationBundleException extends RuntimeException {
18 private static final long serialVersionUID = 1L;
19
20 private final Class bundleClass;
21 private final Locale locale;
22
23 /**
24 * Construct an instance of
25 * {@link org.eclipse.jgit.errors.TranslationBundleException}
26 *
27 * @param message
28 * exception message
29 * @param bundleClass
30 * bundle class for which the exception occurred
31 * @param locale
32 * locale for which the exception occurred
33 * @param cause
34 * original exception that caused this exception. Usually thrown
35 * from the {@link java.util.ResourceBundle} class.
36 */
37 protected TranslationBundleException(String message, Class bundleClass, Locale locale, Exception cause) {
38 super(message, cause);
39 this.bundleClass = bundleClass;
40 this.locale = locale;
41 }
42
43 /**
44 * Get bundle class
45 *
46 * @return bundle class for which the exception occurred
47 */
48 public final Class getBundleClass() {
49 return bundleClass;
50 }
51
52 /**
53 * Get locale for which the exception occurred
54 *
55 * @return locale for which the exception occurred
56 */
57 public final Locale getLocale() {
58 return locale;
59 }
60 }