當我通過動態加載節點實現rich:tree時,收到ConcurrentNodificationException。Richfaces樹上的ConcurrentModificationException
我正在使用JSF1.2,Tomcat 6.0,RichFaces 3.3.3和Java 6u31。
在JSF頁面我有這樣豐富的樹組件
<rich:tree id="treeAreas" value="#{areaArmazenamento.treeAreas}"
var="node"
adviseNodeOpened="#{storageArea.adviseNodeOpenedTreeAreas}"
adviseNodeSelected="#{storageArea.adviseNodeSelectedTreeAreas}"
ajaxSubmitSelection="true"
componentState="#{storageArea.treeAreasState}"
nodeSelectListener="#{storageArea.selectNodeArea}"
nodeFace="#{node.type}" similarityGroupingId="true"
ondragstart="hideContextMenu();" disableKeyboardNavigation="true"
rightClickSelection="true" toggleOnClick="true" requestDelay="150"
changeExpandListener="#{storageArea.expandNodeListener}">
在Managed Bean的storageArea I'have的代碼加載節點,並在第一時間的方法被稱爲節點的第一級加載,當在節點中點擊此節點的子結構。
加載時第一級驗證用戶的權限,並且此驗證使用存儲樹節點的列表的迭代器,此驗證刪除用戶訪問被拒絕的節點。一些這樣的:
List<AreaArmazenamento> areas = root.getPastas();
synchronized (areas) {
Iterator<AreaArmazenamento> it = areas.iterator();
while(it.hasNext())
{
area = it.next();
boolean havePermission = ControllerPermission.havePermission(null, area, Permissions.VIEW, false);
if(!havePermission)
{
it.remove();
}
}
}
當我點擊任何節點上,我選擇數據庫的子節點,並添加子在選擇的節點,這方面的工作,但有時選擇節點上扔在哈希表中的ConcurrentNodificationException這是TreeDataModule富樹。
這是例外的痕跡:
Caused by: java.util.ConcurrentModificationException
at java.util.Hashtable$Enumerator.next(Hashtable.java:1031)
at org.richfaces.model.TreeDataModel.doWalk(TreeDataModel.java:136)
at org.richfaces.model.TreeDataModel.doWalk(TreeDataModel.java:154)
at org.richfaces.model.TreeDataModel.doWalk(TreeDataModel.java:154)
at org.richfaces.model.TreeDataModel.walk(TreeDataModel.java:178)
at org.richfaces.component.UITree.walk(UITree.java:422)
at org.richfaces.renderkit.TreeRendererBase.writeContent(TreeRendererBase.java:683)
任何關於它可能會導致這個錯誤?爲什麼?