1 57 58 package com.sun.org.apache.xerces.internal.impl.dv; 59 60 import java.util.ResourceBundle ; 61 import java.util.PropertyResourceBundle ; 62 import java.util.MissingResourceException ; 63 64 74 public class DatatypeException extends Exception { 75 76 protected String key; 78 protected Object [] args; 79 80 87 public DatatypeException(String key, Object [] args) { 88 super(key); 89 this.key = key; 90 this.args = args; 91 } 92 93 98 public String getKey() { 99 return key; 100 } 101 102 107 public Object [] getArgs() { 108 return args; 109 } 110 111 118 public String getMessage() { 119 ResourceBundle resourceBundle = null; 120 resourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"); 121 if (resourceBundle == null) 122 throw new MissingResourceException ("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key); 123 124 String msg = resourceBundle.getString(key); 125 if (msg == null) { 126 msg = resourceBundle.getString("BadMessageKey"); 127 throw new MissingResourceException (msg, "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key); 128 } 129 130 if (args != null) { 131 try { 132 msg = java.text.MessageFormat.format(msg, args); 133 } catch (Exception e) { 134 msg = resourceBundle.getString("FormatFailed"); 135 msg += " " + resourceBundle.getString(key); 136 } 137 } 138 139 return msg; 140 } 141 } 142 | Popular Tags |