You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/10/02 00:40:20 UTC
svn commit: r700962 -
/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java
Author: ate
Date: Wed Oct 1 15:40:19 2008
New Revision: 700962
URL: http://svn.apache.org/viewvc?rev=700962&view=rev
Log:
Need to validate ourselved at runtime that a provided className actually does implement JetspeedPrincipal, generics won't help here as those checks are compile time only (in this case).
Thanks again to Jeroen van Maanen to point this out.
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java?rev=700962&r1=700961&r2=700962&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/JetspeedPrincipalTypeImpl.java Wed Oct 1 15:40:19 2008
@@ -29,10 +29,15 @@
private Class<JetspeedPrincipal> principalClass;
private SecurityAttributeTypes attributeTypes;
+ @SuppressWarnings("unchecked")
public JetspeedPrincipalTypeImpl(String name, String className, SecurityAttributeTypes attributeTypes) throws ClassNotFoundException
{
this.name = name;
this.principalClass = (Class<JetspeedPrincipal>)Class.forName(className);
+ if (!JetspeedPrincipal.class.isAssignableFrom(principalClass))
+ {
+ throw new ClassCastException("Not a subclass of JetspeedPrincipal: "+principalClass);
+ }
this.attributeTypes = attributeTypes;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org