Now uses Java5 constructor only if at least JDK15 (LDAP-196).
This commit is contained in:
@@ -28,6 +28,7 @@ import javax.naming.spi.DirObjectFactory;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
@@ -153,8 +154,17 @@ public class DefaultDirObjectFactory implements DirObjectFactory {
|
||||
nameString = pathString;
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new IllegalArgumentException("Supplied name starts with protocol prefix indicating a referral,"
|
||||
+ " but is not possible to parse to an URI", e);
|
||||
if (JdkVersion.isAtLeastJava15()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Supplied name starts with protocol prefix indicating a referral,"
|
||||
+ " but is not possible to parse to an URI",
|
||||
e);
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Supplied name starts with protocol prefix indicating a referral,"
|
||||
+ " but is not possible to parse to an URI: " +
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Resulting name after removal of referral information: '" + nameString + "'");
|
||||
|
||||
Reference in New Issue
Block a user