You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2007/09/15 16:29:08 UTC

svn commit: r575921 - /ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs

Author: gbayon
Date: Sat Sep 15 07:29:07 2007
New Revision: 575921

URL: http://svn.apache.org/viewvc?rev=575921&view=rev
Log:
Fix IBATISNET-232 Nested left joins with group by cause NPE when two subsequent levels have null values

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs?rev=575921&r1=575920&r2=575921&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs Sat Sep 15 07:29:07 2007
@@ -109,13 +109,19 @@
                 {
                     // Unique key is already known, so get the existing result object and process additional results.
                     result = buildObjects[uniqueKey];
-                    // process resulMapping attribute which point to a groupBy attribute
-                    for (int index = 0; index < propertyRresultMap.Properties.Count; index++)
+
+                    //In some cases (nested groupings) our object may be null, so there is
+                    //no point in going on
+                    if (result != null)
                     {
-                        ResultProperty resultProperty = propertyRresultMap.Properties[index];
-                        if (resultProperty.PropertyStrategy is PropertStrategy.GroupByStrategy)
+                        // process resulMapping attribute which point to a groupBy attribute
+                        for (int index = 0; index < propertyRresultMap.Properties.Count; index++)
                         {
-                            resultProperty.PropertyStrategy.Set(request, propertyRresultMap, resultProperty, ref result, reader, null);
+                            ResultProperty resultProperty = propertyRresultMap.Properties[index];
+                            if (resultProperty.PropertyStrategy is PropertStrategy.GroupByStrategy)
+                            {
+                                resultProperty.PropertyStrategy.Set(request, propertyRresultMap, resultProperty, ref result, reader, null);
+                            }
                         }
                     }
                     result = SKIP;