Salut Etienne,

I suppose that your posting is related to the JIRA issue 6974 (https://www.canoo.com/jira/browse/UBA-6974) that you have created right after sending your posting to the developer list. From the trace that you have attached to the JIRA issue I can see that the second to last round-trip contains the following requests:
1. ULCListSelectionModel.stateUpdate(null)
2. ULCComboBoxModelAdapter.stateUpdate(11)
3. ULCTableColumnModel.stateUpdate(1504, 1506, 1505, 1507, 1508)
4. ULCComboBox.actionPerformed()

The error happens because of UBA-910 (https://www.canoo.com/jira/browse/UBA-910): the state update of the combo box may trigger an action event before the state update of the table column has been executed. Therefore the table column model gets in an inconsistent state. This finally results in an error when ULC tries to fetch the renderer components from the inconsistent table column model in the last round-trip.

This issue has been fixed for ULC 6.1. For ULC 6.0.4 you can try the patch at the end of my mail.
[ Show ยป <https://www.canoo.com/jira/browse/UBA-6974> ]
Daniel Grob <https://www.canoo.com/jira/secure/ViewProfile.jspa?name=daniel> [08/Aug/06 02:40 PM] The reason for the error is that the combo box wrongly triggers an event during state update, i.e. the event is handled by the application before all client-side state is synchronized to the server-side. Actually there is stateUpdate for the table column model after the combo box's action event. Therefore the table column model gets in an inconsistent state. This finally results in an error when ULC tries to fetch the renderer components from the inconsisten table column model in the next server rount trip.


Griessli Dany

import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBorderLayoutPane;
import com.ulcjava.base.application.ULCComboBox;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCLabel;
import com.ulcjava.base.application.ULCTextField;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.event.UlcEvent;
import com.ulcjava.base.development.DevelopmentRunner;
import com.ulcjava.base.shared.IUlcEventConstants;
import com.ulcjava.base.shared.internal.Anything;
import com.ulcjava.base.shared.internal.ThrowableUtilities;

public class PR910 extends AbstractApplication {
   public void start() {
       // replace ULCPatchedComboBox with ULCComboBox to see error!

       ULCLabel descriptionLabel = new ULCLabel(
               "<html><ol>"
                       + "<li>Enter text into text field</li>"
                       + "<li>Select another item in combo box</li>"
+ "<li>Look at console output: in the action listener the text field is still empty</li>"
                       + "</ol></html>");
       final ULCTextField textField = new ULCTextField();
       final ULCComboBox comboBox = new ULCPatchedComboBox(new String[] {
               "one", "two", "three" });
       comboBox.addActionListener(new IActionListener() {
           public void actionPerformed(ActionEvent event) {
               Object selectedItem = comboBox.getSelectedItem();
               System.out.println("selectedItem = " + selectedItem);
               String text = textField.getText();
               System.out.println("text = " + text);
           }
       });

       ULCFrame frame = new ULCFrame("PR910");
       frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.getContentPane().add(descriptionLabel, ULCBorderLayoutPane.NORTH);
       frame.getContentPane().add(textField, ULCBorderLayoutPane.CENTER);
       frame.getContentPane().add(comboBox, ULCBorderLayoutPane.SOUTH);
       frame.setVisible(true);
   }

   public static void main(String[] args) {
       DevelopmentRunner.setApplicationClass(PR910.class);
       DevelopmentRunner.main(args);
   }

   private static class ULCPatchedComboBox extends ULCComboBox {
       public ULCPatchedComboBox(Object[] items) {
           super(items);
       }

       protected void distributeToListeners(UlcEvent event) {
           // we ignore events that are triggered by state updates in
           // ULCComboBoxModelAdapter
String stackTrace = ThrowableUtilities.toString(new Throwable()); if (stackTrace.indexOf("ULCComboBoxModelAdapter.handleRequest") >= 0) {
               return;
           }

           super.distributeToListeners(event);
       }

protected void handleEvent(int listenerType, int eventId, Anything args) {
           // To prevent double events the original ULCComboBox filters
           // events triggered by the combo box if a previous state update
           // in the model adapter has already trigger that event...
           if (listenerType == IUlcEventConstants.ACTION_EVENT) {
               int modifiers = args.asInt(0);
distributeToListeners(new ActionEvent(this, getActionCommand(),
                       modifiers));
           } else {
               super.handleEvent(listenerType, eventId, args);
           }
       }
   }
}


Etienne Studer wrote:

Hi

Could you please decipher the stacktrace below, especially the frames in the ULCTable. Thanks!

Regards, Etienne

3 03.08.2006 11:50:14.916 1,000 SEVERE Thread[ULC Communication Controller Thread,6,main] com.ulcjava.base.server.ULCSession processRequests got exception while processing [java.lang.ArrayIndexOutOfBoundsException: -1

            at java.util.ArrayList.get(ArrayList.java:326)

at com.ulcjava.base.application.AbstractColumnModel.getAbstractColumn(AbstractColumnModel.java:38)

at com.ulcjava.base.application.table.ULCTableColumnModel.getColumn(ULCTableColumnModel.java:3)

            at com.ulcjava.base.application.ULCTable.d(ULCTable.java:190)

            at com.ulcjava.base.application.ULCTable.a(ULCTable.java:69)

            at com.ulcjava.base.application.ULCTable.a(ULCTable.java:354)

at com.ulcjava.base.application.ULCTable.handleRequest(ULCTable.java:156)

at com.navis.framework.ulc.server.application.view.table.ULCMetafieldTable.handleRequest(ULCMetafieldTable.java:103)

            at com.ulcjava.base.server.ULCSession.a(ULCSession.java:11)

at com.ulcjava.base.server.ULCSession.processRequests(ULCSession.java:134)

at com.ulcjava.base.development.DevelopmentContainerAdapter.processRequests(DevelopmentContainerAdapter.java:2)

at com.ulcjava.base.development.DevelopmentConnector.sendRequests(DevelopmentConnector.java:0)

at com.ulcjava.base.client.UISession$k_.run(UISession$k_.java:28)

            at java.lang.Thread.run(Thread.java:534)


_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to