LDAP-300: Fix NPE for DefaultObjectDirectoryMapper in uber jar
This commit is contained in:
@@ -75,8 +75,8 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
private static ConverterManager createDefaultConverterManager() {
|
||||
String springVersion = SpringVersion.getVersion();
|
||||
if(springVersion == null) {
|
||||
LOG.debug("Could not default convertManager, please ensure to explicitly set it");
|
||||
return null;
|
||||
LOG.debug("Could not determine the Spring Version. Guessing > Spring 3.0. If this does not work, please ensure to explicitly set converterManager");
|
||||
return new ConversionServiceConverterManager();
|
||||
} else if(springVersion.compareTo("3.0") > 0) {
|
||||
return new ConversionServiceConverterManager();
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.matchers.JUnitMatchers;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.internal.util.reflection.Whitebox;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.springframework.core.SpringVersion;
|
||||
@@ -44,7 +45,10 @@ public class DefaultObjectDirectoryMapperTest {
|
||||
spy(SpringVersion.class);
|
||||
when(SpringVersion.getVersion()).thenReturn(null);
|
||||
|
||||
new DefaultObjectDirectoryMapper();
|
||||
DefaultObjectDirectoryMapper mapper = new DefaultObjectDirectoryMapper();
|
||||
|
||||
// LDAP-300
|
||||
assertNotNull(Whitebox.getInternalState(mapper,"converterManager"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user