1 16 17 package de.schlichtherle.key.passwd.swing; 18 19 import java.security.GeneralSecurityException ; 20 import java.text.MessageFormat ; 21 import java.util.ResourceBundle ; 22 23 30 public class WeakKeyException extends GeneralSecurityException { 31 32 private final ResourceBundle resources; 33 private final Object param; 34 35 40 public WeakKeyException(ResourceBundle resources, String key) { 41 super(key); 42 43 this.resources = resources; 44 this.param = null; 45 } 46 47 52 public WeakKeyException(ResourceBundle resources, String key, Object param) { 53 super(key); 54 55 this.resources = resources; 56 this.param = param; 57 } 58 59 62 public String getLocalizedMessage() { 63 if (param != null) { 64 return MessageFormat.format( 65 resources.getString(getMessage()), 66 new Object [] { param }); 67 } else { 68 return resources.getString(getMessage()); 69 } 70 } 71 } 72 | Popular Tags |