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