TranslationStringMissingException.java

  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. import java.util.Locale;

  12. /**
  13.  * This exception will be thrown when a translation string for a translation
  14.  * bundle and locale is missing.
  15.  */
  16. public class TranslationStringMissingException extends TranslationBundleException {
  17.     private static final long serialVersionUID = 1L;

  18.     private final String key;

  19.     /**
  20.      * Construct a
  21.      * {@link org.eclipse.jgit.errors.TranslationStringMissingException} for the
  22.      * specified bundle class, locale and translation key
  23.      *
  24.      * @param bundleClass
  25.      *            the bundle class for which a translation string was missing
  26.      * @param locale
  27.      *            the locale for which a translation string was missing
  28.      * @param key
  29.      *            the key of the missing translation string
  30.      * @param cause
  31.      *            the original exception thrown from the
  32.      *            {@link java.util.ResourceBundle#getString(String)} method.
  33.      */
  34.     public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) {
  35.         super("Translation missing for [" + bundleClass.getName() + ", " //$NON-NLS-1$ //$NON-NLS-2$
  36.                 + locale.toString() + ", " + key + "]", bundleClass, locale, //$NON-NLS-1$ //$NON-NLS-2$
  37.                 cause);
  38.         this.key = key;
  39.     }

  40.     /**
  41.      * Get the key of the missing translation string
  42.      *
  43.      * @return the key of the missing translation string
  44.      */
  45.     public String getKey() {
  46.         return key;
  47.     }
  48. }