org.apache.commons.lang.ArrayUtils#clone ( )源码实例Demo

下面列出了org.apache.commons.lang.ArrayUtils#clone ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: freehealth-connector   文件: TimestampUtil.java
public static TimeStampToken getTimeStampToken(byte[] tsToken) throws TechnicalConnectorException {
   byte[] cloneTsToken = ArrayUtils.clone(tsToken);

   try {
      cloneTsToken = ConnectorIOUtils.base64Decode(cloneTsToken, true);
      return new TimeStampToken(new CMSSignedData(cloneTsToken));
   } catch (TSPException var3) {
      LOG.error(var3.getClass().getSimpleName() + ": " + var3.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var3, new Object[]{var3.getMessage()});
   } catch (IOException var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var4, new Object[]{var4.getMessage()});
   } catch (CMSException var5) {
      LOG.error(var5.getClass().getSimpleName() + ": " + var5.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var5, new Object[]{var5.getMessage()});
   }
}
 
private void commonValidateMethod(SendResponseType responseType, Blob blob) throws InvalidBlobContentConnectorException, TechnicalConnectorException {
   this.checkIfInitialized();
   String neededXadesLevel = this.retrieveResponseXadesProperty();
   Base64Binary xades = null;
   if (responseType != null && responseType.getReturn() != null) {
      xades = responseType.getReturn().getXadesT();
   }

   if (xades != null && xades.getValue() != null && !ArrayUtils.isEmpty(xades.getValue())) {
      byte[] xadesByteArray = ArrayUtils.clone(xades.getValue());
      AdvancedElectronicSignatureEnumeration xadesSignatureType = this.convertToSignatureType(neededXadesLevel);
      SignatureBuilder builder = SignatureBuilderFactory.getSignatureBuilder(xadesSignatureType);
      Element sigElement = ConnectorXmlUtils.toElement(xadesByteArray);
      Map<String, Object> optionMap = new HashMap();
      SignatureVerificationResult result = builder.verify(this.reassemblyMessage(responseType, sigElement), xadesByteArray, optionMap);
      if (result.getErrors().size() != 0) {
         this.createInvalidBlobContentConnectorException(blob, result, xades);
      }
   } else if (!"none".equals(neededXadesLevel)) {
      throw new InvalidBlobContentConnectorException(InvalidBlobContentConnectorExceptionValues.XADESVALUE_NULL, blob);
   }

}
 
public char[] obtainPIN(int triesLeft, PINPurpose type) throws UserCancelledException {
   if (!this.pincodeMap.containsKey(type)) {
      char[] result = this.backup.obtainPIN(triesLeft, type);

      try {
         this.pincodeMap.put(type, new SecureString(result));
      } catch (Exception var5) {
         LOG.error(var5.getClass().getSimpleName() + ":" + var5.getMessage(), var5);
      }

      return ArrayUtils.clone(result);
   } else {
      SecureString content = (SecureString)this.pincodeMap.get(type);
      if (this.triesLeft == null) {
         this.triesLeft = triesLeft;
      } else if (this.triesLeft.compareTo(triesLeft) != 0) {
         LOG.warn("Second attempt detected: reseting pincode.");
         this.pincodeMap.remove(type);
         throw new UserCancelledException();
      }

      try {
         if (content != null && content.getValue().length != 0) {
            return ArrayUtils.clone(content.getValue());
         } else {
            LOG.error("No pincode detected.");
            throw new UserCancelledException();
         }
      } catch (Exception var6) {
         LOG.error(var6.getClass().getSimpleName() + ":" + var6.getMessage(), var6);
         throw new UserCancelledException();
      }
   }
}
 
protected final byte[] handleAndDecryptIfNeeded(byte[] data, boolean encrypted, AbstractConsultationBuilder.ExceptionContainer<?> container) throws TechnicalConnectorException, EhboxBusinessConnectorException {
   if (ArrayUtils.isEmpty(data)) {
      return data;
   } else {
      byte[] byteVal = ArrayUtils.clone(data);
      if (ConfigFactory.getConfigValidator().getBooleanProperty("ehboxv3.try.to.base64decode.content", true)) {
         byteVal = ConnectorIOUtils.base64Decode(byteVal, false);
      }

      if (encrypted) {
         if (SessionUtil.getEncryptionCrypto() == null) {
            throw new EhboxBusinessConnectorException(EhboxBusinessConnectorExceptionValues.CRYPTO_NOT_PROPERLY_INITIALIZED, (Throwable)null, new Object[0]);
         }

         try {
            byteVal = SessionUtil.getEncryptionCrypto().unseal(Crypto.SigningPolicySelector.WITH_NON_REPUDIATION, byteVal).getContentAsByte();
         } catch (UnsealConnectorException var8) {
            UnsealConnectorException e = var8;
            container.exceptions.add(var8);

            try {
               byteVal = ConnectorExceptionUtils.processUnsealConnectorException(e);
            } catch (UnsealConnectorException var7) {
               LOG.error("unrecoverable unsealException occurred while decrypting ehbox content , returning null as message , error : " + var7.getMessage());
               throw new EhboxCryptoException(var7, (Message)null);
            }
         }
      }

      return byteVal;
   }
}
 
源代码5 项目: score   文件: Payload.java
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
@Override
public Object clone() {
	try {
		Payload cloned = (Payload) super.clone();
		cloned.data = ArrayUtils.clone(data);
		return cloned;
	} catch (CloneNotSupportedException e) {
		System.out.println(e);
		return null;
	}
}
 
源代码6 项目: freehealth-connector   文件: OcspRef.java
OcspRef(byte[] inOcspEncoded) {
   this.ocspEncoded = ArrayUtils.clone(inOcspEncoded);

   try {
      this.ocsp = (BasicOCSPResp)(new OCSPResp(this.ocspEncoded)).getResponseObject();
   } catch (Exception var3) {
      throw new IllegalArgumentException(var3);
   }
}
 
源代码7 项目: freehealth-connector   文件: Identity.java
public byte[] getData() {
   return ArrayUtils.clone(this.data);
}
 
源代码8 项目: freehealth-connector   文件: Identity.java
public byte[] getData() {
   return ArrayUtils.clone(this.data);
}
 
public EncryptionTokenBuilder.BuildStep withChallenge(byte[] challenge) {
   Validate.isTrue(ArrayUtils.isNotEmpty(challenge));
   this.challenge = ArrayUtils.clone(challenge);
   return this;
}
 
源代码10 项目: freehealth-connector   文件: BeIDInfo.java
public byte[] getPhoto() throws TechnicalConnectorException {
   return ArrayUtils.clone(this.photo);
}
 
源代码11 项目: freehealth-connector   文件: Identity.java
public byte[] getData() {
   return ArrayUtils.clone(this.data);
}
 
源代码12 项目: freehealth-connector   文件: UnsealedData.java
public byte[] getSignature() {
   return ArrayUtils.clone(this.signature);
}
 
源代码13 项目: freehealth-connector   文件: OcspRef.java
public byte[] getEncoded() {
   return ArrayUtils.clone(this.ocspEncoded);
}
 
源代码14 项目: freehealth-connector   文件: Identity.java
public void setPhotoDigest(byte[] photoDigest) {
   this.photoDigest = ArrayUtils.clone(photoDigest);
}
 
源代码15 项目: freehealth-connector   文件: OcspRef.java
public byte[] getEncoded() {
   return ArrayUtils.clone(this.ocspEncoded);
}
 
源代码16 项目: freehealth-connector   文件: ByteArrayDatasource.java
public ByteArrayDatasource(byte[] byteArray, String contentType) {
   this.contentType = DEFAULT_CONTENT_TYPE;
   this.byteArray = ArrayUtils.clone(byteArray);
   this.contentType = contentType;
}
 
源代码17 项目: freehealth-connector   文件: OcspRef.java
public byte[] getEncoded() {
   return ArrayUtils.clone(this.ocspEncoded);
}
 
源代码18 项目: freehealth-connector   文件: Address.java
public void setData(byte[] data) {
   this.data = ArrayUtils.clone(data);
}
 
源代码19 项目: freehealth-connector   文件: ByteArrayDatasource.java
public byte[] getByteArray() {
   return ArrayUtils.clone(this.byteArray);
}
 
源代码20 项目: freehealth-connector   文件: ByteArrayDatasource.java
public ByteArrayDatasource(byte[] byteArray) {
   this.contentType = DEFAULT_CONTENT_TYPE;
   this.byteArray = ArrayUtils.clone(byteArray);
   this.contentType = DEFAULT_CONTENT_TYPE;
}