001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.beans; 018 019/** 020 * Exception thrown when navigation of a valid nested property 021 * path encounters a NullPointerException. 022 * 023 * <p>For example, navigating "spouse.age" could fail because the 024 * spouse property of the target object has a null value. 025 * 026 * @author Rod Johnson 027 * @author Juergen Hoeller 028 */ 029@SuppressWarnings("serial") 030public class NullValueInNestedPathException extends InvalidPropertyException { 031 032 /** 033 * Create a new NullValueInNestedPathException. 034 * @param beanClass the offending bean class 035 * @param propertyName the offending property 036 */ 037 public NullValueInNestedPathException(Class<?> beanClass, String propertyName) { 038 super(beanClass, propertyName, "Value of nested property '" + propertyName + "' is null"); 039 } 040 041 /** 042 * Create a new NullValueInNestedPathException. 043 * @param beanClass the offending bean class 044 * @param propertyName the offending property 045 * @param msg the detail message 046 */ 047 public NullValueInNestedPathException(Class<?> beanClass, String propertyName, String msg) { 048 super(beanClass, propertyName, msg); 049 } 050 051 /** 052 * Create a new NullValueInNestedPathException. 053 * @param beanClass the offending bean class 054 * @param propertyName the offending property 055 * @param msg the detail message 056 * @param cause the root cause 057 * @since 4.3.2 058 */ 059 public NullValueInNestedPathException(Class<?> beanClass, String propertyName, String msg, Throwable cause) { 060 super(beanClass, propertyName, msg, cause); 061 } 062 063}