taylor 2004/05/14 19:01:00
Modified: components/registry/src/java/org/apache/jetspeed/om/servlet/impl
SecurityRoleImpl.java
components/registry/src/java/org/apache/jetspeed/om/impl
SecurityRoleRefImpl.java
Log:
patch from Ate Douma
temp fix for OJB handling nulls in maps
PR:
Obtained from:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.3 +17 -3
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleImpl.java
Index: SecurityRoleImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/SecurityRoleImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SecurityRoleImpl.java 10 May 2004 17:42:37 -0000 1.2
+++ SecurityRoleImpl.java 15 May 2004 02:01:00 -0000 1.3
@@ -83,7 +83,14 @@
*/
public boolean equals(Object obj) {
if ( obj != null && obj instanceof SecurityRoleImpl ) {
- return getRoleName().equals(((SecurityRoleImpl)obj).getRoleName());
+ //TODO: Because of a bug in OJB 1.0.rc4 fields seems not have been set
+ // before this object is put into a HashMap.
+ // Therefore, for the time being, check against null values is
+ // required.
+ // Once 1.0rc5 or higher can be used the following line should be
+ // used again.
+ //return getRoleName().equals(((SecurityRoleImpl)obj).getRoleName());
+ return getRoleName() != null &&
getRoleName().equals(((SecurityRoleImpl)obj).getRoleName());
}
return false;
}
@@ -92,6 +99,13 @@
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
- return getRoleName().hashCode();
+ //TODO: Because of a bug in OJB 1.0.rc4 fields seems not have been set
+ // before this object is put into a HashMap.
+ // Therefore, for the time being, check against null values is
+ // required.
+ // Once 1.0rc5 or higher can be used the following line should be
+ // used again.
+ //return getRoleName().hashCode();
+ return getRoleName() != null ? getRoleName().hashCode() : 0;
}
}
1.3 +9 -2
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/SecurityRoleRefImpl.java
Index: SecurityRoleRefImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/SecurityRoleRefImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SecurityRoleRefImpl.java 8 Mar 2004 00:48:51 -0000 1.2
+++ SecurityRoleRefImpl.java 15 May 2004 02:01:00 -0000 1.3
@@ -90,7 +90,14 @@
if (obj != null && obj instanceof SecurityRoleRef)
{
SecurityRoleRef aRef = (SecurityRoleRef) obj;
- return this.getRoleName().equals(aRef.getRoleName());
+ //TODO: Because of a bug in OJB 1.0.rc4 fields seems not have been set
+ // before this object is put into a HashMap.
+ // Therefore, for the time being, check against null values is
+ // required.
+ // Once 1.0rc5 or higher can be used the following line should be
+ // used again.
+ //return this.getRoleName().equals(aRef.getRoleName());
+ return getRoleName() != null &&
getRoleName().equals(aRef.getRoleName());
}
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]