OrekitMessages.java

  1. /* Copyright 2002-2022 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.errors;

  18. import org.hipparchus.exception.Localizable;

  19. import java.io.IOException;
  20. import java.io.InputStream;
  21. import java.io.InputStreamReader;
  22. import java.net.URL;
  23. import java.net.URLConnection;
  24. import java.nio.charset.StandardCharsets;
  25. import java.util.Locale;
  26. import java.util.MissingResourceException;
  27. import java.util.PropertyResourceBundle;
  28. import java.util.ResourceBundle;

  29. /**
  30.  * Enumeration for localized messages formats.
  31.  * <p>
  32.  * The constants in this enumeration represent the available formats as
  33.  * localized strings. These formats are intended to be localized using simple
  34.  * properties files, using the constant name as the key and the property value
  35.  * as the message format. The source English format is provided in the constants
  36.  * themselves to serve both as a reminder for developers to understand the
  37.  * parameters needed by each format, as a basis for translators to create
  38.  * localized properties files, and as a default format if some translation is
  39.  * missing.
  40.  * </p>
  41.  * @since 2.1
  42.  */
  43. public enum OrekitMessages implements Localizable {

  44.     // CHECKSTYLE: stop JavadocVariable check

  45.     INTERNAL_ERROR("internal error, please notify development team by creating a new topic at {0}"),
  46.     ALTITUDE_BELOW_ALLOWED_THRESHOLD("altitude ({0} m) is below the {1} m allowed threshold"),
  47.     POINT_INSIDE_ELLIPSOID("point is inside ellipsoid"),
  48.     TRAJECTORY_INSIDE_BRILLOUIN_SPHERE("trajectory inside the Brillouin sphere (r = {0})"),
  49.     ALMOST_EQUATORIAL_ORBIT("almost equatorial orbit (i = {0} degrees)"),
  50.     ALMOST_CRITICALLY_INCLINED_ORBIT("almost critically inclined orbit (i = {0} degrees)"),
  51.     UNABLE_TO_COMPUTE_ECKSTEIN_HECHLER_MEAN_PARAMETERS(
  52.             "unable to compute Eckstein-Hechler mean parameters after {0} iterations"),
  53.     UNABLE_TO_COMPUTE_BROUWER_LYDDANE_MEAN_PARAMETERS(
  54.             "unable to compute Brouwer-Lyddane mean parameters after {0} iterations"),
  55.     UNABLE_TO_COMPUTE_TLE(
  56.                     "unable to compute TLE after {0} iterations"),
  57.     NULL_PARENT_FOR_FRAME("null parent for frame {0}"),
  58.     FRAME_ALREADY_ATTACHED("frame {0} is already attached to frame {1}"),
  59.     FRAME_NOT_ATTACHED("frame {0} is not attached to the main frames tree"),
  60.     FRAME_ANCESTOR_OF_BOTH_FRAMES("frame {0} is an ancestor of both frames {1} and {2}"),
  61.     FRAME_ANCESTOR_OF_NEITHER_FRAME("frame {0} is an ancestor of neither frame {1} nor {2}"),
  62.     FRAME_NO_NTH_ANCESTOR("frame {0} has depth {1}, it cannot have an ancestor {2} levels above"),
  63.     NO_SUCH_ITRF_FRAME("ITRF frame {0} not found"),
  64.     UNSUPPORTED_LOCAL_ORBITAL_FRAME("unsupported local orbital frame {0}"),
  65.     NON_PSEUDO_INERTIAL_FRAME("non pseudo-inertial frame \"{0}\""),
  66.     DATA_ROOT_DIRECTORY_DOES_NOT_EXIST("data root directory {0} does not exist"),
  67.     NOT_A_DIRECTORY("{0} is not a directory"),
  68.     NEITHER_DIRECTORY_NOR_ZIP_OR_JAR("{0} is neither a directory nor a zip/jar archive file"),
  69.     UNABLE_TO_FIND_RESOURCE("unable to find resource {0} in classpath"),
  70.     NO_EARTH_ORIENTATION_PARAMETERS_LOADED("no Earth Orientation Parameters loaded"),
  71.     MISSING_EARTH_ORIENTATION_PARAMETERS_BETWEEN_DATES("missing Earth Orientation Parameters between {0} and {1}"),
  72.     MISSING_EARTH_ORIENTATION_PARAMETERS_BETWEEN_DATES_GAP("missing Earth Orientation Parameters between {0} and {1}, gap is {2,number,0.0##############E0} s"),
  73.     NO_EARTH_ORIENTATION_PARAMETERS("missing Earth Orientation Parameters"),
  74.     NOT_A_SUPPORTED_IERS_DATA_FILE("file {0} is not a supported IERS data file"),
  75.     INCONSISTENT_DATES_IN_IERS_FILE("inconsistent dates in IERS file {0}: {1}-{2}-{3} and MJD {4}"),
  76.     UNEXPECTED_DATA_AFTER_LINE_IN_FILE("unexpected data after line {0} in file {1}: {2}"),
  77.     UNEXPECTED_DATA_AT_LINE_IN_FILE("unexpected data at line {0} in file {1}"),
  78.     NON_CHRONOLOGICAL_DATES_IN_FILE("non-chronological dates in file {0}, line {1}"),
  79.     NO_IERS_UTC_TAI_HISTORY_DATA_LOADED("no IERS UTC-TAI history data loaded"),
  80.     NO_ENTRIES_IN_IERS_UTC_TAI_HISTORY_FILE("no entries found in IERS UTC-TAI history file {0}"),
  81.     MISSING_SERIE_J_IN_FILE("missing serie j = {0} in file {1} (line {2})"),
  82.     CANNOT_PARSE_BOTH_TAU_AND_GAMMA("cannot parse both τ and γ from the same Poissons series file"),
  83.     UNEXPECTED_END_OF_FILE_AFTER_LINE("unexpected end of file {0} (after line {1})"),
  84.     UNABLE_TO_PARSE_LINE_IN_FILE("unable to parse line {0} of file {1}:\n{2}"),
  85.     UNABLE_TO_PARSE_ELEMENT_IN_FILE("unable to parse element {0} at line {1}, file {2}"),
  86.     UNABLE_TO_FIND_FILE("unable to find file {0}"),
  87.     SPACECRAFT_MASS_BECOMES_NEGATIVE("spacecraft mass becomes negative: {0} kg"),
  88.     POSITIVE_FLOW_RATE("positive flow rate (q: {0})"),
  89.     NO_GRAVITY_FIELD_DATA_LOADED("no gravity field data loaded"),
  90.     GRAVITY_FIELD_NORMALIZATION_UNDERFLOW("gravity field normalization underflow for degree {0} and order {1}"),
  91.     NO_OCEAN_TIDE_DATA_LOADED("no ocean tide data loaded"),
  92.     OCEAN_TIDE_DATA_DEGREE_ORDER_LIMITS("ocean tide data file {0} limited to degree {1} and order {2}"),
  93.     OCEAN_TIDE_LOAD_DEFORMATION_LIMITS(
  94.             "load deformation coefficients limited to degree {0}, cannot parse degree {1} term from file {2}"),
  95.     POLAR_TRAJECTORY("polar trajectory (distance to polar axis: {0})"),
  96.     UNEXPECTED_FILE_FORMAT_ERROR_FOR_LOADER("unexpected format error for file {0} with loader {1}"),
  97.     DUPLICATED_GRAVITY_FIELD_COEFFICIENT_IN_FILE("duplicated gravity field coefficient {0}({1}, {2}) in file {3}"),
  98.     MISSING_GRAVITY_FIELD_COEFFICIENT_IN_FILE("missing gravity field coefficient {0}({1}, {2}) in file {3}"),
  99.     TOO_LARGE_DEGREE_FOR_GRAVITY_FIELD("too large degree (n = {0}, potential maximal degree is {1})"),
  100.     TOO_LARGE_ORDER_FOR_GRAVITY_FIELD("too large order (m = {0}, potential maximal order is {1})"),
  101.     WRONG_DEGREE_OR_ORDER("no term ({0}, {1}) in a {2}x{3} spherical harmonics decomposition"),
  102.     SEVERAL_REFERENCE_DATES_IN_GRAVITY_FIELD("several reference dates ({0} and {1} differ by {3,number,0.0##############E0} s) found in gravity field file {2}"),
  103.     NO_TLE_FOR_OBJECT("no TLE data available for object {0}"),
  104.     NO_TLE_FOR_LAUNCH_YEAR_NUMBER_PIECE(
  105.             "no TLE data available for launch year {0}, launch number {1}, launch piece {2}"),
  106.     NOT_TLE_LINES("lines {0} and {1} are not TLE lines:\n{0}: \"{2}\"\n{1}: \"{3}\""),
  107.     MISSING_SECOND_TLE_LINE("expected a second TLE line after line {0}:\n{0}: \"{1}\""),
  108.     TLE_LINES_DO_NOT_REFER_TO_SAME_OBJECT("TLE lines do not refer to the same object:\n{0}\n{1}"),
  109.     TLE_INVALID_PARAMETER("invalid TLE parameter for object {0}: {1} = {2}"),
  110.     TLE_CHECKSUM_ERROR("wrong checksum of TLE line {0}, expected {1} but got {2} ({3})"),
  111.     NO_TLE_DATA_AVAILABLE("no TLE data available"),
  112.     NOT_POSITIVE_SPACECRAFT_MASS("spacecraft mass is not positive: {0} kg"),
  113.     TOO_LARGE_ECCENTRICITY_FOR_PROPAGATION_MODEL("too large eccentricity for propagation model: e = {0}"),
  114.     NO_SOLAR_ACTIVITY_AT_DATE("no solar activity available at {0}, data available only in range [{1}, {2}]"),
  115.     NON_EXISTENT_MONTH("non-existent month {0}"),
  116.     NON_EXISTENT_YEAR_MONTH_DAY("non-existent date {0}-{1}-{2}"),
  117.     NON_EXISTENT_WEEK_DATE("non-existent week date {0}-W{1}-{2}"),
  118.     NON_EXISTENT_DATE("non-existent date {0}"),
  119.     NON_EXISTENT_DAY_NUMBER_IN_YEAR("no day number {0} in year {1}"),
  120.     NON_EXISTENT_HMS_TIME("non-existent time {0}:{1}:{2}"),
  121.     NON_EXISTENT_TIME("non-existent time {0}"),
  122.     OUT_OF_RANGE_SECONDS_NUMBER("out of range seconds number: {0}"),
  123.     OUT_OF_RANGE_SECONDS_NUMBER_DETAIL("out of range seconds number: {0} is not in [{1}, {2}]"),
  124.     ANGLE_TYPE_NOT_SUPPORTED("angle type not supported, supported angles: {0}, {1} and {2}"),
  125.     SATELLITE_COLLIDED_WITH_TARGET("satellite collided with target"),
  126.     ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND("attitude pointing law misses ground"),
  127.     TOO_SHORT_TRANSITION_TIME_FOR_ATTITUDES_SWITCH(
  128.             "{0} seconds transition time for attitudes switch is too short, should be longer than {1} seconds"),
  129.     ORBIT_AND_ATTITUDE_DATES_MISMATCH("orbit date ({0}) does not match attitude date ({1})"),
  130.     FRAMES_MISMATCH("frame {0} does not match frame {1}"),
  131.     INITIAL_STATE_NOT_SPECIFIED_FOR_ORBIT_PROPAGATION("initial state not specified for orbit propagation"),
  132.     EVENT_DATE_TOO_CLOSE(
  133.             "target event date must be before {1} by {3,number,0.0##############E0} seconds or after {2} by {3,number,0.0##############E0} seconds, but target event date {0} is {4,number,0.0##############E0} seconds before {1} and {5,number,0.0##############E0} seconds after {2} so it cannot be added"),
  134.     UNABLE_TO_READ_JPL_HEADER("unable to read header record from JPL ephemerides binary file {0}"),
  135.     INCONSISTENT_ASTRONOMICAL_UNIT_IN_FILES(
  136.             "inconsistent values of astronomical unit in JPL ephemerides files: ({0} and {1})"),
  137.     INCONSISTENT_EARTH_MOON_RATIO_IN_FILES(
  138.             "inconsistent values of Earth/Moon mass ratio in JPL ephemerides files: ({0} and {1})"),
  139.     NO_DATA_LOADED_FOR_CELESTIAL_BODY("no data loaded for celestial body {0}"),
  140.     NOT_A_JPL_EPHEMERIDES_BINARY_FILE("file {0} is not a JPL ephemerides binary file"),
  141.     NOT_A_MARSHALL_SOLAR_ACTIVITY_FUTURE_ESTIMATION_FILE(
  142.             "file {0} is not a Marshall Solar Activity Future Estimation (MSAFE) file"),
  143.     NO_JPL_EPHEMERIDES_BINARY_FILES_FOUND("no JPL ephemerides binary files found"),
  144.     OUT_OF_RANGE_BODY_EPHEMERIDES_DATE("out of range date for {0} ephemerides: {1}"),
  145.     OUT_OF_RANGE_EPHEMERIDES_DATE("out of range date for ephemerides: {0}, [{1}, {2}]"),
  146.     OUT_OF_RANGE_EPHEMERIDES_DATE_BEFORE("out of range date for ephemerides: {0} is {3,number,0.0##############E0} s before [{1}, {2}]"),
  147.     OUT_OF_RANGE_EPHEMERIDES_DATE_AFTER("out of range date for ephemerides: {0} is {3,number,0.0##############E0} s after [{1}, {2}]"),
  148.     UNEXPECTED_TWO_ELEVATION_VALUES_FOR_ONE_AZIMUTH(
  149.             "unexpected two elevation values: {0} and {1}, for one azimuth: {2}"),
  150.     UNSUPPORTED_PARAMETER_NAME("unsupported parameter name {0}, supported names: {1}"),
  151.     TOO_SMALL_SCALE_FOR_PARAMETER("scale factor for parameter {0} is too small: {1}"),
  152.     UNKNOWN_ADDITIONAL_STATE("unknown additional state \"{0}\""),
  153.     UNKNOWN_MONTH("unknown month \"{0}\""),
  154.     SINGULAR_JACOBIAN_FOR_ORBIT_TYPE("Jacobian matrix for type {0} is singular with current orbit"),
  155.     STATE_JACOBIAN_NOT_INITIALIZED("state Jacobian has not been initialized yet"),
  156.     STATE_JACOBIAN_NOT_6X6("state Jacobian is a {0}x{1} matrix, it should be a 6x6 matrix"),
  157.     STATE_AND_PARAMETERS_JACOBIANS_ROWS_MISMATCH("state Jacobian has {0} rows but parameters Jacobian has {1} rows"),
  158.     INITIAL_MATRIX_AND_PARAMETERS_NUMBER_MISMATCH(
  159.             "initial Jacobian matrix has {0} columns, but {1} parameters have been selected"),
  160.     ORBIT_A_E_MISMATCH_WITH_CONIC_TYPE(
  161.             "orbit should be either elliptic with a > 0 and e < 1 or hyperbolic with a < 0 and e > 1, a = {0}, e = {1}"),
  162.     ORBIT_ANOMALY_OUT_OF_HYPERBOLIC_RANGE("true anomaly {0} out of hyperbolic range (e = {1}, {2} < v < {3})"),
  163.     HYPERBOLIC_ORBIT_NOT_HANDLED_AS("hyperbolic orbits cannot be handled as {0} instances"),
  164.     CCSDS_DATE_INVALID_PREAMBLE_FIELD("invalid preamble field in CCSDS date: {0}"),
  165.     CCSDS_DATE_INVALID_LENGTH_TIME_FIELD("invalid time field length in CCSDS date: {0}, expected {1}"),
  166.     CCSDS_DATE_MISSING_AGENCY_EPOCH("missing agency epoch in CCSDS date"),
  167.     CCSDS_MISSING_KEYWORD("missing mandatory key {0} in CCSDS file {1}"),
  168.     CCSDS_KEYWORD_NOT_ALLOWED_IN_VERSION("key {0} is not allowed in format version {1}"),
  169.     CCSDS_UNEXPECTED_KEYWORD("unexpected keyword in CCSDS line number {0} of file {1}:\n{2}"),
  170.     CCSDS_UNKNOWN_GM("the central body gravitational coefficient cannot be retrieved from the ODM"),
  171.     CCSDS_UNKNOWN_SPACECRAFT_MASS("there is no spacecraft mass associated with this ODM file"),
  172.     CCSDS_UNKNOWN_CONVENTIONS("no IERS conventions have been set before parsing"),
  173.     CCSDS_INVALID_FRAME("frame {0} is not valid in this CCSDS file context"),
  174.     CCSDS_INCONSISTENT_TIME_SYSTEMS("inconsistent time systems: {0} ≠ {1}"),
  175.     CCSDS_TIME_SYSTEM_NOT_IMPLEMENTED(
  176.             "use of time system {0} in CCSDS files requires an additional ICD and is not implemented in Orekit"),
  177.     CCSDS_TDM_KEYWORD_NOT_FOUND("No CCSDS TDM keyword was found at line {0} of file {1}:\n{2}"),
  178.     CCSDS_TDM_MISSING_RANGE_UNITS_CONVERTER("no Range Units converter configured for parsing Tracking Data Message"),
  179.     CCSDS_TIME_SYSTEM_NOT_READ_YET("Time system should have already been set before line {0} of file {1}"),
  180.     CCSDS_AEM_INCONSISTENT_TIME_SYSTEMS("inconsistent time systems in the attitude blocks: {0} ≠ {1}"),
  181.     CCSDS_AEM_ATTITUDE_TYPE_NOT_IMPLEMENTED("attitude type {0} in CCSDS AEM files is not implemented in Orekit"),
  182.     CCSDS_INVALID_ROTATION_SEQUENCE("invalid rotation sequence {0} at line {1} of file {2}"),
  183.     CCSDS_UNSUPPORTED_ELEMENT_SET_TYPE("element set type {0} ({1}) is not supported yet"),
  184.     CCSDS_UNSUPPORTED_RETROGRADE_EQUINOCTIAL("retrograde factor not supported in element set {0}"),
  185.     CCSDS_ELEMENT_SET_WRONG_NB_COMPONENTS("element set type {0} ({1}) expects {2} elements"),
  186.     CCSDS_MANEUVER_UNITS_WRONG_NB_COMPONENTS("wrong number of units for maneuver {0}"),
  187.     CCSDS_MANEUVER_MISSING_TIME("missing time field for maneuver {0}"),
  188.     ADDITIONAL_STATE_NAME_ALREADY_IN_USE("name \"{0}\" is already used for an additional state"),
  189.     NON_RESETABLE_STATE("reset state not allowed"),
  190.     DSST_NEWCOMB_OPERATORS_COMPUTATION("Cannot compute Newcomb operators for sigma > rho ({0} > {1})"),
  191.     DSST_VMNS_COEFFICIENT_ERROR_MS("Cannot compute the Vmns coefficient with m > n ({0} > {1})"),
  192.     DSST_SPR_SHADOW_INCONSISTENT("inconsistent shadow computation: entry = {0} whereas exit = {1}"),
  193.     DSST_ECC_NO_NUMERICAL_AVERAGING_METHOD(
  194.             "The current orbit has an eccentricity ({0} > 0.5). DSST needs an unimplemented time dependent numerical method to compute the averaged rates"),
  195.     SP3_UNSUPPORTED_VERSION("unsupported sp3 file version {0}"),
  196.     SP3_NUMBER_OF_EPOCH_MISMATCH("found {0} epochs in file {1}, expected {2}"),
  197.     SP3_UNEXPECTED_END_OF_FILE("unexpected end of sp3 file (after line {0})"),
  198.     CLOCK_FILE_UNSUPPORTED_VERSION("unsupported clock file version {0}"),
  199.     NAVIGATION_FILE_UNSUPPORTED_VERSION("unsupported navigation messages file version {0}"),
  200.     NON_EXISTENT_GEOMAGNETIC_MODEL("non-existent geomagnetic model {0} for year {1}"),
  201.     UNSUPPORTED_TIME_TRANSFORM(
  202.             "geomagnetic model {0} with epoch {1} does not support time transformation, no secular variation coefficients defined"),
  203.     OUT_OF_RANGE_TIME_TRANSFORM(
  204.             "time transformation of geomagnetic model {0} with epoch {1} is outside its validity range: {2} != [{3}, {4}]"),
  205.     NOT_ENOUGH_DATA_FOR_INTERPOLATION("not enough data for interpolation (sample size = {0})"),
  206.     NOT_ENOUGH_CACHED_NEIGHBORS("too small number of cached neighbors: {0} (must be at least {1})"),
  207.     NO_CACHED_ENTRIES("no cached entries"),
  208.     NON_CHRONOLOGICALLY_SORTED_ENTRIES("generated entries not sorted: {0} > {1} by {2,number,0.0##############E0} s"),
  209.     NO_DATA_GENERATED("no data generated around date: {0}"),
  210.     UNABLE_TO_GENERATE_NEW_DATA_BEFORE("unable to generate new data before {0}, but data is requested for {1} which is {2,number,0.0##############E0} s before"),
  211.     UNABLE_TO_GENERATE_NEW_DATA_AFTER("unable to generate new data after {0}, but data is requested for {1} which is {2,number,0.0##############E0} s after"),
  212.     UNABLE_TO_COMPUTE_HYPERBOLIC_ECCENTRIC_ANOMALY(
  213.             "unable to compute hyperbolic eccentric anomaly from the mean anomaly after {0} iterations"),
  214.     UNABLE_TO_COMPUTE_DSST_MEAN_PARAMETERS("unable to compute mean orbit from osculating orbit after {0} iterations"),
  215.     OUT_OF_RANGE_DERIVATION_ORDER("derivation order {0} is out of range"),
  216.     ORBIT_TYPE_NOT_ALLOWED("orbit type {0} not allowed here, allowed types: {1}"),
  217.     NON_PSEUDO_INERTIAL_FRAME_NOT_SUITABLE_AS_REFERENCE_FOR_INERTIAL_FORCES(
  218.             "non pseudo-inertial frame {0} is not suitable as reference for inertial forces"),
  219.     METHOD_NOT_AVAILABLE_WITHOUT_CENTRAL_BODY("method not available in the absence of a central body"),
  220.     INCOMPATIBLE_FRAMES("operation not available between frames {0} and {1}"),
  221.     UNDEFINED_ORBIT("orbit not defined, state rather contains an absolute position-velocity-acceleration"),
  222.     UNDEFINED_ABSOLUTE_PVCOORDINATES(
  223.             "absolute position-velocity-acceleration not defined, state rather contains an orbit"),
  224.     INERTIAL_FORCE_MODEL_MISSING("an inertial force model has to be used when propagating in non-inertial frame {0}"),
  225.     NO_SEM_ALMANAC_AVAILABLE("no SEM almanac file found"),
  226.     NOT_A_SUPPORTED_SEM_ALMANAC_FILE("file {0} is not a supported SEM almanac file"),
  227.     NO_YUMA_ALMANAC_AVAILABLE("no Yuma almanac file found"),
  228.     NOT_A_SUPPORTED_YUMA_ALMANAC_FILE("file {0} is not a supported Yuma almanac file"),
  229.     NOT_ENOUGH_GNSS_FOR_DOP("only {0} GNSS orbits are provided while {1} are needed to compute the DOP"),
  230.     NOT_ENOUGH_PROPAGATORS(
  231.             "Creating an aggregate propagator requires at least one constituent propagator, but none were provided."),
  232.     NOT_ENOUGH_ATTITUDE_PROVIDERS(
  233.                     "Creating an aggregate attitude provider requires at least one constituent attitude provider, but none were provided."),
  234.     NULL_ARGUMENT("argument {0} cannot be null"),
  235.     VALUE_NOT_FOUND("value {0} not found in {1}"),
  236.     KLOBUCHAR_ALPHA_BETA_NOT_LOADED("Klobuchar coefficients α or β could not be loaded from {0}"),
  237.     KLOBUCHAR_ALPHA_BETA_NOT_AVAILABLE_FOR_DATE("Klobuchar coefficients α or β not available for date {0}"),
  238.     NO_KLOBUCHAR_ALPHA_BETA_IN_FILE("file {0} does not contain Klobuchar coefficients α or β"),
  239.     NO_REFERENCE_DATE_FOR_PARAMETER("no reference date set for parameter {0}"),
  240.     STATION_NOT_FOUND("station {0} not found, known stations: {1}"),
  241.     UNKNOWN_SATELLITE_SYSTEM("unknown satellite system {0}"),
  242.     UNKNOWN_TIME_SYSTEM("unknown time system {0}"),
  243.     UNKNOWN_CLOCK_DATA_TYPE("unknown clock data type {0}"),
  244.     UNKNOWN_SATELLITE_ANTENNA_CODE("unknown satellite antenna code {0}"),
  245.     UNSUPPORTED_FREQUENCY_FOR_ANTENNA("frequency {0} is not supported by antenna {1}"),
  246.     CANNOT_FIND_SATELLITE_IN_SYSTEM("cannot find satellite {0} in satellite system {1}"),
  247.     UNKNOWN_RINEX_FREQUENCY("unknown RINEX frequency {0} in file {1}, line {2}"),
  248.     MISMATCHED_FREQUENCIES("mismatched frequencies in file {0}, line {1} (expected {2}, got {3})"),
  249.     WRONG_COLUMNS_NUMBER("wrong number of columns in file {0}, line {1} (expected {2} columns, got {3} columns)"),
  250.     UNSUPPORTED_FILE_FORMAT("unsupported format for file {0}"),
  251.     INCOMPLETE_HEADER("incomplete header in file {0}"),
  252.     INCONSISTENT_NUMBER_OF_SATS(
  253.             "inconsistent number of satellites in line {0}, file {1}: observation with {2} satellites and number of max satellites is {3}"),
  254.     INCONSISTENT_SATELLITE_SYSTEM(
  255.             "the satellite system {3} from line {0}, file {1} is not consistent with the Rinex Satellite System {2} in header"),
  256.     NO_PROPAGATOR_CONFIGURED("no propagator configured"),
  257.     DIMENSION_INCONSISTENT_WITH_PARAMETERS("dimension {0} is inconsistent with parameters list: {1}"),
  258.     NOT_A_SUPPORTED_UNIX_COMPRESSED_FILE("file {0} is not a supported Unix-compressed file"),
  259.     UNEXPECTED_END_OF_FILE("unexpected end of file {0}"),
  260.     CORRUPTED_FILE("file {0} is corrupted"),
  261.     VIENNA_ACOEF_OR_ZENITH_DELAY_NOT_LOADED("Vienna coefficients ah or aw or zh or zw could not be loaded from {0}"),
  262.     VIENNA_ACOEF_OR_ZENITH_DELAY_NOT_AVAILABLE_FOR_DATE(
  263.             "Vienna coefficients ah or aw or zh or zw not available for date {0}"),
  264.     NO_VIENNA_ACOEF_OR_ZENITH_DELAY_IN_FILE("file {0} does not contain Vienna coefficients ah, aw, zh or zw"),
  265.     IRREGULAR_OR_INCOMPLETE_GRID("irregular or incomplete grid in file {0}"),
  266.     INVALID_SATELLITE_SYSTEM("invalid satellite system {0}"),
  267.     NO_TEC_DATA_IN_FILE_FOR_DATE("IONEX file {0} does not contain TEC data for date {1}"),
  268.     INCONSISTENT_NUMBER_OF_TEC_MAPS_IN_FILE("number of maps {0} is inconsistent with header specification: {1}"),
  269.     NO_LATITUDE_LONGITUDE_BONDARIES_IN_IONEX_HEADER(
  270.             "file {0} does not contain latitude or longitude bondaries in its header section"),
  271.     NO_EPOCH_IN_IONEX_HEADER("file {0} does not contain epoch of first or last map in its header section"),
  272.     ITRF_VERSIONS_PREFIX_ONLY("The first column of itrf-versions.conf is a plain " +
  273.             "prefix that is matched against the name of each loaded file. It should " +
  274.             "not contain any regular expression syntax or directory components, i.e. " +
  275.             "\"/\" or \"\\\". Actual value: \"{0}\"."),
  276.     CANNOT_COMPUTE_AIMING_AT_SINGULAR_POINT(
  277.             "cannot compute aiming direction at singular point: latitude = {0}, longitude = {1}"),
  278.     STEC_INTEGRATION_DID_NOT_CONVERGE("STEC integration did not converge"),
  279.     MODIP_GRID_NOT_LOADED("MODIP grid not be loaded from {0}"),
  280.     NEQUICK_F2_FM3_NOT_LOADED("NeQuick coefficient f2 or fm3 not be loaded from {0}"),
  281.     NOT_A_SUPPORTED_HATANAKA_COMPRESSED_FILE("file {0} is not a supported Hatanaka-compressed file"),
  282.     CANNOT_COMPUTE_LAGRANGIAN("Cannot compute around {0}"),
  283.     TRAJECTORY_NOT_CROSSING_XZPLANE("The trajectory does not cross XZ Plane, it will not result in a Halo Orbit"),
  284.     MULTIPLE_SHOOTING_UNDERCONSTRAINED(
  285.             "The multiple shooting problem is underconstrained : {0} free variables, {1} constraints"),
  286.     INVALID_MEASUREMENT_TYPES_FOR_COMBINATION_OF_MEASUREMENTS(
  287.             "invalid measurement types {0} and {1} for the combination of measurements {2}"),
  288.     INCOMPATIBLE_FREQUENCIES_FOR_COMBINATION_OF_MEASUREMENTS(
  289.             "frequencies {0} and {1} are incompatibles for the {2} combination"),
  290.     NON_CHRONOLOGICAL_DATES_FOR_OBSERVATIONS("observations are not in chronological order: {0} is {2,number,0.0##############E0} s after {1}"),
  291.     EXCEPTIONAL_DATA_CONTEXT(
  292.             "Use of the ExceptionalDataContext detected. This is typically used to detect developer errors."),
  293.     NON_DIFFERENT_DATES_FOR_OBSERVATIONS(
  294.             "Observations must have different dates: {0}, {1} ({3,number,0.0##############E0} s from first observation), and {2} ({4,number,0.0##############E0} s from first observation, {5,number,0.0##############E0} s from second observation)"),
  295.     NON_COPLANAR_POINTS("observations are not in the same plane"),
  296.     INVALID_PARAMETER_RANGE("invalid parameter {0}: {1} not in range [{2}, {3}]"),
  297.     PARAMETER_NOT_SET("The parameter {0} should not be null in {1}"),
  298.     FUNCTION_NOT_IMPLEMENTED("{0} is not implemented"),
  299.     INVALID_TYPE_FOR_FUNCTION("Impossible to execute {0} with {1} set to {2}"),
  300.     NO_DATA_IN_FILE("No data could be parsed from file {0}"),
  301.     CPF_UNEXPECTED_END_OF_FILE("Unexpected end of CPF file (after line {0})"),
  302.     UNEXPECTED_FORMAT_FOR_ILRS_FILE("Unexpected file format. Must be {0} but is {1}"),
  303.     CRD_UNEXPECTED_END_OF_FILE("Unexpected end of CRD file (after line {0})"),
  304.     INVALID_RANGE_INDICATOR_IN_CRD_FILE("Invalid range indicator {0} in CRD file header"),
  305.     END_OF_ENCODED_MESSAGE("end of encoded message reached"),
  306.     TOO_LARGE_DATA_TYPE("too large data type ({0} bits)"),
  307.     UNKNOWN_ENCODED_MESSAGE_NUMBER("unknown encoded message number {0}"),
  308.     UNKNOWN_AUTHENTICATION_METHOD("unknown authentication method: {0}"),
  309.     UNKNOWN_CARRIER_PHASE_CODE("unknown carrier phase code: {0}"),
  310.     UNKNOWN_DATA_FORMAT("unknown data format: {0}"),
  311.     UNKNOWN_NAVIGATION_SYSTEM("unknown navigation system: {0}"),
  312.     STREAM_REQUIRES_NMEA_FIX("data stream {0} requires a NMEA fix data"),
  313.     FAILED_AUTHENTICATION("failed authentication for mountpoint {0}"),
  314.     CONNECTION_ERROR("error connecting to {0}: {1}"),
  315.     UNEXPECTED_CONTENT_TYPE("unexpected content type {0}"),
  316.     CANNOT_PARSE_GNSS_DATA("cannot parse GNSS data from {0}"),
  317.     UNKNOWN_HOST("unknown host {0}"),
  318.     SOURCETABLE_PARSE_ERROR("error parsing sourcetable line {0} from {1}: {2}"),
  319.     CANNOT_PARSE_SOURCETABLE("cannot parse sourcetable from {0}"),
  320.     MOUNPOINT_ALREADY_CONNECTED("mount point {0} is already connected"),
  321.     MISSING_HEADER("missing header from {0}: {1}"),
  322.     NOT_VALID_INTERNATIONAL_DESIGNATOR("{0} is not a valid international designator"),
  323.     UNINITIALIZED_VALUE_FOR_KEY("value for key {0} has not been initialized"),
  324.     UNKNOWN_UNIT("unknown unit {0}"),
  325.     INCOMPATIBLE_UNITS("units {0} and {1} are not compatible"),
  326.     MISSING_VELOCITY("missing velocity data"),
  327.     ATTEMPT_TO_GENERATE_MALFORMED_FILE("attempt to generate file {0} with a formatting error"),
  328.     FIND_ROOT(
  329.             "{0} failed to find root between {1} (g={2,number,0.0##############E0}) and {3} (g={4,number,0.0##############E0})\nLast iteration at {5} (g={6,number,0.0##############E0})"),
  330.     BACKWARD_PROPAGATION_NOT_ALLOWED("backward propagation not allowed here"),
  331.     NO_STATION_ECCENTRICITY_FOR_EPOCH(
  332.             "no station eccentricity values for the given epoch {0}, validity interval is between {1} and {2}"),
  333.     INCONSISTENT_SELECTION("inconsistent parameters selection between pairs {0}/{1} and {2}/{3}"),
  334.     NO_UNSCENTED_TRANSFORM_CONFIGURED("no unscented transform configured"),
  335.     NOT_STRICTLY_POSITIVE("value is not strictly positive: {0}"),
  336.     UNSUPPORTED_TRANSFORM("transform from {0} to {1} is not implemented"),
  337.     WRONG_ORBIT_PARAMETERS_TYPE("orbital parameters type: {0} is different from expected orbital type : {1}"),
  338.     CANNOT_CHANGE_COVARIANCE_TYPE_IF_DEFINED_IN_LOF("cannot change covariance type if defined in a local orbital frame"),
  339.     CANNOT_CHANGE_COVARIANCE_TYPE_IF_DEFINED_IN_NON_INERTIAL_FRAME("cannot change covariance type if defined in a non pseudo-inertial reference frame");
  340.     // CHECKSTYLE: resume JavadocVariable check

  341.     /** Base name of the resource bundle in classpath. */
  342.     private static final String RESOURCE_BASE_NAME = "assets/org/orekit/localization/OrekitMessages";

  343.     /** Source English format. */
  344.     private final String sourceFormat;

  345.     /**
  346.      * Simple constructor.
  347.      * @param sourceFormat source English format to use when no localized version is
  348.      *                     available
  349.      */
  350.     OrekitMessages(final String sourceFormat) {
  351.         this.sourceFormat = sourceFormat;
  352.     }

  353.     /** {@inheritDoc} */
  354.     public String getSourceString() {
  355.         return sourceFormat;
  356.     }

  357.     /** {@inheritDoc} */
  358.     public String getLocalizedString(final Locale locale) {
  359.         try {
  360.             final ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BASE_NAME, locale, new UTF8Control());
  361.             if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
  362.                 final String translated = bundle.getString(name());
  363.                 if (translated != null && translated.length() > 0 &&
  364.                         !translated.toLowerCase().contains("missing translation")) {
  365.                     // the value of the resource is the translated format
  366.                     return translated;
  367.                 }
  368.             }

  369.         } catch (MissingResourceException mre) {
  370.             // do nothing here
  371.         }

  372.         // either the locale is not supported or the resource is not translated or
  373.         // it is unknown: don't translate and fall back to using the source format
  374.         return sourceFormat;

  375.     }

  376.     /**
  377.      * Control class loading properties in UTF-8 encoding.
  378.      * <p>
  379.      * This class has been very slightly adapted from BalusC answer to question:
  380.      * <a href=
  381.      * "http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle">
  382.      * How to use UTF-8 in resource properties with ResourceBundle</a>.
  383.      * </p>
  384.      * @since 6.0
  385.      */
  386.     public static class UTF8Control extends ResourceBundle.Control {

  387.         /** {@inheritDoc} */
  388.         @Override
  389.         public ResourceBundle newBundle(final String baseName, final Locale locale, final String format,
  390.                 final ClassLoader loader, final boolean reload)
  391.                 throws IllegalAccessException, InstantiationException, IOException {
  392.             // The below is a copy of the default implementation.
  393.             final String bundleName = toBundleName(baseName, locale);
  394.             final String resourceName = toResourceName(bundleName, "utf8");
  395.             ResourceBundle bundle = null;
  396.             InputStream stream = null;
  397.             if (reload) {
  398.                 final URL url = loader.getResource(resourceName);
  399.                 if (url != null) {
  400.                     final URLConnection connection = url.openConnection();
  401.                     if (connection != null) {
  402.                         connection.setUseCaches(false);
  403.                         stream = connection.getInputStream();
  404.                     }
  405.                 }
  406.             } else {
  407.                 stream = loader.getResourceAsStream(resourceName);
  408.             }
  409.             if (stream != null) {
  410.                 try (InputStreamReader inputStreamReader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
  411.                     // Only this line is changed to make it to read properties files as UTF-8.
  412.                     bundle = new PropertyResourceBundle(inputStreamReader);
  413.                 }
  414.             }
  415.             return bundle;
  416.         }
  417.     }
  418. }