Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How can I debug IllegalStateException?

    I am using SmartGWT 3.0p, on IntelliJ.

    I pre-built a bunch of static methods that generate ListGrids, forms, etc. that we need to re-use in multiple places. When I call these methods second time, from another page, I get IllegalStateException - ... after the component has been created. My first suspicion was ID of the widgets but I am passing in unique IDs with every call so I ruled that out. The components in question cannot have been created at the time of the call because no draw() methods are being invoked, components are simply being added as members to the main page Layout. But of course they are being created by something.

    When I started commenting out pieces, exceptions just keepspopping up further and further - with other methods and properties settings that are not allowed after component is created.

    I am looking for some tips on how I can debug this, somehow the components are created but I can't seem to pin-point by what. Thanks for any help or suggestions.

    Here are code snippets how the static methods are called:
    Code:
    //code from tools class - SkuAndDeposit
    public static ListGrid buildSourceGrid(final String pageId, final String entityLabel, final DataSource dataSource,
                                               final String[] fieldNames, final ArrayList<String[]> detailViewerFields) {
     //create ListGrid object and return it
     //final is used for variables that are called from inner classes such as event handlers
    }
    Call:
    Code:
    //code from the Page class
    editorValuesManager = new ValuesManager();
    editorValuesManager.setID("some_random_2323423423423");
    ListGrid productsListGrid = SkuAndDeposit.buildSourceGrid(pageId, "Product", productAuthDefDataSource, listGridFields, previewPanelFields);
    DynamicForm frm = new DynamicForm();
    frm.setValuesManager(editorValuesManager);
    frm.addChild(productsListGrid);
    The result:
    Caused by: java.lang.IllegalStateException: Cannot change configuration property 'valuesManager' to [ValuesManager ID:some_random_2323423423423] after the component has been created.
    at com.smartgwt.client.widgets.BaseWidget.error(BaseWidget.java:596)
    at com.smartgwt.client.widgets.BaseWidget.error(BaseWidget.java:584)
    at com.smartgwt.client.widgets.BaseWidget.setAttribute(BaseWidget.java:810)
    at com.smartgwt.client.widgets.form.DynamicForm.setValuesManager(DynamicForm.java:2917)
    at com.paceap.pc2.client.pages.support.DepositPage.buildEditorPanel(DepositPage.java:131)
    .....

    #2
    With the code you're showing, ID collision is pretty much the only explanation, so look harder at whether the IDs are really unique.

    Comment


      #3
      As always, you guys are right. It took me several hours to trace it and only 1 min to find it. The problem was in the fact that my method that assembles all elements was being called twice.

      Thanks!

      Comment

      Working...
      X