Author: markt
Date: Wed Sep 12 17:11:04 2012
New Revision: 1384040
URL: http://svn.apache.org/viewvc?rev=1384040&view=rev
Log:
Findbugs fixes to o.a.catalina
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
tomcat/trunk/res/findbugs/filter-false-positives.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1384040&r1=1384039&r2=1384040&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Sep 12
17:11:04 2012
@@ -2514,7 +2514,7 @@ public class StandardContext extends Con
@Override
- public synchronized void setResources(DirContext resources) {
+ public void setResources(DirContext resources) {
Lock writeLock = resourcesLock.writeLock();
writeLock.lock();
@@ -2546,13 +2546,12 @@ public class StandardContext extends Con
// The proxied resources will be refreshed on start
this.resources = null;
+
+ support.firePropertyChange("resources", oldResources,
+ resources);
} finally {
writeLock.unlock();
}
-
- support.firePropertyChange("resources", oldResources,
- resources);
-
}
@@ -4966,12 +4965,13 @@ public class StandardContext extends Con
.unregisterComponent(resourcesName);
}
}
+ this.resources = null;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardContext.resourcesStop"), t);
ok = false;
- } finally {
this.resources = null;
+ } finally {
writeLock.unlock();
}
Modified:
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1384040&r1=1384039&r2=1384040&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Wed Sep 12 17:11:04 2012
@@ -623,17 +623,12 @@ public abstract class AbstractReplicated
MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if ( entry==null ) {
entry = new MapEntry<>((K) mapmsg.getKey(), (V)
mapmsg.getValue());
- entry.setBackup(false);
- entry.setProxy(true);
- entry.setBackupNodes(mapmsg.getBackupNodes());
- entry.setPrimary(mapmsg.getPrimary());
- innerMap.put(entry.getKey(), entry);
- } else {
- entry.setProxy(true);
- entry.setBackup(false);
- entry.setBackupNodes(mapmsg.getBackupNodes());
- entry.setPrimary(mapmsg.getPrimary());
+ entry = innerMap.putIfAbsent(entry.getKey(), entry);
}
+ entry.setProxy(true);
+ entry.setBackup(false);
+ entry.setBackupNodes(mapmsg.getBackupNodes());
+ entry.setPrimary(mapmsg.getPrimary());
}
if (mapmsg.getMsgType() == MapMessage.MSG_REMOVE) {
@@ -1036,17 +1031,16 @@ public abstract class AbstractReplicated
@Override
public boolean containsValue(Object value) {
- if ( value == null ) {
- return innerMap.containsValue(value);
- } else {
- Iterator<Map.Entry<K,MapEntry<K,V>>> i =
innerMap.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry<K,MapEntry<K,V>> e = i.next();
- MapEntry<K,V> entry = innerMap.get(e.getKey());
- if (entry!=null && entry.isActive() &&
value.equals(entry.getValue())) return true;
- }//while
- return false;
- }//end if
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ Iterator<Map.Entry<K,MapEntry<K,V>>> i =
innerMap.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry<K,MapEntry<K,V>> e = i.next();
+ MapEntry<K,V> entry = innerMap.get(e.getKey());
+ if (entry!=null && entry.isActive() &&
value.equals(entry.getValue())) return true;
+ }
+ return false;
}
@Override
Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1384040&r1=1384039&r2=1384040&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Wed Sep 12 17:11:04
2012
@@ -52,9 +52,9 @@
<Bug code="IS"/>
</Match>
<Match>
- <Class name="org.apache.catalina.authenticator.DigestAuthenticator"/>
- <Field name="cnonces"/>
- <Bug code="IS"/>
+ <!-- Method is synchronized therefore not an issue -->
+ <Class
name="org.apache.catalina.authenticator.DigestAuthenticator$NonceInfo"/>
+ <Bug code="VO"/>
</Match>
<Match>
<Class name="org.apache.catalina.connector.CoyoteReader"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]