1 /* 2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.xml.bind; 27 28 29 30 /** 31 * This exception indicates that an error was encountered while getting or 32 * setting a property. 33 * 34 * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Joe Fialli, Sun Microsystems, Inc.</li></ul> 35 * @see JAXBContext 36 * @see Validator 37 * @see Unmarshaller 38 * @since JAXB1.0 39 */ 40 public class PropertyException extends JAXBException { 41 42 /** 43 * Construct a PropertyException with the specified detail message. The 44 * errorCode and linkedException will default to null. 45 * 46 * @param message a description of the exception 47 */ 48 public PropertyException(String message) { 49 super(message); 50 } 51 52 /** 53 * Construct a PropertyException with the specified detail message and 54 * vendor specific errorCode. The linkedException will default to null. 55 * 56 * @param message a description of the exception 57 * @param errorCode a string specifying the vendor specific error code 58 */ 59 public PropertyException(String message, String errorCode) { 60 super(message, errorCode); 61 } 62 63 /** 64 * Construct a PropertyException with a linkedException. The detail 65 * message and vendor specific errorCode will default to null. 66 * 67 * @param exception the linked exception 68 */ 69 public PropertyException(Throwable exception) { 70 super(exception); 71 } 72 73 /** 74 * Construct a PropertyException with the specified detail message and 75 * linkedException. The errorCode will default to null. 76 * 77 * @param message a description of the exception 78 * @param exception the linked exception 79 */ 80 public PropertyException(String message, Throwable exception) { 81 super(message, exception); 82 } 83 84 /** 85 * Construct a PropertyException with the specified detail message, vendor 86 * specific errorCode, and linkedException. 87 * 88 * @param message a description of the exception 89 * @param errorCode a string specifying the vendor specific error code 90 * @param exception the linked exception 91 */ 92 public PropertyException( 93 String message, 94 String errorCode, 95 Throwable exception) { 96 super(message, errorCode, exception); 97 } 98 99 /** 100 * Construct a PropertyException whose message field is set based on the 101 * name of the property and value.toString(). 102 * 103 * @param name the name of the property related to this exception 104 * @param value the value of the property related to this exception 105 */ 106 public PropertyException(String name, Object value) { 107 super( Messages.format( Messages.NAME_VALUE, 108 name, 109 value.toString() ) ); 110 } 111 112 113 }