I wish I'd thought of this last night, but the try/catch also absorbs errors in getters, so these changes could break folks who've been relying on that fact.
Lots of folks have getters that don't have null checks and other stuff like that, although it may be that an exception will get thrown earlier since folks usually complain on the forums about that. -Alex On 1/2/14 11:32 PM, "jmcl...@apache.org" <jmcl...@apache.org> wrote: >Updated Branches: > refs/heads/develop 7e101d8de -> 9f8aab867 > > >remove try and catch to improve performance > > >Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo >Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/9f8aab86 >Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/9f8aab86 >Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/9f8aab86 > >Branch: refs/heads/develop >Commit: 9f8aab8675dc3288be9b1b906da64b5c91728d70 >Parents: 7e101d8 >Author: Justin Mclean <jmcl...@apache.org> >Authored: Fri Jan 3 18:31:44 2014 +1100 >Committer: Justin Mclean <jmcl...@apache.org> >Committed: Fri Jan 3 18:31:44 2014 +1100 > >---------------------------------------------------------------------- > .../controls/dataGridClasses/DataGridColumn.as | 50 ++++++++++---------- > 1 file changed, 24 insertions(+), 26 deletions(-) >---------------------------------------------------------------------- > > >http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/9f8aab86/frameworks/p >rojects/mx/src/mx/controls/dataGridClasses/DataGridColumn.as >---------------------------------------------------------------------- >diff --git >a/frameworks/projects/mx/src/mx/controls/dataGridClasses/DataGridColumn.as > >b/frameworks/projects/mx/src/mx/controls/dataGridClasses/DataGridColumn.as >index a053c04..8a4a209 100644 >--- >a/frameworks/projects/mx/src/mx/controls/dataGridClasses/DataGridColumn.as >+++ >b/frameworks/projects/mx/src/mx/controls/dataGridClasses/DataGridColumn.as >@@ -1739,17 +1739,17 @@ public class DataGridColumn extends >CSSStyleDeclaration implements IIMESupport > > if (typeof(data) == "object" || typeof(data) == "xml") > { >- try >- { >- if (!hasComplexFieldName) >- data = data[dataField]; >- else >- data = deriveComplexColumnData(data); >- } >- catch(e:Error) >- { >- data = null; >- } >+ if (hasComplexFieldName) >+ { >+ data = deriveComplexColumnData(data); >+ } >+ else if (dataField != null) >+ { >+ if (dataField in data) >+ data = data[dataField]; >+ else >+ data = null; >+ } > } > > if (data is String) >@@ -1798,17 +1798,13 @@ public class DataGridColumn extends >CSSStyleDeclaration implements IIMESupport > var field:String = dataTipField; > if (!field) > field = owner.dataTipField; >- try >- { >- if (data[field] != null) >- data = data[field]; >- else if (data[dataField] != null) >- data = data[dataField]; >- } >- catch(e:Error) >- { >- data = null; >- } >+ >+ if (field in data && data[field] != null) >+ data = data[field]; >+ else if (dataField in data && data[dataField] != null) >+ data = data[dataField]; >+ else >+ data = null; > } > > if (data is String) >@@ -1828,13 +1824,15 @@ public class DataGridColumn extends >CSSStyleDeclaration implements IIMESupport > /** > * @private > */ >- protected function deriveComplexColumnData( data:Object ):Object >+ protected function deriveComplexColumnData(data:Object):Object > { > var currentRef:Object = data; >- if ( complexFieldNameComponents ) >+ var length:int = complexFieldNameComponents.length >+ >+ if (complexFieldNameComponents) > { >- for ( var i:int=0; currentRef && i < >complexFieldNameComponents.length; i++ ) >- currentRef = currentRef[ complexFieldNameComponents[ i ] >]; >+ for (var i:int=0; currentRef && i < length; i++) >+ currentRef = currentRef[complexFieldNameComponents[i]]; > } > > return currentRef?currentRef:""; >