SECTION: API changes
M jsf-api/src/javax/faces/event/AfterAddToParentEvent.java
M jsf-api/src/javax/faces/application/ResourceDependency.java
- remove spurious @return occurrences
M jsf-api/src/javax/faces/component/UIComponentBase.java
- Big bug fix regarding postback.
SECTION: Mojarra changes
M nbproject/project.xml
- Add test dirs to project
M jsf-ri/src/com/sun/faces/application/StateManagerImpl.java
- Big bug fix regarding ProjectStage
SECTION: Diffs
Index: nbproject/project.xml
===================================================================
--- nbproject/project.xml (revision 4850)
+++ nbproject/project.xml (working copy)
@@ -51,6 +51,12 @@
<location>jsf-api/test</location>
<encoding>UTF-8</encoding>
</source-folder>
+ <source-folder>
+ <label>jsf-ri\test</label>
+ <type>java</type>
+ <location>jsf-ri/test</location>
+ <encoding>UTF-8</encoding>
+ </source-folder>
</folders>
<ide-actions>
<action name="build">
@@ -96,6 +102,10 @@
<label>jsf-api\test</label>
<location>jsf-api/test</location>
</source-folder>
+ <source-folder style="packages">
+ <label>jsf-ri\test</label>
+ <location>jsf-ri/test</location>
+ </source-folder>
<source-file>
<location>build.xml</location>
</source-file>
@@ -118,7 +128,8 @@
<package-root>jsf-ri/build/generate</package-root>
<package-root>jsf-tools/src</package-root>
<package-root>jsf-api/test</package-root>
- <classpath mode="compile">jsf-api/build/classes:lib/jsf-extensions-test-time.jar:dependencies/glassfish/lib/appserv-rt.jar:dependencies/glassfish/lib/javaee.jar:dependencies/jars/com-sun-commons-beanutils.jar:dependencies/jars/com-sun-commons-collections.jar:dependencies/jars/com-sun-commons-digester-1.5.jar:dependencies/jars/com-sun-commons-digester.jar:dependencies/jars/com-sun-commons-logging-1.0.4.jar:dependencies/jars/com-sun-commons-logging-api.jar:dependencies/jars/commons-codec-1.3.jar:dependencies/jars/commons-collections-3.2.jar:dependencies/jars/commons-httpclient-3.1.jar:dependencies/jars/commons-io-1.3.1.jar:dependencies/jars/commons-lang-2.3.jar:dependencies/jars/commons-logging-1.1.jar:dependencies/jars/cssparser-0.9.4.jar:dependencies/jars/htmlunit-1.14.jar:dependencies/jars/ivy-2.0.0-beta1.jar:dependencies/jars/jaxen-1.1.1.jar:dependencies/jars/js-1.6R7.jar:dependencies/jars/jsp-api-2.1.jar:dependencies/jars/jsr250-api-1.0.jar:dependencies/jars/jstl-1.2.jar:dependencies/jars/junit-3.8.1.jar:dependencies/jars/maven-repository-importer-1.2.jar:dependencies/jars/nekohtml-0.9.5.jar:dependencies/jars/portlet-api-1.0.jar:dependencies/jars/servlet-api-2.5.jar:dependencies/jars/tlddoc-1.3.jar:dependencies/jars/xercesImpl-2.6.2.jar:dependencies/jars/xmlParserAPIs-2.6.2.jar:dependencies/jars/com-sun-commons-beanutils-1.6.1.jar:dependencies/apache-tomcat-6.0.13/lib/catalina.jar:dependencies/jars/com-sun-commons-collections-2.1.jar:dependencies/jetty-6.1.4rc0/lib/annotations/jetty-annotations-6.1.4rc0.jar:dependencies/jetty-6.1.4rc0/lib/plus/jetty-plus-6.1.4rc0.jar:dependencies/glassfish/lib/ant/lib/ant.jar</classpath>
+ <package-root>jsf-ri/test</package-root>
+ <classpath mode="compile">jsf-api/build/classes:lib/jsf-extensions-test-time.jar:dependencies/glassfish/lib/appserv-rt.jar:dependencies/glassfish/lib/javaee.jar:dependencies/jars/com-sun-commons-beanutils.jar:dependencies/jars/com-sun-commons-collections.jar:dependencies/jars/com-sun-commons-digester-1.5.jar:dependencies/jars/com-sun-commons-digester.jar:dependencies/jars/com-sun-commons-logging-1.0.4.jar:dependencies/jars/com-sun-commons-logging-api.jar:dependencies/jars/commons-codec-1.3.jar:dependencies/jars/commons-collections-3.2.jar:dependencies/jars/commons-httpclient-3.1.jar:dependencies/jars/commons-io-1.3.1.jar:dependencies/jars/commons-lang-2.3.jar:dependencies/jars/commons-logging-1.1.jar:dependencies/jars/cssparser-0.9.4.jar:dependencies/jars/htmlunit-1.14.jar:dependencies/jars/ivy-2.0.0-beta1.jar:dependencies/jars/jaxen-1.1.1.jar:dependencies/jars/js-1.6R7.jar:dependencies/jars/jsp-api-2.1.jar:dependencies/jars/jsr250-api-1.0.jar:dependencies/jars/jstl-1.2.jar:dependencies/jars/junit-3.8.1.jar:dependencies/jars/maven-repository-importer-1.2.jar:dependencies/jars/nekohtml-0.9.5.jar:dependencies/jars/portlet-api-1.0.jar:dependencies/jars/servlet-api-2.5.jar:dependencies/jars/tlddoc-1.3.jar:dependencies/jars/xercesImpl-2.6.2.jar:dependencies/jars/xmlParserAPIs-2.6.2.jar:dependencies/jars/com-sun-commons-beanutils-1.6.1.jar:dependencies/apache-tomcat-6.0.13/lib/catalina.jar:dependencies/jars/com-sun-commons-collections-2.1.jar:dependencies/jetty-6.1.4rc0/lib/annotations/jetty-annotations-6.1.4rc0.jar:dependencies/jetty-6.1.4rc0/lib/plus/jetty-plus-6.1.4rc0.jar:dependencies/glassfish/lib/ant/lib/ant.jar:lib/cactus-1.7.1-javaee5.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
</java-data>
Index: jsf-api/src/javax/faces/event/AfterAddToParentEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/AfterAddToParentEvent.java (revision 4850)
+++ jsf-api/src/javax/faces/event/AfterAddToParentEvent.java (working copy)
@@ -64,7 +64,6 @@
/**
* RELEASE_PENDING (edburns,rogerk) add documentation
* @param listener
- * @return
*/
@Override
public boolean isAppropriateListener(FacesListener listener) {
Index: jsf-api/src/javax/faces/component/UIComponentBase.java
===================================================================
--- jsf-api/src/javax/faces/component/UIComponentBase.java (revision 4850)
+++ jsf-api/src/javax/faces/component/UIComponentBase.java (working copy)
@@ -1900,8 +1900,14 @@
} else {
eraseParent(element);
element.setParent(component);
+ FacesContext context = FacesContext.getCurrentInstance();
+ // Make sure to clear our cache if the component is a UIViewRoot and
+ // it does not yet have children. This will be the case when
+ // the UIViewRoot has been freshly instantiated.
+ if (0 == this.size() && this.component instanceof UIViewRoot) {
+ clearPostbackAndRestoreViewCache(context);
+ }
super.add(index, element);
- FacesContext context = FacesContext.getCurrentInstance();
doPostAddProcessing(context, element);
}
}
@@ -1913,8 +1919,15 @@
} else {
eraseParent(element);
element.setParent(component);
+ FacesContext context = FacesContext.getCurrentInstance();
+ // Make sure to clear our cache if the component is a UIViewRoot and
+ // it does not yet have children. This will be the case when
+ // the UIViewRoot has been freshly instantiated.
+ if (0 == this.size() && this.component instanceof UIViewRoot) {
+ clearPostbackAndRestoreViewCache(context);
+ }
+
result = super.add(element);
- FacesContext context = FacesContext.getCurrentInstance();
doPostAddProcessing(context, element);
}
return result;
@@ -2038,7 +2051,7 @@
}
}
- private static void doPostAddProcessing(FacesContext context, UIComponent added) {
+ private void doPostAddProcessing(FacesContext context, UIComponent added) {
if (!isPostbackAndRestoreView(context)) {
context.getApplication().publishEvent(AfterAddToParentEvent.class, added);
processResourceDependencyOnComponentAndMaybeRenderer(context,
@@ -2048,7 +2061,13 @@
private static final String IS_POSTBACK_AND_RESTORE_VIEW_REQUEST_ATTR_NAME = "com.sun.faces.IS_POSTBACK_AND_RESTORE_VIEW";
- private static boolean isPostbackAndRestoreView(FacesContext context) {
+ private void clearPostbackAndRestoreViewCache(FacesContext context) {
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ requestMap.remove(IS_POSTBACK_AND_RESTORE_VIEW_REQUEST_ATTR_NAME);
+
+ }
+
+ private boolean isPostbackAndRestoreView(FacesContext context) {
boolean result = false;
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
if (requestMap.containsKey(IS_POSTBACK_AND_RESTORE_VIEW_REQUEST_ATTR_NAME)) {
@@ -2056,8 +2075,8 @@
}
else {
result = getResponseStateManager(context,
- context.getViewRoot().getRenderKitId()).isPostback(context)
- && PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId());
+ context.getViewRoot().getRenderKitId()).isPostback(context) &&
+ context.getCurrentPhaseId().equals(PhaseId.RESTORE_VIEW);
requestMap.put(IS_POSTBACK_AND_RESTORE_VIEW_REQUEST_ATTR_NAME,
result ? Boolean.TRUE : Boolean.FALSE);
@@ -2086,7 +2105,7 @@
}
- private static void processResourceDependencyOnComponentAndMaybeRenderer(FacesContext context,
+ private void processResourceDependencyOnComponentAndMaybeRenderer(FacesContext context,
UIComponent added) {
processResourceDependencyAnnotation(context, added);
Renderer renderer = added.getRenderer(context);
@@ -2095,7 +2114,7 @@
}
}
- private static void processResourceDependencyAnnotation(FacesContext context,
+ private void processResourceDependencyAnnotation(FacesContext context,
Object source) {
UIOutput resourceComponent = null;
if (!source.getClass().isAnnotationPresent(ResourceDependency.class)) {
Index: jsf-api/src/javax/faces/application/ResourceDependency.java
===================================================================
--- jsf-api/src/javax/faces/application/ResourceDependency.java (revision 4850)
+++ jsf-api/src/javax/faces/application/ResourceDependency.java (working copy)
@@ -82,19 +82,16 @@
/**
* RELEASE_PENDING (edburns,rogerk) Add docs
- * @return
*/
public String name();
/**
* RELEASE_PENDING (edburns,rogerk) Add docs
- * @return
*/
public String library() default "";
/**
* RELEASE_PENDING (edburns,rogerk) Add docs
- * @return
*/
public String target() default "";
Index: jsf-ri/src/com/sun/faces/application/StateManagerImpl.java
===================================================================
--- jsf-ri/src/com/sun/faces/application/StateManagerImpl.java (revision 4850)
+++ jsf-ri/src/com/sun/faces/application/StateManagerImpl.java (working copy)
@@ -99,6 +99,7 @@
private int noOfViews;
private int noOfViewsInLogicalView;
private Map<String,Class<?>> classMap;
+ private boolean isDevelopmentMode;
// ------------------------------------------------------------ Constructors
@@ -109,7 +110,7 @@
serialProvider = SerializationProviderFactory
.createInstance(fContext.getExternalContext());
webConfig = WebConfiguration.getInstance(fContext.getExternalContext());
- if (fContext.getApplication().getProjectStage() != ProjectStage.Development) {
+ if (!(isDevelopmentMode = (fContext.getApplication().getProjectStage() == ProjectStage.Development))) {
classMap = new ConcurrentHashMap<String,Class<?>>(32);
}
}
@@ -613,7 +614,9 @@
if (t != null && classMap != null) {
classMap.put(n.componentType, t);
} else {
- throw new NullPointerException();
+ if (!isDevelopmentMode) {
+ throw new NullPointerException();
+ }
}
}
--
| ed.burns_at_sun.com | office: 408 884 9519 OR x31640
| homepage: |
http://purl.oclc.org/NET/edburns/
| aim: edburns0sunw | iim: ed.burns_at_sun.com