KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > security > CryptoFailureException


1 /*
2  * $Id: CryptoFailureException.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.umo.security;
12
13 import org.mule.MuleException;
14 import org.mule.config.i18n.Message;
15 import org.mule.config.i18n.Messages;
16 import org.mule.umo.UMOEncryptionStrategy;
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 UMOEncryptionStrategy that will be included in the exception
22  * message. Implementors of UMOEncryptionStrategy should provide a toString method
23  * that exposes *only* information that maybe useful for debugging not passwords,
24  * secret keys, etc.
25  *
26  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
27  * @version $Revision: 3798 $
28  */

29 public class CryptoFailureException extends MuleException
30 {
31     /**
32      * Serial version
33      */

34     private static final long serialVersionUID = 1336343718508294379L;
35
36     private transient UMOEncryptionStrategy encryptionStrategy;
37
38     public CryptoFailureException(Message message, UMOEncryptionStrategy strategy)
39     {
40         super(message);
41         String JavaDoc s = (strategy == null ? "null" : strategy.toString());
42         addInfo("Encryption", s);
43         this.encryptionStrategy = strategy;
44     }
45
46     public CryptoFailureException(Message message, UMOEncryptionStrategy strategy, Throwable JavaDoc cause)
47     {
48         super(message, cause);
49         String JavaDoc s = (strategy == null ? "null" : strategy.toString());
50         addInfo("Encryption", s);
51         this.encryptionStrategy = strategy;
52     }
53
54     public CryptoFailureException(UMOEncryptionStrategy strategy, Throwable JavaDoc cause)
55     {
56         super(new Message(Messages.CRYPTO_FAILURE), cause);
57         String JavaDoc s = (strategy == null ? "null" : strategy.toString());
58         addInfo("Encryption", s);
59         this.encryptionStrategy = strategy;
60
61     }
62
63     public UMOEncryptionStrategy getEncryptionStrategy()
64     {
65         return encryptionStrategy;
66     }
67 }
68
Popular Tags