Author: jkuhnert
Date: Mon Mar 13 20:57:40 2006
New Revision: 385735

URL: http://svn.apache.org/viewcvs?rev=385735&view=rev
Log:
fixed double checked locking bug, also enabled checkstyle double checked 
locking checks

Modified:
    
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/components/table/TreeTableValueRenderSource.java
    
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/model/TreeRowObject.java
    jakarta/tapestry/trunk/tapestry-checkstyle.xml

Modified: 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/components/table/TreeTableValueRenderSource.java
URL: 
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/components/table/TreeTableValueRenderSource.java?rev=385735&r1=385734&r2=385735&view=diff
==============================================================================
--- 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/components/table/TreeTableValueRenderSource.java
 (original)
+++ 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/components/table/TreeTableValueRenderSource.java
 Mon Mar 13 20:57:40 2006
@@ -32,17 +32,20 @@
 
     private ComponentTableRendererSource m_objComponentRenderer;
     private ComponentAddress m_objComponentAddress = null;
-
+    
+    /* used to synchronize access */
+    private Object m_sync = new Object();
+    
     public TreeTableValueRenderSource()
     {
         m_objComponentRenderer = null;
     }
-
+    
     public TreeTableValueRenderSource(ComponentAddress objComponentAddress)
     {
         m_objComponentAddress = objComponentAddress;
     }
-
+    
     /**
      * @see 
org.apache.tapestry.contrib.table.model.ITableRendererSource#getRenderer(IRequestCycle,
      *      ITableModelSource, ITableColumn, Object)
@@ -52,19 +55,15 @@
     {
         if (m_objComponentRenderer == null)
         {
-            synchronized(this)
+            synchronized(m_sync)
             {
-                if (m_objComponentRenderer == null)
-                {
-
-                    ComponentAddress objAddress = m_objComponentAddress;
-                    if (m_objComponentAddress == null)
-                        objAddress = new 
ComponentAddress("contrib:TreeTableNodeViewPage", "treeTableNodeViewDelegator");
-                    m_objComponentRenderer = new 
ComponentTableRendererSource(objAddress);
-                }
+                ComponentAddress objAddress = m_objComponentAddress;
+                if (m_objComponentAddress == null)
+                    objAddress = new 
ComponentAddress("contrib:TreeTableNodeViewPage", "treeTableNodeViewDelegator");
+                m_objComponentRenderer = new 
ComponentTableRendererSource(objAddress);
             }
         }
-
+        
         return m_objComponentRenderer.getRenderer(objCycle, objSource, 
objColumn, objRow);
     }
 

Modified: 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/model/TreeRowObject.java
URL: 
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/model/TreeRowObject.java?rev=385735&r1=385734&r2=385735&view=diff
==============================================================================
--- 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/model/TreeRowObject.java
 (original)
+++ 
jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/tree/model/TreeRowObject.java
 Mon Mar 13 20:57:40 2006
@@ -17,60 +17,73 @@
 /**
  * @author ceco
  */
-public class TreeRowObject {
-    public static final int FIRST_ROW          = 1;
-    public static final int MIDDLE_ROW         = 2;
-    public static final int LAST_ROW           = 3;
-    public static final int FIRST_LAST_ROW     = 4;
+public class TreeRowObject
+{
 
-    public static final int EMPTY_CONN_IMG     = 1;
-    public static final int LINE_CONN_IMG      = 2;
+    public static final int FIRST_ROW = 1;
+    public static final int MIDDLE_ROW = 2;
+    public static final int LAST_ROW = 3;
+    public static final int FIRST_LAST_ROW = 4;
+
+    public static final int EMPTY_CONN_IMG = 1;
+    public static final int LINE_CONN_IMG = 2;
 
     private Object m_objTreeNode = null;
-       private Object m_objTreeNodeUID = null;
-       private int m_nTreeRowDepth;
-       private boolean m_bLeaf = false;
-       private int m_nTreeRowPossiotionType = MIDDLE_ROW;
-       private int[] m_nLineConnImages;
-
-       public TreeRowObject(Object objTreeNode, Object objTreeNodeUID, int 
nTreeRowDepth, boolean bLeaf, int nTreeRowPossiotionType, int[] 
nLineConnImages) {
-               super();
-               m_objTreeNode = objTreeNode;
-               m_objTreeNodeUID = objTreeNodeUID;
-               m_nTreeRowDepth = nTreeRowDepth;
-               m_bLeaf = bLeaf;
-               m_nTreeRowPossiotionType = nTreeRowPossiotionType;
-               m_nLineConnImages = nLineConnImages;
-       }
-
-       public Object getTreeNode() {
-               return m_objTreeNode;
-       }
-
-       public Object getTreeNodeUID() {
-               return m_objTreeNodeUID;
-       }
-
-       public int getTreeRowDepth() {
-               return m_nTreeRowDepth;
-       }
-
-       /**
-        * @return Returns the leaf.
-        */
-       public boolean getLeaf() {
-               return m_bLeaf;
-       }
-       /**
-        * @return Returns the treeRowPossiotionType.
-        */
-       public int getTreeRowPossiotionType() {
-               return m_nTreeRowPossiotionType;
-       }
-       /**
-        * @return Returns the lineConnImages.
-        */
-       public int[] getLineConnImages() {
-               return m_nLineConnImages;
-       }
+    private Object m_objTreeNodeUID = null;
+    private int m_nTreeRowDepth;
+    private boolean m_bLeaf = false;
+    private int m_nTreeRowPossiotionType = MIDDLE_ROW;
+    private int[] m_nLineConnImages;
+
+    public TreeRowObject(Object objTreeNode, Object objTreeNodeUID,
+            int nTreeRowDepth, boolean bLeaf, int nTreeRowPossiotionType,
+            int[] nLineConnImages)
+    {
+        super();
+        m_objTreeNode = objTreeNode;
+        m_objTreeNodeUID = objTreeNodeUID;
+        m_nTreeRowDepth = nTreeRowDepth;
+        m_bLeaf = bLeaf;
+        m_nTreeRowPossiotionType = nTreeRowPossiotionType;
+        m_nLineConnImages = nLineConnImages;
+    }
+
+    public Object getTreeNode()
+    {
+        return m_objTreeNode;
+    }
+
+    public Object getTreeNodeUID()
+    {
+        return m_objTreeNodeUID;
+    }
+
+    public int getTreeRowDepth()
+    {
+        return m_nTreeRowDepth;
+    }
+
+    /**
+     * @return Returns the leaf.
+     */
+    public boolean getLeaf()
+    {
+        return m_bLeaf;
+    }
+
+    /**
+     * @return Returns the treeRowPossiotionType.
+     */
+    public int getTreeRowPossiotionType()
+    {
+        return m_nTreeRowPossiotionType;
+    }
+
+    /**
+     * @return Returns the lineConnImages.
+     */
+    public int[] getLineConnImages()
+    {
+        return m_nLineConnImages;
+    }
 }

Modified: jakarta/tapestry/trunk/tapestry-checkstyle.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/tapestry-checkstyle.xml?rev=385735&r1=385734&r2=385735&view=diff
==============================================================================
--- jakarta/tapestry/trunk/tapestry-checkstyle.xml (original)
+++ jakarta/tapestry/trunk/tapestry-checkstyle.xml Mon Mar 13 20:57:40 2006
@@ -43,7 +43,7 @@
         <module name="DefaultComesLast"/>
         <module name="DeclarationOrder"/>
         <module name="DoubleCheckedLocking">
-            <property name="severity" value="info"/>
+            <property name="severity" value="error"/>
         </module>
         <module name="EmptyStatement"/>
         <module name="HiddenField"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to