From 532e5b2ace4b1378722ac1e33736549e87a8c6d1 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 29 Sep 2011 18:45:31 +0200 Subject: [PATCH] DATACMNS-81 - Fixed potential NullPointerException. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ConcurrentHashMap does not allow null values to be set so we now store Void.class as custom null-value instead and default this value back to null in predictBeanType(…). --- .../RepositoryInterfaceAwareBeanPostProcessor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java index 5cdc46d15..c77c193ae 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ class RepositoryInterfaceAwareBeanPostProcessor extends InstantiationAwareBeanPo resolvedBeanClass = getClassForPropertyValue(value); cache.put(beanName, resolvedBeanClass); - return resolvedBeanClass; + return resolvedBeanClass == Void.class ? null : resolvedBeanClass; } /** @@ -99,13 +99,13 @@ class RepositoryInterfaceAwareBeanPostProcessor extends InstantiationAwareBeanPo } else if (value instanceof Class) { return (Class) value; } else { - return null; + return Void.class; } try { return ClassUtils.resolveClassName(className, RepositoryInterfaceAwareBeanPostProcessor.class.getClassLoader()); } catch (IllegalArgumentException ex) { - return null; + return Void.class; } } }