Skip to content

Commit

Permalink
Merge branch 'master' into
Browse files Browse the repository at this point in the history
faces_issue_1507_automatically_pass_through_all_on-event_attributes
  • Loading branch information
BalusC committed Mar 24, 2024
2 parents 2f822ea + 445c971 commit c5c11ca
Show file tree
Hide file tree
Showing 151 changed files with 23,517 additions and 558 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ jobs:
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Checkout API
uses: actions/checkout@v4
with:
repository: jakartaee/faces
ref: '5.0'
path: './faces'
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Setup Maven Action
uses: s4u/[email protected]
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: temurin
maven-version: 3.9.6
- name: Build with Maven
run: mvn --no-transfer-progress install -Pstaging
run: mvn --no-transfer-progress install -Pstaging -Papi
6 changes: 0 additions & 6 deletions action/faces-config.NavData

This file was deleted.

41 changes: 17 additions & 24 deletions impl/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021, 2023 Contributors to Eclipse Foundation.
Copyright (c) 2021, 2024 Contributors to Eclipse Foundation.
Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0-M1</version>
<version>6.1.0-M2</version>
<scope>provided</scope>
</dependency>

Expand All @@ -75,21 +75,21 @@
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>6.0.0-M1</version>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.1.0-M1</version>
<version>4.1.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-el-api</artifactId>
<version>4.1.0-M1</version>
<version>4.1.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -130,23 +130,23 @@
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0-M1</version>
<version>3.2.0-M2</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.1</version>
<version>4.0.2</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>3.0.0-M1</version>
<version>3.0.0</version>
</dependency>


Expand All @@ -160,23 +160,16 @@
</dependency>

<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>3.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>2.0.9</version>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.9</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -286,7 +279,7 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.5</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
Expand All @@ -313,10 +306,10 @@
<Bundle-SymbolicName>org.glassfish.jakarta.faces</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Name>Mojarra Faces Implementation ${project.version}</Bundle-Name>
<Bundle-Description>Eclipse Faces Implementation (jakarta.faces/4.0) ${project.version}</Bundle-Description>
<Bundle-Description>Eclipse Faces Implementation (jakarta.faces/4.1) ${project.version}</Bundle-Description>

<Specification-Title>Jakarta Faces</Specification-Title>
<Specification-Version>4.0</Specification-Version>
<Specification-Version>4.1</Specification-Version>

<Implementation-Title>Mojarra</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import static jakarta.faces.component.UIComponent.ATTRS_WITH_DECLARED_DEFAULT_VALUES;
import static jakarta.faces.component.UIComponent.BEANINFO_KEY;
import static jakarta.faces.component.UIComponent.COMPOSITE_COMPONENT_TYPE_KEY;
import static java.beans.Introspector.getBeanInfo;
import static java.beans.PropertyEditorManager.findEditor;
import static java.text.MessageFormat.format;
import static java.util.Collections.unmodifiableMap;
Expand All @@ -37,7 +36,6 @@

import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
Expand All @@ -53,20 +51,11 @@
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.sun.faces.application.ApplicationAssociate;
import com.sun.faces.application.ConverterPropertyEditorFactory;
import com.sun.faces.application.ViewMemberInstanceFactoryMetadataMap;
import com.sun.faces.cdi.CdiUtils;
import com.sun.faces.config.WebConfiguration;
import com.sun.faces.util.FacesLogger;
import com.sun.faces.util.MessageUtils;
import com.sun.faces.util.ReflectionUtils;
import com.sun.faces.util.Util;

import jakarta.el.ExpressionFactory;
import jakarta.el.ValueExpression;
import jakarta.enterprise.inject.spi.BeanManager;
Expand All @@ -76,13 +65,32 @@
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.behavior.Behavior;
import jakarta.faces.context.FacesContext;
import jakarta.faces.convert.BooleanConverter;
import jakarta.faces.convert.ByteConverter;
import jakarta.faces.convert.CharacterConverter;
import jakarta.faces.convert.Converter;
import jakarta.faces.convert.DateTimeConverter;
import jakarta.faces.convert.DoubleConverter;
import jakarta.faces.convert.FloatConverter;
import jakarta.faces.convert.IntegerConverter;
import jakarta.faces.convert.LongConverter;
import jakarta.faces.convert.ShortConverter;
import jakarta.faces.convert.UUIDConverter;
import jakarta.faces.render.RenderKit;
import jakarta.faces.render.Renderer;
import jakarta.faces.validator.Validator;
import jakarta.faces.view.ViewDeclarationLanguage;

import com.sun.faces.application.ApplicationAssociate;
import com.sun.faces.application.ConverterPropertyEditorFactory;
import com.sun.faces.application.ViewMemberInstanceFactoryMetadataMap;
import com.sun.faces.cdi.CdiUtils;
import com.sun.faces.config.WebConfiguration;
import com.sun.faces.util.FacesLogger;
import com.sun.faces.util.MessageUtils;
import com.sun.faces.util.ReflectionUtils;
import com.sun.faces.util.Util;

public class InstanceFactory {

// Log instance for this class
Expand All @@ -97,14 +105,15 @@ public class InstanceFactory {
private static final Map<Class<?>, String> STANDARD_TYPE_TO_CONV_ID_MAP = new HashMap<>(16, 1.0f);

static {
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Byte", new Class<?>[] { Byte.TYPE, Byte.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Boolean", new Class<?>[] { Boolean.TYPE, Boolean.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Character", new Class<?>[] { Character.TYPE, Character.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Short", new Class<?>[] { Short.TYPE, Short.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Integer", new Class<?>[] { Integer.TYPE, Integer.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Long", new Class<?>[] { Long.TYPE, Long.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Float", new Class<?>[] { Float.TYPE, Float.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put("jakarta.faces.Double", new Class<?>[] { Double.TYPE, Double.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(ByteConverter.CONVERTER_ID, new Class<?>[] { Byte.TYPE, Byte.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(BooleanConverter.CONVERTER_ID, new Class<?>[] { Boolean.TYPE, Boolean.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(CharacterConverter.CONVERTER_ID, new Class<?>[] { Character.TYPE, Character.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(ShortConverter.CONVERTER_ID, new Class<?>[] { Short.TYPE, Short.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(IntegerConverter.CONVERTER_ID, new Class<?>[] { Integer.TYPE, Integer.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(LongConverter.CONVERTER_ID, new Class<?>[] { Long.TYPE, Long.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(FloatConverter.CONVERTER_ID, new Class<?>[] { Float.TYPE, Float.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(DoubleConverter.CONVERTER_ID, new Class<?>[] { Double.TYPE, Double.class });
STANDARD_CONV_ID_TO_TYPE_MAP.put(UUIDConverter.CONVERTER_ID, new Class<?>[] { UUID.class });
for (Map.Entry<String, Class<?>[]> entry : STANDARD_CONV_ID_TO_TYPE_MAP.entrySet()) {
Class<?>[] types = entry.getValue();
String key = entry.getKey();
Expand Down Expand Up @@ -805,21 +814,12 @@ private void pushDeclaredDefaultValuesToAttributesMap(FacesContext context, Bean
ExpressionFactory expressionFactory) {

Collection<String> attributesWithDeclaredDefaultValues = null;
PropertyDescriptor[] propertyDescriptors = null;

for (PropertyDescriptor propertyDescriptor : componentMetadata.getPropertyDescriptors()) {
Object defaultValue = propertyDescriptor.getValue("default");

if (defaultValue != null) {
String key = propertyDescriptor.getName();
boolean isLiteralText = false;

if (defaultValue instanceof ValueExpression) {
isLiteralText = ((ValueExpression) defaultValue).isLiteralText();
if (isLiteralText) {
defaultValue = ((ValueExpression) defaultValue).getValue(context.getELContext());
}
}

// Ensure this attribute is not a method-signature. method-signature
// declared default values are handled in retargetMethodExpressions.
Expand All @@ -834,24 +834,6 @@ private void pushDeclaredDefaultValuesToAttributesMap(FacesContext context, Bean
}
}
attributesWithDeclaredDefaultValues.add(key);

// Only store the attribute if it is literal text. If it
// is a ValueExpression, it will be handled explicitly in
// CompositeComponentAttributesELResolver.ExpressionEvalMap.get().
// If it is a MethodExpression, it will be dealt with in
// retargetMethodExpressions.
if (isLiteralText) {
try {
if (propertyDescriptors == null) {
propertyDescriptors = getBeanInfo(component.getClass()).getPropertyDescriptors();
}
} catch (IntrospectionException e) {
throw new FacesException(e);
}

defaultValue = convertValueToTypeIfNecessary(key, defaultValue, propertyDescriptors, expressionFactory);
attrs.put(key, defaultValue);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.ArrayList;
Expand Down Expand Up @@ -341,6 +342,10 @@ public void handleResourceRequest(FacesContext context) throws IOException {
}

private static boolean isConnectionAbort(IOException ioe) {
if (ioe instanceof ClosedChannelException) {
return true;
}

String exceptionClassName = ioe.getClass().getCanonicalName();

if (exceptionClassName.equals("org.apache.catalina.connector.ClientAbortException") ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.sun.faces.application.view.ViewScopeManager.VIEW_MAP_ID;
import static com.sun.faces.cdi.CdiUtils.getBeanReference;
import static com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.EnableDistributable;
import static com.sun.faces.context.SessionMap.getMutex;
import static com.sun.faces.util.Util.getCdiBeanManager;
import static java.util.logging.Level.FINEST;
import static java.util.logging.Level.WARNING;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void clear(FacesContext facesContext, Map<String, Object> viewMap) {
LOGGER.log(WARNING, "Cannot locate the view map to clear in the active maps: {0}", viewMap);
}
}

/**
* Clear the given view map.
*
Expand Down Expand Up @@ -247,7 +248,7 @@ private Map<String, ViewScopeContextObject> getContextMap(FacesContext facesCont
String viewMapId = (String) facesContext.getViewRoot().getTransientStateHelper().getTransient(VIEW_MAP_ID);

if (activeViewScopeContexts == null && create) {
synchronized (session) {
synchronized (getMutex(session)) {
activeViewScopeContexts = new ConcurrentHashMap<>();
sessionMap.put(ACTIVE_VIEW_CONTEXTS, activeViewScopeContexts);
}
Expand Down Expand Up @@ -332,7 +333,7 @@ public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {

HttpSession session = httpSessionEvent.getSession();

Map<Object, Map<String, ViewScopeContextObject>> activeViewScopeContexts = (Map<Object, Map<String, ViewScopeContextObject>>)
Map<Object, Map<String, ViewScopeContextObject>> activeViewScopeContexts = (Map<Object, Map<String, ViewScopeContextObject>>)
session.getAttribute(ACTIVE_VIEW_CONTEXTS);
if (activeViewScopeContexts != null) {
Map<String, Object> activeViewMaps = (Map<String, Object>) session.getAttribute(ViewScopeManager.ACTIVE_VIEW_MAPS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.EnableDistributable;
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.NumberOfClientWindows;
import static com.sun.faces.context.SessionMap.getMutex;
import static java.util.logging.Level.FINEST;

import java.util.Collections;
Expand Down Expand Up @@ -157,7 +158,7 @@ private Map<String, ClientWindowScopeContextObject> getContextMap(FacesContext f
numberOfClientWindows = Integer.valueOf(NumberOfClientWindows.getDefaultValue());
}

synchronized (session) {
synchronized (getMutex(session)) {
sessionMap.put(CLIENT_WINDOW_CONTEXTS, Collections.synchronizedMap(new LRUMap<String, Object>(numberOfClientWindows)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import static com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.ForceLoadFacesConfigFiles;
import static com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.VerifyFacesConfigObjects;
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.JakartaFacesProjectStage;
import static com.sun.faces.context.SessionMap.createMutex;
import static com.sun.faces.context.SessionMap.removeMutex;
import static com.sun.faces.push.WebsocketEndpoint.URI_TEMPLATE;
import static java.lang.Boolean.TRUE;
import static java.text.MessageFormat.format;
Expand Down Expand Up @@ -350,13 +352,17 @@ public void requestInitialized(ServletRequestEvent event) {

@Override
public void sessionCreated(HttpSessionEvent event) {
createMutex(event.getSession());

if (webAppListener != null) {
webAppListener.sessionCreated(event);
}
}

@Override
public void sessionDestroyed(HttpSessionEvent event) {
removeMutex(event.getSession());

if (webAppListener != null) {
webAppListener.sessionDestroyed(event);
}
Expand Down
Loading

0 comments on commit c5c11ca

Please sign in to comment.