You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2007/11/08 23:36:51 UTC
svn commit: r593342 -
/myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Author: jwaldman
Date: Thu Nov 8 14:36:51 2007
New Revision: 593342
URL: http://svn.apache.org/viewvc?rev=593342&view=rev
Log:
TRINIDAD-803 NPE in UIXCollection saveStampState()
checked into 1.2.3.1-branch.
I think this is a 1.2 issue only according to the bug report.
Modified:
myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Modified: myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=593342&r1=593341&r2=593342&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/branches/1.2.3.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Nov 8 14:36:51 2007
@@ -813,14 +813,14 @@
for(Map.Entry<String, UIComponent> entry : facetMap.entrySet())
{
Object singleFacetState = saveStampState(context, entry.getValue());
+ if ((singleFacetState == null) ||
+ (singleFacetState == Transient.TRUE))
+ continue;
+
// Don't bother allocating anything until we have some non-null
// and non-transient facet state
if (facetStateIsEmpty)
- {
- if ((singleFacetState == null) ||
- (singleFacetState == Transient.TRUE))
- continue;
-
+ {
facetStateIsEmpty = false;
facetState = new Object[facetCount * 2];
}
@@ -831,11 +831,18 @@
facetState[base + 1] = singleFacetState;
i++;
}
-
+
// OK, we had something: allocate the state array to three
// entries, and insert the facet state at position 2
if (!facetStateIsEmpty)
{
+ // trim the facetState array if necessary
+ if(i < facetCount)
+ {
+ Object[] trimmed = new Object[i*2];
+ System.arraycopy(facetState, 0, trimmed, 0, i*2);
+ facetState = trimmed;
+ }
state = new Object[3];
state[2] = facetState;
}