Java EhCache SearchableAttribute空值抛出NPE

Java EhCache SearchableAttribute空值抛出NPE,java,ehcache,Java,Ehcache,我有以下日期类型的searchableAttribute的映射 <searchAttribute name="shipDate" type="java.util.Date" expression="value.getShipDate()"/> 上面的代码在以下内部类中抛出NPE: /** * Get the appropriate @{link {@link AttributeType} enum for the given object value. * * @par

我有以下日期类型的searchableAttribute的映射

<searchAttribute name="shipDate" type="java.util.Date" expression="value.getShipDate()"/>
上面的代码在以下内部类中抛出NPE:

   /**
 * Get the appropriate @{link {@link AttributeType} enum for the given object value.
 *
 * @param name  the attribute name (only meaningful to message if exception thrown)
 * @param value the value to lookup the type for
 * @return the attribute type for this value
 * @throws SearchException if the given value is not valid for a search attribute
 */
public static AttributeType typeFor(String name, Object value) throws SearchException {
    if (name == null) {
        throw new NullPointerException("null name");
    }
    if (value == null) {
        throw new NullPointerException("null value");
    }

    AttributeType type = typeForOrNull(value);
    if (type != null) {
        return type;
    }

    throw new SearchException("Unsupported type for search attribute [" + name + "]: " + value.getClass().getName());
}
如何添加可为空的搜索属性

   /**
 * Get the appropriate @{link {@link AttributeType} enum for the given object value.
 *
 * @param name  the attribute name (only meaningful to message if exception thrown)
 * @param value the value to lookup the type for
 * @return the attribute type for this value
 * @throws SearchException if the given value is not valid for a search attribute
 */
public static AttributeType typeFor(String name, Object value) throws SearchException {
    if (name == null) {
        throw new NullPointerException("null name");
    }
    if (value == null) {
        throw new NullPointerException("null value");
    }

    AttributeType type = typeForOrNull(value);
    if (type != null) {
        return type;
    }

    throw new SearchException("Unsupported type for search attribute [" + name + "]: " + value.getClass().getName());
}