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 * This exception will be thrown when a translation string for a translation
16 * bundle and locale is missing.
17 */
18 public class TranslationStringMissingException extends TranslationBundleException {
19 private static final long serialVersionUID = 1L;
20
21 private final String key;
22
23 /**
24 * Construct a
25 * {@link org.eclipse.jgit.errors.TranslationStringMissingException} for the
26 * specified bundle class, locale and translation key
27 *
28 * @param bundleClass
29 * the bundle class for which a translation string was missing
30 * @param locale
31 * the locale for which a translation string was missing
32 * @param key
33 * the key of the missing translation string
34 * @param cause
35 * the original exception thrown from the
36 * {@link java.util.ResourceBundle#getString(String)} method.
37 */
38 public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) {
39 super("Translation missing for [" + bundleClass.getName() + ", " //$NON-NLS-1$ //$NON-NLS-2$
40 + locale.toString() + ", " + key + "]", bundleClass, locale, //$NON-NLS-1$ //$NON-NLS-2$
41 cause);
42 this.key = key;
43 }
44
45 /**
46 * Get the key of the missing translation string
47 *
48 * @return the key of the missing translation string
49 */
50 public String getKey() {
51 return key;
52 }
53 }