Author: fhanik
Date: Mon Aug 13 10:23:04 2007
New Revision: 565433
URL: http://svn.apache.org/viewvc?view=rev&rev=565433
Log:
protect against a NPE when a member disappears
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?view=diff&rev=565433&r1=565432&r2=565433
==============================================================================
---
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
(original)
+++
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Mon Aug 13 10:23:04 2007
@@ -511,7 +511,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
- if ( entry.isSerializable() ) {
+ if ( entry != null && entry.isSerializable() ) {
boolean copy = (mapmsg.getMsgType() ==
mapmsg.MSG_STATE_COPY);
MapMessage me = new MapMessage(mapContextName,
copy?MapMessage.MSG_COPY:MapMessage.MSG_PROXY,
@@ -719,6 +719,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
+ if (entry==null) continue;
if (entry.isPrimary() && inSet(member,entry.getBackupNodes())) {
if (log.isDebugEnabled()) log.debug("[1] Primary choosing a
new backup");
try {
@@ -977,7 +978,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
- if (entry.isPrimary() && value.equals(entry.getValue()))
return true;
+ if (entry!=null && entry.isPrimary() &&
value.equals(entry.getValue())) return true;
}//while
return false;
}//end if
@@ -1062,7 +1063,7 @@
while ( i.hasNext() ) {
Map.Entry e = (Map.Entry)i.next();
MapEntry entry = (MapEntry)super.get(e.getKey());
- if ( entry.isPrimary() && entry.getValue()!=null)
values.add(entry.getValue());
+ if (entry!=null && entry.isPrimary() &&
entry.getValue()!=null) values.add(entry.getValue());
}
return Collections.unmodifiableCollection(values);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]