@@ -389,6 +389,15 @@ public boolean doesJoinExists(String name) {
389
389
390
390
/**
391
391
* Loads the white lists into application
392
+ *
393
+ * <p>Instead of using @javax.annotation.Resource to auto read the resource from JNDI,
394
+ * which is kind of mandatory (throw a <code>NamingException</code> never be handled and will stop the load progress),
395
+ * here we read and handle the exception to not stop the progress, which kind of allowing optionally configure.
396
+ *
397
+ * <p>For exception handling: besides disabling the functionality - setting the field in configuration xml file
398
+ * to false or the location field is not in the list,
399
+ * all other exceptions will end up not making any changes to the whitelist map, which means will never break
400
+ * the load progress.
392
401
* @author yuzhang
393
402
*/
394
403
private void loadWhiteLists () {
@@ -405,7 +414,9 @@ private void loadWhiteLists() {
405
414
whitelistEnabled = false ;
406
415
return ;
407
416
} else {
408
- whitelist = new HashMap <>();
417
+ // to be able to support change the configuration white list Json file at runtime
418
+ if (whitelist == null )
419
+ whitelist = new HashMap <>();
409
420
whitelistEnabled = true ;
410
421
}
411
422
@@ -428,7 +439,7 @@ private void loadWhiteLists() {
428
439
log .info ("Added one email from whitelist: " + name
429
440
+ " with resources: " + resources .toString ());
430
441
} catch (ClassCastException | NullPointerException npe ) {
431
- log .log (Level .SEVERE , "The format of each object in whitelist array is not right. Please take a look into the sample whitelist json" );
442
+ log .log (Level .WARNING , "The format of each object in whitelist array is not right. Please take a look into the sample whitelist json" );
432
443
}
433
444
434
445
}
@@ -440,9 +451,9 @@ private void loadWhiteLists() {
440
451
} catch (ClassCastException cce ) {
441
452
// change this to Log4J would be great
442
453
// I think another ticket is changing this to Log4j
443
- log .log (Level .SEVERE , "The root layer of whitelist should be an array" );
454
+ log .log (Level .WARNING , "The root layer of whitelist should be an array" );
444
455
} catch (JsonParsingException ex ) {
445
- log .log (Level .INFO , "Input whitelist file is not well formatted" );
456
+ log .log (Level .WARNING , "Input whitelist file is not well formatted" );
446
457
}
447
458
}
448
459
0 commit comments