java.time.zone.ZoneRulesException类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(292)

本文整理了Java中java.time.zone.ZoneRulesException类的一些代码示例,展示了ZoneRulesException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRulesException类的具体详情如下:
包路径:java.time.zone.ZoneRulesException
类名称:ZoneRulesException

ZoneRulesException介绍

[英]Thrown to indicate a problem with time-zone configuration.

This exception is used to indicate a problems with the configured time-zone rules.

Specification for implementors

This class is intended for use in a single thread.
[中]抛出以指示时区配置有问题。
此异常用于指示配置的时区规则存在问题。
####实施者规范
此类用于单个线程。

代码示例

代码示例来源:origin: neo4j/neo4j

throw new TemporalParseException( e.getMessage(), e );

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Gets the provider for the zone ID.
 *
 * @param zoneId  the zone region ID as used by {@code ZoneId}, not null
 * @return the provider, not null
 * @throws ZoneRulesException if the zone ID is unknown
 */
private static ZoneRulesProvider getProvider(String zoneId) {
  ZoneRulesProvider provider = ZONES.get(zoneId);
  if (provider == null) {
    if (ZONES.isEmpty()) {
      throw new ZoneRulesException("No time-zone data files registered");
    }
    throw new ZoneRulesException("Unknown time-zone ID: " + zoneId);
  }
  return provider;
}

代码示例来源:origin: com.github.seratch/java-time-backport

ZoneRules getRules(String regionId) {
  int regionIndex = Arrays.binarySearch(regionArray, regionId);
  if (regionIndex < 0) {
    return null;
  }
  try {
    return createRule(ruleIndices[regionIndex]);
  } catch (Exception ex) {
    throw new ZoneRulesException("Invalid binary time-zone data: TZDB:" + regionId + ", version: " + versionId, ex);
  }
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Creates an instance.
 * Created by the {@code ServiceLoader}.
 *
 * @throws ZoneRulesException if unable to load
 */
public TzdbZoneRulesProvider() {
  super();
  if (load(ZoneRulesProvider.class.getClassLoader()) == false) {
    throw new ZoneRulesException("No time-zone rules found for 'TZDB'");
  }
}

代码示例来源:origin: org.neo4j/neo4j-values

throw new TemporalParseException( e.getMessage(), e );

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Loads the rules.
 *
 * @param classLoader  the class loader to use, not null
 * @return true if updated
 * @throws ZoneRulesException if unable to load
 */
private boolean load(ClassLoader classLoader) {
  boolean updated = false;
  URL url = null;
  try {
    Enumeration<URL> en = classLoader.getResources("org/threeten/bp/TZDB.dat");
    while (en.hasMoreElements()) {
      url = en.nextElement();
      if (loadedUrls.add(url.toExternalForm())) {
        Iterable<Version> loadedVersions = load(url);
        for (Version loadedVersion : loadedVersions) {
          if (versions.putIfAbsent(loadedVersion.versionId, loadedVersion) != null) {
            throw new ZoneRulesException("Data already loaded for TZDB time-zone rules version: " + loadedVersion.versionId);
          }
        }
        updated = true;
      }
    }
  } catch (Exception ex) {
    throw new ZoneRulesException("Unable to load TZDB time-zone rules: " + url, ex);
  }
  return updated;
}

代码示例来源:origin: conveyal/r5

tz = ZoneId.of(agency.agency_timezone);
} catch (ZoneRulesException z) {
  LOG.error("Agency {} in GTFS with timezone '{}' wasn't found in timezone database reason: {}", agency.agency_name, agency.agency_timezone, z.getMessage());

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Registers the provider.
 *
 * @param provider  the provider to register, not null
 * @throws ZoneRulesException if unable to complete the registration
 */
private static void registerProvider0(ZoneRulesProvider provider) {
  for (String zoneId : provider.provideZoneIds()) {
    Jdk8Methods.requireNonNull(zoneId, "zoneId");
    ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider);
    if (old != null) {
      throw new ZoneRulesException(
        "Unable to register zone as one already registered with that ID: " + zoneId +
        ", currently loading from provider: " + provider);
    }
  }
}

代码示例来源:origin: com.conveyal/r5

tz = ZoneId.of(agency.agency_timezone);
} catch (ZoneRulesException z) {
  LOG.error("Agency {} in GTFS with timezone '{}' wasn't found in timezone database reason: {}", agency.agency_name, agency.agency_timezone, z.getMessage());

代码示例来源:origin: com.github.seratch/java-time-backport

@Override
protected ZoneRules provideRules(String zoneId, boolean forCaching) {
  Jdk8Methods.requireNonNull(zoneId, "zoneId");
  ZoneRules rules = versions.lastEntry().getValue().getRules(zoneId);
  if (rules == null) {
    throw new ZoneRulesException("Unknown time-zone ID: " + zoneId);
  }
  return rules;
}

相关文章

微信公众号

最新文章

更多

ZoneRulesException类方法