tree: "java heap space" Java Error appear in case using dropListener in tree 
component.
---------------------------------------------------------------------------------------

                 Key: RF-3785
                 URL: http://jira.jboss.com/jira/browse/RF-3785
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.2.2
         Environment: IE, FF, Opera, Safari
            Reporter: Mikhail Vitenkov
         Assigned To: Denis Morozov


Step 1. Use dropListener attribute following way:
dropListener="#{treeDndBean.onDrop}" inside rich:tree tag.
Java bean:
 public void onDrop(DropEvent dropEvent) {
        System.out.println("onDrop occured.");
        System.out.println("DragValue: " + dropEvent.getDragValue());
        System.out.println("DropValue: " + dropEvent.getDropValue());

        // resolve drag source attributes
        UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof 
UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
        UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
        TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof 
TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;

        // resolve drag destination attributes
        UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? 
(UITreeNode) dropEvent.getSource() : null;
        UITree destTree = destNode != null ? destNode.getUITree() : 
getTree(dropEvent);
        TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof 
TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;

        FacesContext context = FacesContext.getCurrentInstance();
        
        if (dropNodeKey != null) {
            // add destination node for rerender
            destTree.addRequestKey(dropNodeKey);
            
                Object state = null;
                TreeNode draggedNode = null;
                if (dragNodeKey != null) { // Drag from this or other tree
                    draggedNode = srcTree.getTreeNode(dragNodeKey);
                    
                    TreeNode parentNode = draggedNode.getParent();
                    // 1. remove node from tree
                    state = srcTree.removeNode(dragNodeKey);
                    // 2. add parent for rerender
                    Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
                    srcTree.addRequestKey(rowKey);                  
                } else if (dropEvent.getDragValue() != null) { // Drag from 
some drag source
                    draggedNode = new TreeNodeImpl<String>();
                    draggedNode.setData(dropEvent.getDragValue().toString());
                }
                
                // generate new node id
                Object id = getNewId(destTree.getTreeNode(dropNodeKey));
                destTree.addNode(dropNodeKey, draggedNode, id, state);  
        }
        
        AjaxContext ac = AjaxContext.getCurrentInstance();
        // Add destination tree to reRender
        try {
            ac.addComponentToAjaxRender(destTree);
        } catch (Exception e) {
            System.err.print(e.getMessage());
        }
        
        // Add source tree to reRender
        try {
            ac.addComponentToAjaxRender(srcTree);
        } catch (Exception e) {
            System.err.print(e.getMessage());
        }
        
        System.out.println("+++++");
    }
Step 3. Navigate to the page contained tree rich component with D'n'D API.
Step 4. Several times drag & drop any items from one tree to another.

Actual behavior:

 org.apache.jasper.el.JspELException: /Tree/Tree.jsp(188,4) 
'#{treeDndBean.onDrop}' java.lang.OutOfMemoryError: Java heap space
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
        at 
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.faces.el.EvaluationException: 
org.apache.jasper.el.JspELException: /Tree/Tree.jsp(188,4) 
'#{treeDndBean.onDrop}' java.lang.OutOfMemoryError: Java heap space
        at 
org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor.invoke(MethodBindingMethodExpressionAdaptor.java:56)
        at 
org.richfaces.component.events.TreeEvents.invokeListenerBindings(TreeEvents.java:78)
        at org.richfaces.component.UITree.broadcast(UITree.java:568)
        at org.richfaces.component.UITreeNode.broadcast(UITreeNode.java:140)
        at 
org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1380)
        at org.richfaces.component.UITree.broadcast(UITree.java:550)
        at 
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
        at 
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:292)
        at 
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:249)
        at 
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:462)
        at 
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
        ... 18 more
Caused by: org.apache.jasper.el.JspELException: /Tree/Tree.jsp(188,4) 
'#{treeDndBean.onDrop}' java.lang.OutOfMemoryError: Java heap space
        at 
org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:77)
        at 
org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor.invoke(MethodBindingMethodExpressionAdaptor.java:52)
        ... 31 more
Caused by: java.lang.OutOfMemoryError: Java heap space
Jun 24, 2008 10:50:28 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.OutOfMemoryError: Java heap space

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to