@@ -208,9 +208,7 @@ static void load(WmsConfigBean wmsConfig, TdsContext tdsContext) {
208
208
wmsConfig .setAllow (Boolean .parseBoolean (WMS_ALLOW .getValueFromThreddsConfig ()));
209
209
wmsConfig .setAllowRemote (Boolean .parseBoolean (WMS_ALLOW_REMOTE .getValueFromThreddsConfig ()));
210
210
211
- String paletteLocation = WMS_PALETTE_LOCATION_DIR .getValueFromThreddsConfig ();
212
- if (paletteLocation == null )
213
- paletteLocation = defaultPaletteLocation ;
211
+ final String paletteLocation = getValueFromThreddsConfigOrDefault (WMS_PALETTE_LOCATION_DIR , defaultPaletteLocation );
214
212
wmsConfig .setPaletteLocationDir (paletteLocation );
215
213
try {
216
214
ColourPalette .addPaletteDirectory (new File (paletteLocation ));
@@ -224,9 +222,7 @@ static void load(WmsConfigBean wmsConfig, TdsContext tdsContext) {
224
222
}
225
223
}
226
224
227
- String stylesLocation = WMS_STYLES_LOCATION_DIR .getValueFromThreddsConfig ();
228
- if (stylesLocation == null )
229
- stylesLocation = defaultStylesLocation ;
225
+ final String stylesLocation = getValueFromThreddsConfigOrDefault (WMS_STYLES_LOCATION_DIR , defaultStylesLocation );
230
226
wmsConfig .setStylesLocationDir (stylesLocation );
231
227
try {
232
228
SldTemplateStyleCatalogue .getStyleCatalogue ().addStylesInDirectory (new File (stylesLocation ));
@@ -236,9 +232,7 @@ static void load(WmsConfigBean wmsConfig, TdsContext tdsContext) {
236
232
}
237
233
}
238
234
239
- String wmsConfigFile = WMS_CONFIG_FILE .getValueFromThreddsConfig ();
240
- if (wmsConfigFile == null )
241
- wmsConfigFile = defaultWmsConfigFile ;
235
+ final String wmsConfigFile = getValueFromThreddsConfigOrDefault (WMS_CONFIG_FILE , defaultWmsConfigFile );
242
236
243
237
WmsDetailedConfig wdc = WmsDetailedConfig .fromLocation (wmsConfigFile );
244
238
if (wdc == null ) {
@@ -276,6 +270,14 @@ static void load(WmsConfigBean wmsConfig, TdsContext tdsContext) {
276
270
}
277
271
}
278
272
273
+ private static String getValueFromThreddsConfigOrDefault (WmsConfigMappings property , String defaultValue ) {
274
+ final String value = property .getValueFromThreddsConfig ();
275
+ if (value == null ) {
276
+ return defaultValue ;
277
+ }
278
+ return value ;
279
+ }
280
+
279
281
enum TdsUpdateConfigMappings {
280
282
TDSUPDAATE_LOGVERSIONINFO ("TdsUpdateConfig.logVersionInfo" , null , "true" );
281
283
0 commit comments