Package org.sonatype.siesta

Examples of org.sonatype.siesta.ValidationErrorsException


      if (actualPort != null) {
        try {
          actualPortInt = Integer.valueOf(actualPort);
        }
        catch (NumberFormatException e) {
          throw new ValidationErrorsException("port", "Port must be an integer");
        }
      }

      Certificate[] chain;
      try {
        chain = retrieveCertificates(remoteStorageContext, actualHost, actualPortInt, actualProtocolHint);
      }
      catch (Exception e) {
        String errorMessage = e.getMessage();
        if (e instanceof UnknownHostException) {
          errorMessage = "Unknown host '" + actualHost + "'";
        }
        throw new NotFoundException(errorMessage);
      }
      if (chain == null || chain.length == 0) {
        throw new NotFoundException(
            "Could not retrieve an SSL certificate from " + actualHost + ":" + actualPortInt
        );
      }

      return asCertificateXO(chain[0], isInNexusSSLTrustStore(chain[0]));
    }
    throw new ValidationErrorsException("One of repositoryId or host/port should be specified");
  }
View Full Code Here


    try {
      final Certificate certificate = decodePEMFormattedCertificate(pem.getValue());
      return asCertificateXO(certificate, isInNexusSSLTrustStore(certificate));
    }
    catch (CertificateParsingException e) {
      throw new ValidationErrorsException("pem", "Invalid PEM formatted certificate");
    }
  }
View Full Code Here

      final Certificate certificate = CertificateUtil.decodePEMFormattedCertificate(pem.getValue());
      trustStore.importTrustCertificate(certificate, calculateFingerprint(certificate));
      return asCertificateXO(certificate, true);
    }
    catch (CertificateParsingException e) {
      throw new ValidationErrorsException("pem", "Invalid PEM formatted certificate");
    }
  }
View Full Code Here

TOP

Related Classes of org.sonatype.siesta.ValidationErrorsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.