Remove extra dependency on Commons Lang. This dependency is only required by the domain subproject, not the core security project.
This commit is contained in:
@@ -15,9 +15,8 @@
|
||||
|
||||
package org.acegisecurity.acl.basic;
|
||||
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -66,10 +65,10 @@ public class NamedEntityObjectIdentity implements AclObjectIdentity {
|
||||
throws IllegalAccessException, InvocationTargetException {
|
||||
Assert.notNull(object, "object cannot be null");
|
||||
|
||||
this.classname = (object.getClass().getPackage() == null)
|
||||
? ClassUtils.getShortClassName(object.getClass())
|
||||
: (object.getClass().getPackage().getName() + "."
|
||||
+ ClassUtils.getShortClassName(object.getClass()));
|
||||
this.classname = (getPackageName(object.getClass().getName()) == null)
|
||||
? ClassUtils.getShortName(object.getClass())
|
||||
: getPackageName(object.getClass().getName() + "."
|
||||
+ ClassUtils.getShortName(object.getClass()));
|
||||
|
||||
Class clazz = object.getClass();
|
||||
|
||||
@@ -134,6 +133,18 @@ public class NamedEntityObjectIdentity implements AclObjectIdentity {
|
||||
return id;
|
||||
}
|
||||
|
||||
private String getPackageName(String className) {
|
||||
Assert.hasLength(className, "class name must not be empty");
|
||||
|
||||
int lastDotIndex = className.lastIndexOf(".");
|
||||
|
||||
if (lastDotIndex == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return className.substring(0, lastDotIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Important so caching operates properly.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user