示例#1
0
  private FSOutputStream(
      FSRevisionNode revNode,
      CountingOutputStream targetFileOS,
      File targetFile,
      InputStream source,
      long deltaStart,
      long repSize,
      long repOffset,
      FSTransactionRoot txnRoot,
      boolean compress,
      FSWriteLock txnLock)
      throws SVNException {
    myTxnRoot = txnRoot;
    myTargetFileOS = targetFileOS;
    myTargetFile = targetFile;
    mySourceStream = source;
    myDeltaStart = deltaStart;
    myRepSize = repSize;
    myRepOffset = repOffset;
    isHeaderWritten = false;
    myRevNode = revNode;
    mySourceOffset = 0;
    myIsClosed = false;
    myTxnLock = txnLock;
    myDeltaGenerator = new SVNDeltaGenerator(SVN_DELTA_WINDOW_SIZE);
    myTextBuffer = new ByteArrayOutputStream();

    try {
      myMD5Digest = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException nsae) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.IO_ERROR,
              "MD5 implementation not found: {0}",
              nsae.getLocalizedMessage());
      SVNErrorManager.error(err, nsae, SVNLogType.FSFS);
    }
    try {
      mySHA1Digest = MessageDigest.getInstance("SHA1");
    } catch (NoSuchAlgorithmException nsae) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.IO_ERROR,
              "SHA1 implementation not found: {0}",
              nsae.getLocalizedMessage());
      SVNErrorManager.error(err, nsae, SVNLogType.FSFS);
    }

    myIsCompress = compress;
  }
示例#2
0
  private FSInputStream(SVNDeltaCombiner combiner, FSRepresentation representation, FSFS owner)
      throws SVNException {
    myCombiner = combiner;
    myChunkIndex = 0;
    isChecksumFinalized = false;
    myHexChecksum = representation.getMD5HexDigest();
    myOffset = 0;
    myLength = representation.getExpandedSize();
    try {
      myDigest = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException nsae) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.IO_ERROR,
              "MD5 implementation not found: {0}",
              nsae.getLocalizedMessage());
      SVNErrorManager.error(err, nsae, SVNLogType.FSFS);
    }

    try {
      buildRepresentationList(representation, myRepStateList, owner);
    } catch (SVNException svne) {
      /*
       * Something terrible has happened while building rep list, need to
       * close any files still opened
       */
      close();
      throw svne;
    }
  }
  /**
   * Constructor SignatureDSA
   *
   * @throws XMLSignatureException
   */
  public SignatureDSA() throws XMLSignatureException {
    String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA.URI);
    if (log.isLoggable(java.util.logging.Level.FINE)) {
      log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
    }

    String provider = JCEMapper.getProviderId();
    try {
      if (provider == null) {
        this.signatureAlgorithm = Signature.getInstance(algorithmID);
      } else {
        this.signatureAlgorithm = Signature.getInstance(algorithmID, provider);
      }
    } catch (java.security.NoSuchAlgorithmException ex) {
      Object[] exArgs = {algorithmID, ex.getLocalizedMessage()};
      throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
    } catch (java.security.NoSuchProviderException ex) {
      Object[] exArgs = {algorithmID, ex.getLocalizedMessage()};
      throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
    }
  }
示例#4
0
  private SSLSocketFactory getSSLSocketFactory() {
    if (mSocketFactory != null) return mSocketFactory;

    mSocketFactory = SSLSocketFactory.getSocketFactory();

    KeyStore trustStore;
    try {
      trustStore = KeyStore.getInstance(KeyStore.getDefaultType());

      trustStore.load(null, null);
      mSocketFactory = new MySSLSocketFactory(trustStore);

      mSocketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
    } catch (NoSuchAlgorithmException e) {
      // TODO Auto-generated catch block
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);

    } catch (CertificateException e) {
      // TODO Auto-generated catch block
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);

    } catch (IOException e) {
      // TODO Auto-generated catch block
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);

    } catch (KeyStoreException e) {
      // TODO Auto-generated catch block
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);

    } catch (KeyManagementException e) {
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);

    } catch (UnrecoverableKeyException e) {
      Log.e("getSSLSocketFactory", e.getLocalizedMessage(), e);
    }
    return mSocketFactory;
  }