MCPcopy
hub / github.com/OpenTSDB/opentsdb / TimeZoneValidator

Class TimeZoneValidator

src/tools/ConfigMetaType.java:450–468  ·  view source on GitHub ↗

Title: TimeZoneValidator Description: Validates time zone typed configuration items. net.opentsdb.tools.TimeZoneValidator

Source from the content-addressed store, hash-verified

448 * <p><code>net.opentsdb.tools.TimeZoneValidator</code></p>
449 */
450 public static class TimeZoneValidator implements ArgValueValidator {
451 private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
452
453 @Override
454 public void validate(final ConfigurationItem citem) {
455 final String tz = citem.getValue();
456 if("DEFAULT".equalsIgnoreCase(tz)) {
457 citem.setValue(TimeZone.getDefault().getDisplayName());
458 return;
459 }
460 TimeZone timeZone = TimeZone.getTimeZone(tz);
461 if("GMT".equals(timeZone.getID())) {
462 if(!tz.toUpperCase().contains("GMT")) {
463 throw new IllegalArgumentException("Unrecognized TimeZone [" + tz + "]");
464 }
465 }
466 }
467
468 }
469
470 /**
471 * <p>Title: FileListValidator</p>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…