Scarab commit: svn commit: r10708 - trunk/src/java/org/tigris/scarab/om/AttributeGroup.java

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-03-28 10:12:48-0700
New Revision: 10708

Modified:
   trunk/src/java/org/tigris/scarab/om/AttributeGroup.java

Log:
take care of a potential NPE when no attribute group can be found. Implications are not clear. When do we get a null pointer ? Is that possible at all ?

Modified: trunk/src/java/org/tigris/scarab/om/AttributeGroup.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/AttributeGroup.java?view=diff&pathrev=10708&r1=10707&r2=10708
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/AttributeGroup.java	(original)
+++ trunk/src/java/org/tigris/scarab/om/AttributeGroup.java	2009-03-28 10:12:48-0700
@@ -277,11 +277,18 @@
                      getAttributeGroupId())
                 .add(RAttributeAttributeGroupPeer.ATTRIBUTE_ID, 
                      attribute.getAttributeId());
-            
-            result = (RAttributeAttributeGroup)RAttributeAttributeGroupPeer
-                .doSelect(crit).get(0);
-            ScarabCache.put(result, this, GET_R_ATTRIBUTE_ATTRGROUP, 
-                            attribute);
+           
+            List resultList = RAttributeAttributeGroupPeer.doSelect(crit);
+            if(resultList != null)
+            {
+                result = (RAttributeAttributeGroup)resultList.get(0);
+                ScarabCache.put(result, this, GET_R_ATTRIBUTE_ATTRGROUP, 
+                                attribute);
+            }
+            else
+            {
+                result = null;
+            }
         }
         else 
         {

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=1458542
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.