You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/05/08 22:18:43 UTC

svn commit: r773079 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java

Author: arobinson74
Date: Fri May  8 20:18:43 2009
New Revision: 773079

URL: http://svn.apache.org/viewvc?rev=773079&view=rev
Log:
TRINIDAD-1357
Prevent null pointer exception in the row key set if the model has not been set on the collection yet

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java?rev=773079&r1=773078&r2=773079&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java Fri May  8 20:18:43 2009
@@ -34,6 +34,7 @@
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
+
 /**
  * Implements a collection of rowKeys from a TreeModel.
  * The methods on this class are optimized such that it is possible
@@ -59,7 +60,7 @@
   {
     _root = new Node<Object>(addAll);
   }
-    
+
   /**
    * Tests to see if the given rowKey is included in this Set.
    * @return true If the rowKey is included in this Set.
@@ -69,7 +70,7 @@
   {
     return _isContained(rowKey);
   }
-  
+
   /**
    * @deprecated do not use. this will be removed post Tier 1.
    */
@@ -647,6 +648,10 @@
       if (rowkey != null)
       {
         TreeModel model = getCollectionModel();
+        if (model == null)
+        {
+          return notFound(current, rowkey);
+        }
         List<Object> parentkeys = model.getAllAncestorContainerRowKeys(rowkey);
         List<Object> allkeys = new ArrayList<Object>(parentkeys.size() + 1);
         allkeys.addAll(parentkeys);
@@ -800,7 +805,7 @@
           _currIterator = _iteratorStack.pop();
       return nextKey;
     }
-  
+
     private Object _nextEntry()
     {
       Object nextKey = null;