Author: mir
Date: Wed Jul  7 14:38:27 2010
New Revision: 961392

URL: http://svn.apache.org/viewvc?rev=961392&view=rev
Log:
CLEREZZA-245: fixed wrong lock

Modified:
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.content/src/main/java/org/apache/clerezza/platform/content/hierarchy/HierarchyService.java

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.content/src/main/java/org/apache/clerezza/platform/content/hierarchy/HierarchyService.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.content/src/main/java/org/apache/clerezza/platform/content/hierarchy/HierarchyService.java?rev=961392&r1=961391&r2=961392&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.content/src/main/java/org/apache/clerezza/platform/content/hierarchy/HierarchyService.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.content/src/main/java/org/apache/clerezza/platform/content/hierarchy/HierarchyService.java
 Wed Jul  7 14:38:27 2010
@@ -181,7 +181,7 @@ public class HierarchyService {
                        addToParent(hierarchyNode, posInParent);
                        addCreationProperties(hierarchyNode);
                } finally {
-                       writeLocke.lock();
+                       writeLocke.unlock();
                }
                return hierarchyNode;
        }
@@ -456,26 +456,25 @@ public class HierarchyService {
        private void addCreationProperties(HierarchyNode node) {
                GraphNode agentNode = getCreator();
                if (!(node.getObjects(FOAF.maker).hasNext() || agentNode == 
null)) {
-      Lock lock = node.writeLock();
-      try {
-        lock.lock();
-        Iterator<Triple> agents = node.getGraph().filter(null, 
PLATFORM.userName,
-            agentNode.getObjects(PLATFORM.userName).next());
-
-        NonLiteral agent = null;
-        if (agents.hasNext()) {
-          agent = (NonLiteral) agents.next().getSubject();
-        } else {
-          agent = (NonLiteral) agentNode.getNode();
-        }
-        node.addProperty(FOAF.maker, agent);
-        node.getGraph().add(new TripleImpl(agent,
-            PLATFORM.userName, agentNode.getObjects(
-            PLATFORM.userName).next()));
-      }
-      finally{
-        lock.unlock();
-      }
+                       Lock lock = node.writeLock();
+                       try {
+                               lock.lock();
+                               Iterator<Triple> agents = 
node.getGraph().filter(null, PLATFORM.userName,
+                                               
agentNode.getObjects(PLATFORM.userName).next());
+
+                               NonLiteral agent = null;
+                               if (agents.hasNext()) {
+                                       agent = (NonLiteral) 
agents.next().getSubject();
+                               } else {
+                                       agent = (NonLiteral) 
agentNode.getNode();
+                               }
+                               node.addProperty(FOAF.maker, agent);
+                               node.getGraph().add(new TripleImpl(agent,
+                                               PLATFORM.userName, 
agentNode.getObjects(
+                                               PLATFORM.userName).next()));
+                       } finally {
+                               lock.unlock();
+                       }
 
                }
                node.addProperty(DCTERMS.created,


Reply via email to