Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-1319

[PATCH] Class cast exception in TableViewRowProxy.java in fireEvent

    Details

      Description

      {html}<div><p>TableViewRowProxy.fireEvent assumes that its parent is a
      TableViewProxy, when it can also be a TableViewSectionProxy object.
      If you fire an event from a row contained in a TableViewSection, it
      will cause a ClassCastException to be raised and the app will die.
      The following changes in my local repo fixed the problem:</p>
      <p>diff --git
      a/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
      b/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java<br>
      index a415c32..f1842db 100644<br>

      a/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
      +++
      b/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
      @@ -87,8 +87,14 @@ public class TableViewRowProxy extends
      TiViewProxy</p>
      <pre>
      <code>@Override
      public boolean fireEvent(String eventName, TiDict data) {
      if (eventName.equals("click")) {</code>
      </pre>
      <ul>
      <li>
      <pre>
      <code> TableViewProxy table = null;
      // inject row click data for events coming from row children</code>
      </pre></li>
      <li>
      <pre>
      <code> TableViewProxy table = (TableViewProxy)getParent();</code>
      </pre></li>
      <li>
      <pre>
      <code> if(getParent() instanceof TableViewProxy) {</code> </pre></li> <li> <pre> <code> table = (TableViewProxy)getParent();</code> </pre></li> <li> <pre> <code> }</code>
      </pre></li>
      <li>
      <pre>
      <code> if(getParent() instanceof TableViewSectionProxy) {</code> </pre></li> <li> <pre> <code> table = (TableViewProxy)getParent().getParent();</code> </pre></li> <li> <pre> <code> }
      Item item = tableViewItem.getRowData();
      if (table != null && item != null) {
      TableViewModel model = table.getTableView().getModel();</code>
      </pre></li>
      </ul></div>{html}

        Attachments

          Activity

            People

            • Assignee:
              dthorp Don Thorp
              Reporter:
              joelboehland Joel Boehland
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-1229
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code