Coverage Report - org.mule.api.security.CryptoFailureException
 
Classes in this File Line Coverage Branch Coverage Complexity
CryptoFailureException
0%
0/16
0%
0/6
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.api.security;
 8  
 
 9  
 import org.mule.api.EncryptionStrategy;
 10  
 import org.mule.api.MuleException;
 11  
 import org.mule.config.i18n.CoreMessages;
 12  
 import org.mule.config.i18n.Message;
 13  
 
 14  
 /**
 15  
  * <code>CryptoFailureException</code> is a generic exception thrown by an
 16  
  * CryptoStrategy if encryption or decryption fails. The constuctors of this
 17  
  * exception accept a EncryptionStrategy that will be included in the exception
 18  
  * message. Implementors of EncryptionStrategy should provide a toString method
 19  
  * that exposes *only* information that maybe useful for debugging not passwords,
 20  
  * secret keys, etc.
 21  
  */
 22  
 public class CryptoFailureException extends MuleException
 23  
 {
 24  
     /**
 25  
      * Serial version
 26  
      */
 27  
     private static final long serialVersionUID = 1336343718508294379L;
 28  
 
 29  
     private transient EncryptionStrategy encryptionStrategy;
 30  
 
 31  
     public CryptoFailureException(Message message, EncryptionStrategy strategy)
 32  
     {
 33  0
         super(message);
 34  0
         String s = (strategy == null ? "null" : strategy.toString());
 35  0
         addInfo("Encryption", s);
 36  0
         this.encryptionStrategy = strategy;
 37  0
     }
 38  
 
 39  
     public CryptoFailureException(Message message, EncryptionStrategy strategy, Throwable cause)
 40  
     {
 41  0
         super(message, cause);
 42  0
         String s = (strategy == null ? "null" : strategy.toString());
 43  0
         addInfo("Encryption", s);
 44  0
         this.encryptionStrategy = strategy;
 45  0
     }
 46  
 
 47  
     public CryptoFailureException(EncryptionStrategy strategy, Throwable cause)
 48  
     {
 49  0
         super(CoreMessages.cryptoFailure(), cause);
 50  0
         String s = (strategy == null ? "null" : strategy.toString());
 51  0
         addInfo("Encryption", s);
 52  0
         this.encryptionStrategy = strategy;
 53  
 
 54  0
     }
 55  
 
 56  
     public EncryptionStrategy getEncryptionStrategy()
 57  
     {
 58  0
         return encryptionStrategy;
 59  
     }
 60  
 }