Apply another fix for HARMONY-6661: Synchonrize on mutable field in Permissions.java readObject() is only reachable by one thread, so remove unnecessary synchronized block
git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/java/trunk@1043349 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java b/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
index b5a33a3..4d25c07 100644
--- a/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
@@ -1070,9 +1070,7 @@
ois.defaultReadObject();
- synchronized (bcsListeners) {
- deserialize(ois, bcsListeners);
- }
+ deserialize(ois, bcsListeners);
}
}
diff --git a/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java b/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
index 52d56b9..48f5f85 100644
--- a/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
+++ b/classlib/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
@@ -1295,9 +1295,7 @@
readChildren(ois);
}
- synchronized (bcmListeners) {
- deserialize(ois, bcmListeners);
- }
+ deserialize(ois, bcmListeners);
}
/*
diff --git a/classlib/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java b/classlib/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
index 820ae7f..ae4beba 100644
--- a/classlib/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
+++ b/classlib/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
@@ -184,19 +184,19 @@
ObjectInputStream.GetField fields = in.readFields();
items = new HashMap<String, Permission>();
- synchronized (this) {
- permClass = (Class<? extends Permission>)fields.get("permClass", null); //$NON-NLS-1$
- items.putAll((Hashtable<String, Permission>) fields.get(
- "permissions", new Hashtable<String, Permission>())); //$NON-NLS-1$
- for (Iterator<Permission> iter = items.values().iterator(); iter.hasNext();) {
- if (iter.next().getClass() != permClass) {
- throw new InvalidObjectException(Messages.getString("security.24")); //$NON-NLS-1$
- }
+ permClass = (Class<? extends Permission>) fields.get("permClass", null); //$NON-NLS-1$
+ items.putAll((Hashtable<String, Permission>) fields.get(
+ "permissions", new Hashtable<String, Permission>())); //$NON-NLS-1$
+ for (Iterator<Permission> iter = items.values().iterator(); iter
+ .hasNext();) {
+ if (iter.next().getClass() != permClass) {
+ throw new InvalidObjectException(
+ Messages.getString("security.24")); //$NON-NLS-1$
}
- allEnabled = fields.get("all_allowed", false); //$NON-NLS-1$
- if (allEnabled && !items.containsKey("*")) { //$NON-NLS-1$
- throw new InvalidObjectException(Messages.getString("security.25")); //$NON-NLS-1$
- }
+ }
+ allEnabled = fields.get("all_allowed", false); //$NON-NLS-1$
+ if (allEnabled && !items.containsKey("*")) { //$NON-NLS-1$
+ throw new InvalidObjectException(Messages.getString("security.25")); //$NON-NLS-1$
}
}
}
diff --git a/classlib/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java b/classlib/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java
index 3a6ba92..b2eed4a 100644
--- a/classlib/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java
+++ b/classlib/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java
@@ -174,24 +174,20 @@
ObjectInputStream.GetField fields = in.readFields();
Map permissions = (Map)fields.get("permissions", null); //$NON-NLS-1$
klasses = new HashMap();
- synchronized (klasses) {
- for (Iterator iter = permissions.entrySet().iterator(); iter
- .hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = (String) entry.getKey();
- Collection values = (Collection) entry.getValue();
+ for (Iterator iter = permissions.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String key = (String) entry.getKey();
+ Collection values = (Collection) entry.getValue();
- for (Iterator iterator = values.iterator(); iterator.hasNext();) {
- UnresolvedPermission element =
- (UnresolvedPermission) iterator.next();
+ for (Iterator iterator = values.iterator(); iterator.hasNext();) {
+ UnresolvedPermission element = (UnresolvedPermission) iterator.next();
- if (!element.getName().equals(key)) {
- throw new InvalidObjectException(
- Messages.getString("security.22")); //$NON-NLS-1$
- }
- }
- klasses.put(key, new HashSet(values));
- }
+ if (!element.getName().equals(key)) {
+ throw new InvalidObjectException(
+ Messages.getString("security.22")); //$NON-NLS-1$
+ }
+ }
+ klasses.put(key, new HashSet(values));
}
}
}
\ No newline at end of file