Title: TimeZoneValidator Description: Validates time zone typed configuration items. net.opentsdb.tools.TimeZoneValidator
| 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> |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…