1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.errors;
18
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 import org.hipparchus.exception.Localizable;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 public enum OrekitMessages implements Localizable {
48
49
50
51 INTERNAL_ERROR("internal error, please notify development team by creating an issue at {0}"),
52 ALTITUDE_BELOW_ALLOWED_THRESHOLD("altitude ({0} m) is below the {1} m allowed threshold"),
53 POINT_INSIDE_ELLIPSOID("point is inside ellipsoid"),
54 TRAJECTORY_INSIDE_BRILLOUIN_SPHERE("trajectory inside the Brillouin sphere (r = {0})"),
55 ALMOST_EQUATORIAL_ORBIT("almost equatorial orbit (i = {0} degrees)"),
56 ALMOST_CRITICALLY_INCLINED_ORBIT("almost critically inclined orbit (i = {0} degrees)"),
57 UNABLE_TO_COMPUTE_ECKSTEIN_HECHLER_MEAN_PARAMETERS("unable to compute Eckstein-Hechler mean parameters after {0} iterations"),
58 NULL_PARENT_FOR_FRAME("null parent for frame {0}"),
59 FRAME_ALREADY_ATTACHED("frame {0} is already attached to frame {1}"),
60 FRAME_NOT_ATTACHED("frame {0} is not attached to the main frames tree"),
61 FRAME_ANCESTOR_OF_BOTH_FRAMES("frame {0} is an ancestor of both frames {1} and {2}"),
62 FRAME_ANCESTOR_OF_NEITHER_FRAME("frame {0} is an ancestor of neither frame {1} nor {2}"),
63 FRAME_NO_NTH_ANCESTOR("frame {0} has depth {1}, it cannot have an ancestor {2} levels above"),
64 NO_SUCH_ITRF_FRAME("ITRF frame {0} not found"),
65 UNSUPPORTED_LOCAL_ORBITAL_FRAME("unsupported local orbital frame, supported types: {0} and {1}"),
66 NON_PSEUDO_INERTIAL_FRAME("non pseudo-inertial frame \"{0}\""),
67 DATA_ROOT_DIRECTORY_DOES_NOT_EXIST("data root directory {0} does not exist"),
68 NOT_A_DIRECTORY("{0} is not a directory"),
69 NEITHER_DIRECTORY_NOR_ZIP_OR_JAR("{0} is neither a directory nor a zip/jar archive file"),
70 UNABLE_TO_FIND_RESOURCE("unable to find resource {0} in classpath"),
71 NO_EARTH_ORIENTATION_PARAMETERS_LOADED("no Earth Orientation Parameters loaded"),
72 MISSING_EARTH_ORIENTATION_PARAMETERS_BETWEEN_DATES("missing Earth Orientation Parameters between {0} and {1}"),
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 NON_CHRONOLOGICAL_DATES_IN_FILE("non-chronological dates in file {0}, line {1}"),
78 NO_IERS_UTC_TAI_HISTORY_DATA_LOADED("no IERS UTC-TAI history data loaded"),
79 NO_ENTRIES_IN_IERS_UTC_TAI_HISTORY_FILE("no entries found in IERS UTC-TAI history file {0}"),
80 MISSING_SERIE_J_IN_FILE("missing serie j = {0} in file {1} (line {2})"),
81 CANNOT_PARSE_BOTH_TAU_AND_GAMMA("cannot parse both τ and γ from the same Poissons series file"),
82 UNEXPECTED_END_OF_FILE_AFTER_LINE("unexpected end of file {0} (after line {1})"),
83 UNABLE_TO_PARSE_LINE_IN_FILE("unable to parse line {0} of file {1}:\n{2}"),
84 UNABLE_TO_FIND_FILE("unable to find file {0}"),
85 SPACECRAFT_MASS_BECOMES_NEGATIVE("spacecraft mass becomes negative: {0} kg"),
86 POSITIVE_FLOW_RATE("positive flow rate (q: {0})"),
87 NO_GRAVITY_FIELD_DATA_LOADED("no gravity field data loaded"),
88 GRAVITY_FIELD_NORMALIZATION_UNDERFLOW("gravity field normalization underflow for degree {0} and order {1}"),
89 NO_OCEAN_TIDE_DATA_LOADED("no ocean tide data loaded"),
90 OCEAN_TIDE_DATA_DEGREE_ORDER_LIMITS("ocean tide data file {0} limited to degree {1} and order {2}"),
91 OCEAN_TIDE_LOAD_DEFORMATION_LIMITS("load deformation coefficients limited to degree {0}, cannot parse degree {1} term from file {2}"),
92 POLAR_TRAJECTORY("polar trajectory (distance to polar axis: {0})"),
93 UNEXPECTED_FILE_FORMAT_ERROR_FOR_LOADER("unexpected format error for file {0} with loader {1}"),
94 DUPLICATED_GRAVITY_FIELD_COEFFICIENT_IN_FILE("duplicated gravity field coefficient {0}({1}, {2}) in file {3}"),
95 MISSING_GRAVITY_FIELD_COEFFICIENT_IN_FILE("missing gravity field coefficient {0}({1}, {2}) in file {3}"),
96 TOO_LARGE_DEGREE_FOR_GRAVITY_FIELD("too large degree (n = {0}, potential maximal degree is {1})"),
97 TOO_LARGE_ORDER_FOR_GRAVITY_FIELD("too large order (m = {0}, potential maximal order is {1})"),
98 SEVERAL_REFERENCE_DATES_IN_GRAVITY_FIELD("several reference dates ({0} and {1}) found in gravity field file {2}"),
99 NO_TLE_FOR_OBJECT("no TLE data available for object {0}"),
100 NO_TLE_FOR_LAUNCH_YEAR_NUMBER_PIECE("no TLE data available for launch year {0}, launch number {1}, launch piece {2}"),
101 NOT_TLE_LINES("lines {0} and {1} are not TLE lines:\n{0}: \"{2}\"\n{1}: \"{3}\""),
102 MISSING_SECOND_TLE_LINE("expected a second TLE line after line {0}:\n{0}: \"{1}\""),
103 TLE_LINES_DO_NOT_REFER_TO_SAME_OBJECT("TLE lines do not refer to the same object:\n{0}\n{1}"),
104 TLE_INVALID_PARAMETER("invalid TLE parameter for object {0}: {1} = {2}"),
105 TLE_CHECKSUM_ERROR("wrong checksum of TLE line {0}, expected {1} but got {2} ({3})"),
106 NO_TLE_DATA_AVAILABLE("no TLE data available"),
107 NOT_POSITIVE_SPACECRAFT_MASS("spacecraft mass is not positive: {0} kg"),
108 TOO_LARGE_ECCENTRICITY_FOR_PROPAGATION_MODEL("too large eccentricity for propagation model: e = {0}"),
109 NO_SOLAR_ACTIVITY_AT_DATE("no solar activity available at {0}, data available only in range [{1}, {2}]"),
110 NON_EXISTENT_MONTH("non-existent month {0}"),
111 NON_EXISTENT_YEAR_MONTH_DAY("non-existent date {0}-{1}-{2}"),
112 NON_EXISTENT_WEEK_DATE("non-existent week date {0}-W{1}-{2}"),
113 NON_EXISTENT_DATE("non-existent date {0}"),
114 NON_EXISTENT_DAY_NUMBER_IN_YEAR("no day number {0} in year {1}"),
115 NON_EXISTENT_HMS_TIME("non-existent time {0}:{1}:{2}"),
116 NON_EXISTENT_TIME("non-existent time {0}"),
117 OUT_OF_RANGE_SECONDS_NUMBER("out of range seconds number: {0}"),
118 ANGLE_TYPE_NOT_SUPPORTED("angle type not supported, supported angles: {0}, {1} and {2}"),
119 SATELLITE_COLLIDED_WITH_TARGET("satellite collided with target"),
120 ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND("attitude pointing law misses ground"),
121 TOO_SHORT_TRANSITION_TIME_FOR_ATTITUDES_SWITCH("{0} seconds transition time for attitudes switch is too short, should be longer than {1} seconds"),
122 ORBIT_AND_ATTITUDE_DATES_MISMATCH("orbit date ({0}) does not match attitude date ({1})"),
123 FRAMES_MISMATCH("frame {0} does not match frame {1}"),
124 INITIAL_STATE_NOT_SPECIFIED_FOR_ORBIT_PROPAGATION("initial state not specified for orbit propagation"),
125 PROPAGATOR_NOT_IN_EPHEMERIS_GENERATION_MODE("propagator is not in ephemeris generation mode"),
126 EVENT_DATE_TOO_CLOSE("event date {0}, greater than {1} minus {3} seconds and smaller than {2} plus {3} seconds, cannot be added"),
127 UNABLE_TO_READ_JPL_HEADER("unable to read header record from JPL ephemerides binary file {0}"),
128 INCONSISTENT_ASTRONOMICAL_UNIT_IN_FILES("inconsistent values of astronomical unit in JPL ephemerides files: ({0} and {1})"),
129 INCONSISTENT_EARTH_MOON_RATIO_IN_FILES("inconsistent values of Earth/Moon mass ratio in JPL ephemerides files: ({0} and {1})"),
130 NO_DATA_LOADED_FOR_CELESTIAL_BODY("no data loaded for celestial body {0}"),
131 NOT_A_JPL_EPHEMERIDES_BINARY_FILE("file {0} is not a JPL ephemerides binary file"),
132 NOT_A_MARSHALL_SOLAR_ACTIVITY_FUTURE_ESTIMATION_FILE("file {0} is not a Marshall Solar Activity Future Estimation (MSAFE) file"),
133 NO_JPL_EPHEMERIDES_BINARY_FILES_FOUND("no JPL ephemerides binary files found"),
134 OUT_OF_RANGE_BODY_EPHEMERIDES_DATE("out of range date for {0} ephemerides: {1}"),
135 OUT_OF_RANGE_EPHEMERIDES_DATE("out of range date for ephemerides: {0}, [{1}, {2}]"),
136 UNEXPECTED_TWO_ELEVATION_VALUES_FOR_ONE_AZIMUTH("unexpected two elevation values: {0} and {1}, for one azimuth: {2}"),
137 UNSUPPORTED_PARAMETER_NAME("unsupported parameter name {0}, supported names: {1}"),
138 TOO_SMALL_SCALE_FOR_PARAMETER("scale factor for parameter {0} is too small: {1}"),
139 UNKNOWN_ADDITIONAL_STATE("unknown additional state \"{0}\""),
140 UNKNOWN_MONTH("unknown month \"{0}\""),
141 SINGULAR_JACOBIAN_FOR_ORBIT_TYPE("Jacobian matrix for type {0} is singular with current orbit"),
142 STATE_JACOBIAN_NOT_INITIALIZED("state Jacobian has not been initialized yet"),
143 STATE_JACOBIAN_NOT_6X6("state Jacobian is a {0}x{1} matrix, it should be a 6x6 matrix"),
144 STATE_AND_PARAMETERS_JACOBIANS_ROWS_MISMATCH("state Jacobian has {0} rows but parameters Jacobian has {1} rows"),
145 INITIAL_MATRIX_AND_PARAMETERS_NUMBER_MISMATCH("initial Jacobian matrix has {0} columns, but {1} parameters have been selected"),
146 ORBIT_A_E_MISMATCH_WITH_CONIC_TYPE("orbit should be either elliptic with a > 0 and e < 1 or hyperbolic with a < 0 and e > 1, a = {0}, e = {1}"),
147 ORBIT_ANOMALY_OUT_OF_HYPERBOLIC_RANGE("true anomaly {0} out of hyperbolic range (e = {1}, {2} < v < {3})"),
148 HYPERBOLIC_ORBIT_NOT_HANDLED_AS("hyperbolic orbits cannot be handled as {0} instances"),
149 CCSDS_DATE_INVALID_PREAMBLE_FIELD("invalid preamble field in CCSDS date: {0}"),
150 CCSDS_DATE_INVALID_LENGTH_TIME_FIELD("invalid time field length in CCSDS date: {0}, expected {1}"),
151 CCSDS_DATE_MISSING_AGENCY_EPOCH("missing agency epoch in CCSDS date"),
152 CCSDS_UNEXPECTED_KEYWORD("unexpected keyword in CCSDS line number {0} of file {1}:\n{2}"),
153 CCSDS_UNKNOWN_GM("the central body gravitational coefficient cannot be retrieved from the ODM"),
154 CCSDS_UNKNOWN_SPACECRAFT_MASS("there is no spacecraft mass associated with this ODM file"),
155 CCSDS_UNKNOWN_CONVENTIONS("no IERS conventions have been set before parsing"),
156 CCSDS_INVALID_FRAME("frame {0} is not valid in this ODM file context"),
157 CCSDS_OEM_INCONSISTENT_TIME_SYSTEMS("inconsistent time systems in the ephemeris blocks: {0} ≠ {1}"),
158 CCSDS_TIME_SYSTEM_NOT_IMPLEMENTED("use of time system {0} in CCSDS files requires an additional ICD and is not implemented in Orekit"),
159 CCSDS_NO_CORRESPONDING_TIME_SCALE("the CCSDS time system {0} has no corresponding Orekit TimeScale."),
160 CCSDS_TDM_INCONSISTENT_TIME_SYSTEMS("Inconsistent time systems in the observations blocks: {0} ≠ {1}"),
161 CCSDS_TDM_INCONSISTENT_DATA_LINE("Inconsistent data line in TDM file at line {0} of file {1}.\n" +
162 "A TDM data line should be as follows \"keyword = epoch value\".\n" +
163 "Whereas read data line is: {2}"),
164 CCSDS_TDM_XML_INCONSISTENT_DATA_BLOCK("Inconsistent XML observation block at line {0} of TDM file {1}.\n" +
165 "A TDM observation block should be as follows\n\t<observation>\n\t\t<EPOCH>epoch</EPOCH>\n" +
166 "\t\t<KEYWORD>value</KEYWORD>\n\t</observation>"),
167 CCSDS_TDM_KEYWORD_NOT_FOUND("No CCSDS TDM keyword was found at line {0} of file {1}:\n{2}"),
168 CCSDS_TIME_SYSTEM_NOT_READ_YET("Parameter {0} needs a time system to be interpreted"),
169 CCSDS_TDM_UNKNOWN_FORMAT("TDM file {0} format is unknown. Please specify a file format: KEYVALUE or XML"),
170 ADDITIONAL_STATE_NAME_ALREADY_IN_USE("name \"{0}\" is already used for an additional state"),
171 NON_RESETABLE_STATE("reset state not allowed"),
172 DSST_NEWCOMB_OPERATORS_COMPUTATION("Cannot compute Newcomb operators for sigma > rho ({0} > {1})"),
173 DSST_VMNS_COEFFICIENT_ERROR_MS("Cannot compute the Vmns coefficient with m > n ({0} > {1})"),
174 DSST_SPR_SHADOW_INCONSISTENT("inconsistent shadow computation: entry = {0} whereas exit = {1}"),
175 DSST_ECC_NO_NUMERICAL_AVERAGING_METHOD("The current orbit has an eccentricity ({0} > 0.5). DSST needs an unimplemented time dependent numerical method to compute the averaged rates"),
176 SP3_UNSUPPORTED_VERSION("unsupported sp3 file version {0}"),
177 SP3_NUMBER_OF_EPOCH_MISMATCH("found {0} epochs in file {1}, expected {2}"),
178 SP3_UNEXPECTED_END_OF_FILE("unexpected end of sp3 file (after line {0})"),
179 NON_EXISTENT_GEOMAGNETIC_MODEL("non-existent geomagnetic model {0} for year {1}"),
180 UNSUPPORTED_TIME_TRANSFORM("geomagnetic model {0} with epoch {1} does not support time transformation, no secular variation coefficients defined"),
181 OUT_OF_RANGE_TIME_TRANSFORM("time transformation of geomagnetic model {0} with epoch {1} is outside its validity range: {2} != [{3}, {4}]"),
182 NOT_ENOUGH_DATA_FOR_INTERPOLATION("not enough data for interpolation (sample size = {0})"),
183 NOT_ENOUGH_CACHED_NEIGHBORS("too small number of cached neighbors: {0} (must be at least {1})"),
184 NO_CACHED_ENTRIES("no cached entries"),
185 NON_CHRONOLOGICALLY_SORTED_ENTRIES("generated entries not sorted: {0} > {1}"),
186 NO_DATA_GENERATED("no data generated around date: {0}"),
187 UNABLE_TO_GENERATE_NEW_DATA_BEFORE("unable to generate new data before {0}"),
188 UNABLE_TO_GENERATE_NEW_DATA_AFTER("unable to generate new data after {0}"),
189 UNABLE_TO_COMPUTE_HYPERBOLIC_ECCENTRIC_ANOMALY("unable to compute hyperbolic eccentric anomaly from the mean anomaly after {0} iterations"),
190 UNABLE_TO_COMPUTE_DSST_MEAN_PARAMETERS("unable to compute mean orbit from osculating orbit after {0} iterations"),
191 OUT_OF_RANGE_DERIVATION_ORDER("derivation order {0} is out of range"),
192 ORBIT_TYPE_NOT_ALLOWED("orbit type {0} not allowed here, allowed types: {1}"),
193 NON_PSEUDO_INERTIAL_FRAME_NOT_SUITABLE_AS_REFERENCE_FOR_INERTIAL_FORCES("non pseudo-inertial frame {0} is not suitable as reference for inertial forces"),
194 METHOD_NOT_AVAILABLE_WITHOUT_CENTRAL_BODY("method not available in the absence of a central body"),
195 INCOMPATIBLE_FRAMES("operation not available between frames {0} and {1}"),
196 UNDEFINED_ORBIT("orbit not defined, state rather contains an absolute position-velocity-acceleration"),
197 UNDEFINED_ABSOLUTE_PVCOORDINATES("absolute position-velocity-acceleration not defined, state rather contains an orbit"),
198 INERTIAL_FORCE_MODEL_MISSING("an inertial force model has to be used when propagating in non-inertial frame {0}"),
199 NO_SEM_ALMANAC_AVAILABLE("no SEM almanac file found"),
200 NOT_A_SUPPORTED_SEM_ALMANAC_FILE("file {0} is not a supported SEM almanac file"),
201 NO_YUMA_ALMANAC_AVAILABLE("no Yuma almanac file found"),
202 NOT_A_SUPPORTED_YUMA_ALMANAC_FILE("file {0} is not a supported Yuma almanac file"),
203 NOT_ENOUGH_GNSS_FOR_DOP("only {0} GNSS orbits are provided while {1} are needed to compute the DOP"),
204 NOT_ENOUGH_PROPAGATORS("Creating an aggregate propagator requires at least one constituent propagator, but none were provided."),
205 NULL_ARGUMENT("argument {0} cannot be null"),
206 VALUE_NOT_FOUND("value {0} not found in {1}"),
207 EPHEMERIS_FILE_NO_MULTI_SUPPORT("Ephemeris file format does not support multiple space objects"),
208 KLOBUCHAR_ALPHA_BETA_NOT_LOADED("Klobuchar coefficients α or β could not be loaded from {0}"),
209 KLOBUCHAR_ALPHA_BETA_NOT_AVAILABLE_FOR_DATE("Klobuchar coefficients α or β not available for date {0}"),
210 NO_KLOBUCHAR_ALPHA_BETA_IN_FILE("file {0} does not contain Klobuchar coefficients α or β"),
211 NO_REFERENCE_DATE_FOR_PARAMETER("no reference date set for parameter {0}"),
212 STATION_NOT_FOUND("station {0} not found, known stations: {1}"),
213 UNKNOWN_SATELLITE_SYSTEM("unknown satellite system {0}"),
214 UNKNOWN_SATELLITE_ANTENNA_CODE("unknown satellite antenna code {0}"),
215 UNSUPPORTED_FREQUENCY_FOR_ANTENNA("frequency {0} is not supported by antenna {1}"),
216 CANNOT_FIND_SATELLITE_IN_SYSTEM("cannot find satellite {0} in satellite system {1}"),
217 UNKNOWN_RINEX_FREQUENCY("unknown RINEX frequency {0} in file {1}, line {2}"),
218 MISMATCHED_FREQUENCIES("mismatched frequencies in file {0}, line {1} (expected {2}, got {3})"),
219 WRONG_COLUMNS_NUMBER("wrong number of columns in file {0}, line {1} (expected {2} columns, got {3} columns)"),
220 UNSUPPORTED_FILE_FORMAT("unsupported format for file {0}"),
221 INCOMPLETE_HEADER("incomplete header in file {0}"),
222 INCONSISTENT_NUMBER_OF_SATS("inconsistent number of satellites in line {0}, file {1}: observation with {2} satellites and number of max satellites is {3}"),
223 INCONSISTENT_SATELLITE_SYSTEM("the satellite system {3} from line {0}, file {1} is not consistent with the Rinex Satellite System {2} in header"),
224 NO_PROPAGATOR_CONFIGURED("no propagator configured"),
225 DIMENSION_INCONSISTENT_WITH_PARAMETERS("dimension {0} is inconsistent with parameters list: {1}"),
226 NOT_A_SUPPORTED_UNIX_COMPRESSED_FILE("file {0} is not a supported Unix-compressed file"),
227 UNEXPECTED_END_OF_FILE("unexpected end of file {0}"),
228 CORRUPTED_FILE("file {0} is corrupted"),
229 VIENNA_ACOEF_OR_ZENITH_DELAY_NOT_LOADED("Vienna coefficients ah or aw or zh or zw could not be loaded from {0}"),
230 VIENNA_ACOEF_OR_ZENITH_DELAY_NOT_AVAILABLE_FOR_DATE("Vienna coefficients ah or aw or zh or zw not available for date {0}"),
231 NO_VIENNA_ACOEF_OR_ZENITH_DELAY_IN_FILE("file {0} does not contain Vienna coefficients ah, aw, zh or zw"),
232 IRREGULAR_OR_INCOMPLETE_GRID("irregular or incomplete grid in file {0}"),
233 INVALID_SATELLITE_SYSTEM("invalid satellite system {0}"),
234 NO_TEC_DATA_IN_FILE_FOR_DATE("IONEX file {0} does not contain TEC data for date {1}"),
235 INCONSISTENT_NUMBER_OF_TEC_MAPS_IN_FILE("number of maps {0} is inconsistent with header specification: {1}"),
236 NO_LATITUDE_LONGITUDE_BONDARIES_IN_IONEX_HEADER("file {0} does not contain latitude or longitude bondaries in its header section"),
237 NO_EPOCH_IN_IONEX_HEADER("file {0} does not contain epoch of first or last map in its header section"),
238 ITRF_VERSIONS_PREFIX_ONLY("The first column of itrf-versions.conf is a plain " +
239 "prefix that is matched against the name of each loaded file. It should " +
240 "not contain any regular expression syntax or directory components, i.e. " +
241 "\"/\" or \"\\\". Actual value: \"{0}\"."),
242 CANNOT_COMPUTE_AIMING_AT_SINGULAR_POINT("cannot compute aiming direction at singular point: latitude = {0}, longitude = {1}"),
243 STEC_INTEGRATION_DID_NOT_CONVERGE("STEC integration did not converge"),
244 MODIP_GRID_NOT_LOADED("MODIP grid not be loaded from {0}"),
245 NEQUICK_F2_FM3_NOT_LOADED("NeQuick coefficient f2 or fm3 not be loaded from {0}"),
246 NOT_A_SUPPORTED_HATANAKA_COMPRESSED_FILE("file {0} is not a supported Hatanaka-compressed file"),
247 INVALID_MEASUREMENT_TYPES_FOR_COMBINATION_OF_MEASUREMENTS("invalid measurement types {0} and {1} for the combination of measurements {2}"),
248 INCOMPATIBLE_FREQUENCIES_FOR_COMBINATION_OF_MEASUREMENTS("frequencies {0} and {1} are incompatibles for the {2} combination"),
249 NON_CHRONOLOGICAL_DATES_FOR_OBSERVATIONS("observations {0} and {1} are not in chronological dates"),
250 EXCEPTIONAL_DATA_CONTEXT("Use of the ExceptionalDataContext detected. This is typically used to detect developer errors.");
251
252
253
254
255 private static final String RESOURCE_BASE_NAME = "assets/org/orekit/localization/OrekitMessages";
256
257
258 private final String sourceFormat;
259
260
261
262
263
264 OrekitMessages(final String sourceFormat) {
265 this.sourceFormat = sourceFormat;
266 }
267
268
269 public String getSourceString() {
270 return sourceFormat;
271 }
272
273
274 public String getLocalizedString(final Locale locale) {
275 try {
276 final ResourceBundle bundle =
277 ResourceBundle.getBundle(RESOURCE_BASE_NAME, locale, new UTF8Control());
278 if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
279 final String translated = bundle.getString(name());
280 if ((translated != null) &&
281 (translated.length() > 0) &&
282 (!translated.toLowerCase().contains("missing translation"))) {
283
284 return translated;
285 }
286 }
287
288 } catch (MissingResourceException mre) {
289
290 }
291
292
293
294 return sourceFormat;
295
296 }
297
298
299
300
301
302
303
304
305
306 public static class UTF8Control extends ResourceBundle.Control {
307
308
309 @Override
310 public ResourceBundle newBundle(final String baseName, final Locale locale, final String format,
311 final ClassLoader loader, final boolean reload)
312 throws IllegalAccessException, InstantiationException, IOException {
313
314 final String bundleName = toBundleName(baseName, locale);
315 final String resourceName = toResourceName(bundleName, "utf8");
316 ResourceBundle bundle = null;
317 InputStream stream = null;
318 if (reload) {
319 final URL url = loader.getResource(resourceName);
320 if (url != null) {
321 final URLConnection connection = url.openConnection();
322 if (connection != null) {
323 connection.setUseCaches(false);
324 stream = connection.getInputStream();
325 }
326 }
327 } else {
328 stream = loader.getResourceAsStream(resourceName);
329 }
330 if (stream != null) {
331 try {
332
333 bundle = new PropertyResourceBundle(new InputStreamReader(stream, StandardCharsets.UTF_8));
334 } finally {
335 stream.close();
336 }
337 }
338 return bundle;
339 }
340 }
341 }