class CertificateLoader {

  @VisibleForTesting
  static Path resolvePath(String certificatePath) {
    Path path;
    if (certificatePath.startsWith("file:")) {
      try {
        logger.info("using file resolver for {}", certificatePath);
        path = Paths.get(new URL(certificatePath).toURI());
        if (!Files.exists(path)) {
          throw new FileNotFoundException();
        }
        return path;
      } catch (Exception e) {
        throw new FeatureException(
            Problem.localProblem("certificatePath resolver failed " + certificatePath,
                e.getMessage()), e);
      }
    }

    if (certificatePath.startsWith("classpath:")) {
      logger.info("using classpath resolver for {}", certificatePath);
      String resource = getResourceUrl(
          certificatePath.substring("classpath:".length(), certificatePath.length())).getPath();
      return Paths.get(resource);
    }

    throw new FeatureException(
        Problem.localProblem(
            "certificatePath must start with file: or classpath: " + certificatePath, ""));
  }

    CertificateLoader(String certificatePath);

}