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/09 00:02:33 UTC
svn commit: r593350 -
/myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Author: jwaldman
Date: Thu Nov 8 15:02:33 2007
New Revision: 593350
URL: http://svn.apache.org/viewvc?rev=593350&view=rev
Log:
TRINIDAD-803 NPE in UIXCollection saveStampState()
This will get into 1.2.4, so we need it in 1.0.4 to keep things in sync. (all bug fixes in 1.0.4 need to be in 1.2.4 and vice versa)
Modified:
myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Modified: myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=593350&r1=593349&r2=593350&view=diff
==============================================================================
--- myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/branches/matzew-core-104-release-prepare/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Nov 8 15:02:33 2007
@@ -811,14 +811,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];
}
@@ -829,11 +829,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;
}