TranslationBundleException.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.  * Common base class for all translation bundle related exceptions.
  14.  */
  15. public abstract class TranslationBundleException extends RuntimeException {
  16.     private static final long serialVersionUID = 1L;

  17.     private final Class bundleClass;
  18.     private final Locale locale;

  19.     /**
  20.      * Construct an instance of
  21.      * {@link org.eclipse.jgit.errors.TranslationBundleException}
  22.      *
  23.      * @param message
  24.      *            exception message
  25.      * @param bundleClass
  26.      *            bundle class for which the exception occurred
  27.      * @param locale
  28.      *            locale for which the exception occurred
  29.      * @param cause
  30.      *            original exception that caused this exception. Usually thrown
  31.      *            from the {@link java.util.ResourceBundle} class.
  32.      */
  33.     protected TranslationBundleException(String message, Class bundleClass, Locale locale, Exception cause) {
  34.         super(message, cause);
  35.         this.bundleClass = bundleClass;
  36.         this.locale = locale;
  37.     }

  38.     /**
  39.      * Get bundle class
  40.      *
  41.      * @return bundle class for which the exception occurred
  42.      */
  43.     public final Class getBundleClass() {
  44.         return bundleClass;
  45.     }

  46.     /**
  47.      * Get locale for which the exception occurred
  48.      *
  49.      * @return locale for which the exception occurred
  50.      */
  51.     public final Locale getLocale() {
  52.         return locale;
  53.     }
  54. }