From 6d7d6674d324e2157a8e06af01d563bd5da6333b Mon Sep 17 00:00:00 2001
From: pizzi80
Date: Tue, 20 Jun 2023 01:53:35 +0200
Subject: [PATCH 1/2] + final on effective final fields + Java style array
declaration instead of C-style
Signed-off-by: pizzi80
---
.../application/ApplicationAssociate.java | 29 +++-----
.../application/ApplicationStateInfo.java | 2 +-
.../application/ByteArrayWebOutputStream.java | 2 +-
.../ConverterPropertyEditorFactory.java | 20 ++---
.../faces/application/NamedEventManager.java | 10 +--
.../sun/faces/application/WebPrintWriter.java | 4 +-
.../application/WebappLifecycleListener.java | 2 +-
.../annotation/AnnotationManager.java | 8 +-
.../application/annotation/EJBHandler.java | 8 +-
.../annotation/FacesComponentUsage.java | 4 +-
.../annotation/ListenerForHandler.java | 14 ++--
.../annotation/PersistenceContextHandler.java | 8 +-
.../annotation/PersistenceUnitHandler.java | 8 +-
.../annotation/ResourceDependencyHandler.java | 4 +-
.../annotation/ResourceHandler.java | 8 +-
.../annotation/WebServiceRefHandler.java | 8 +-
.../application/applicationimpl/Events.java | 6 +-
.../applicationimpl/ExpressionLanguage.java | 4 +-
.../applicationimpl/InstanceFactory.java | 16 ++--
.../applicationimpl/SearchExpression.java | 2 +-
.../events/ComponentSystemEventHelper.java | 2 +-
.../applicationimpl/events/EventInfo.java | 8 +-
.../events/SystemEventInfo.java | 2 +-
.../resource/ClasspathResourceHelper.java | 4 +-
.../resource/FaceletLibraryInfo.java | 2 +-
.../resource/FaceletResourceInfo.java | 2 +-
.../application/resource/LibraryInfo.java | 6 +-
.../application/resource/ResourceCache.java | 2 +-
.../resource/ResourceHandlerImpl.java | 8 +-
.../application/resource/ResourceHelper.java | 10 +--
.../application/resource/ResourceManager.java | 10 +--
.../application/resource/VersionInfo.java | 15 ++--
.../resource/WebappResourceHelper.java | 4 +-
.../view/FaceletViewHandlingStrategy.java | 2 +-
.../application/view/FormOmittedChecker.java | 2 +-
.../application/view/MultiViewHandler.java | 12 +--
.../application/view/ViewMetadataImpl.java | 2 +-
.../application/view/ViewScopeManager.java | 4 +-
.../view/WriteBehindStateWriter.java | 14 ++--
.../java/com/sun/faces/cdi/CdiExtension.java | 2 +-
.../java/com/sun/faces/cdi/CdiProducer.java | 2 +-
.../CompositeComponentStackManager.java | 10 +--
.../validator/ComponentValidators.java | 22 +++---
.../component/visit/FullVisitContext.java | 4 +-
.../com/sun/faces/config/ConfigManager.java | 17 ++---
.../sun/faces/config/ConfigureListener.java | 6 +-
.../faces/config/FaceletsConfiguration.java | 6 +-
.../sun/faces/config/InitFacesContext.java | 2 +-
.../java/com/sun/faces/config/Verifier.java | 2 +-
.../sun/faces/config/WebConfiguration.java | 73 +++++++++----------
.../faces/config/manager/FacesConfigInfo.java | 6 +-
.../documents/DocumentOrderingWrapper.java | 29 +++-----
.../tasks/FindAnnotatedConfigClasses.java | 8 +-
.../tasks/FindConfigResourceURIsTask.java | 8 +-
.../tasks/ParseConfigResourceToDOMTask.java | 6 +-
.../processor/ConverterConfigProcessor.java | 6 +-
.../FacesConfigExtensionProcessor.java | 8 +-
.../processor/LifecycleConfigProcessor.java | 8 +-
.../context/AjaxNoAjaxExceptionHandler.java | 2 +-
.../faces/context/ExceptionHandlerImpl.java | 6 +-
.../faces/context/PartialViewContextImpl.java | 10 +--
.../faces/context/StringArrayValuesMap.java | 13 ++--
.../com/sun/faces/context/flash/ELFlash.java | 4 +-
...ompositeComponentAttributesELResolver.java | 10 +--
.../java/com/sun/faces/el/ELContextImpl.java | 6 +-
.../sun/faces/renderkit/AttributeManager.java | 2 +-
.../com/sun/faces/util/ComponentStruct.java | 4 +-
.../java/com/sun/faces/util/FacesLogger.java | 2 +-
.../main/java/com/sun/faces/util/LRUMap.java | 2 +-
.../com/sun/faces/util/MessageFactory.java | 6 +-
.../sun/faces/util/MetadataWrapperMap.java | 4 +-
.../java/com/sun/faces/util/ScopedRunner.java | 6 +-
.../vendor/WebContainerInjectionProvider.java | 4 +-
.../faces/CurrentThreadToServletContext.java | 9 ++-
.../application/NavigationCaseWrapper.java | 2 +-
.../application/StateManagerWrapper.java | 2 +-
.../faces/component/ComponentStateHelper.java | 8 +-
.../faces/component/MessageFactory.java | 4 +-
.../faces/component/SelectItemsIterator.java | 22 +++---
.../faces/component/UIComponentBase.java | 2 +-
.../java/jakarta/faces/component/UIData.java | 4 +-
.../faces/component/UINamingContainer.java | 2 +-
.../jakarta/faces/component/UIViewAction.java | 4 +-
.../faces/component/UIViewParameter.java | 6 +-
.../faces/component/UpdateModelException.java | 2 +-
.../behavior/ClientBehaviorContext.java | 32 +++-----
.../faces/component/visit/VisitContext.java | 2 +-
.../jakarta/faces/context/FacesContext.java | 33 ++++-----
.../jakarta/faces/context/ResponseWriter.java | 2 +-
.../event/ExceptionQueuedEventContext.java | 13 ++--
.../java/jakarta/faces/event/PhaseEvent.java | 4 +-
.../jakarta/faces/event/ScopeContext.java | 4 +-
.../java/jakarta/faces/model/DataModel.java | 2 +-
.../jakarta/faces/model/SelectItemGroup.java | 4 +-
.../jakarta/faces/webapp/FacesServlet.java | 12 ++-
.../jakarta/faces/webapp/MessageFactory.java | 4 +-
96 files changed, 357 insertions(+), 406 deletions(-)
diff --git a/impl/src/main/java/com/sun/faces/application/ApplicationAssociate.java b/impl/src/main/java/com/sun/faces/application/ApplicationAssociate.java
index 8b9f6b1440..e08430df88 100644
--- a/impl/src/main/java/com/sun/faces/application/ApplicationAssociate.java
+++ b/impl/src/main/java/com/sun/faces/application/ApplicationAssociate.java
@@ -119,14 +119,14 @@ public class ApplicationAssociate {
private final static String FacesComponentJcpNamespace = "http://xmlns.jcp.org/jsf/component";
- private ApplicationImpl applicationImpl;
+ private final ApplicationImpl applicationImpl;
/**
* Overall Map containing from-view-id key and Set of NavigationCase objects for
* that key; The from-view-id strings in this map will be stored as specified in the configuration file -
* some of them will have a trailing asterisk "*" signifying wild card, and some may be specified as an asterisk "*".
*/
- private Map> navigationMap;
+ private final Map> navigationMap;
/*
* The FacesComponentTagLibrary uses the information in this map to help it fabricate tag handlers for components
@@ -139,43 +139,38 @@ public class ApplicationAssociate {
private static final String ASSOCIATE_KEY = RIConstants.FACES_PREFIX + "ApplicationAssociate";
- private static ThreadLocal instance = new ThreadLocal<>() {
- @Override
- protected ApplicationAssociate initialValue() {
- return null;
- }
- };
+ private static final ThreadLocal instance = ThreadLocal.withInitial(() -> null);
private List elResolversFromFacesConfig;
private ExpressionFactory expressionFactory;
- private InjectionProvider injectionProvider;
+ private final InjectionProvider injectionProvider;
private ResourceCache resourceCache;
private String contextName;
private boolean requestServiced;
private boolean errorPagePresent;
- private AnnotationManager annotationManager;
- private boolean devModeEnabled;
+ private final AnnotationManager annotationManager;
+ private final boolean devModeEnabled;
private Compiler compiler;
private DefaultFaceletFactory faceletFactory;
private ResourceManager resourceManager;
- private ApplicationStateInfo applicationStateInfo;
+ private final ApplicationStateInfo applicationStateInfo;
- private PropertyEditorHelper propertyEditorHelper;
+ private final PropertyEditorHelper propertyEditorHelper;
- private NamedEventManager namedEventManager;
+ private final NamedEventManager namedEventManager;
- private WebConfiguration webConfig;
+ private final WebConfiguration webConfig;
private FlowHandler flowHandler;
private SearchExpressionHandler searchExpressionHandler;
- private Map definingDocumentIdsToTruncatedJarUrls;
+ private final Map definingDocumentIdsToTruncatedJarUrls;
- private long timeOfInstantiation;
+ private final long timeOfInstantiation;
private Map> resourceLibraryContracts;
diff --git a/impl/src/main/java/com/sun/faces/application/ApplicationStateInfo.java b/impl/src/main/java/com/sun/faces/application/ApplicationStateInfo.java
index b34e108231..50c4d573e6 100644
--- a/impl/src/main/java/com/sun/faces/application/ApplicationStateInfo.java
+++ b/impl/src/main/java/com/sun/faces/application/ApplicationStateInfo.java
@@ -32,7 +32,7 @@
*/
public class ApplicationStateInfo {
- private boolean partialStateSaving;
+ private final boolean partialStateSaving;
private Set fullStateViewIds;
// ------------------------------------------------------------ Constructors
diff --git a/impl/src/main/java/com/sun/faces/application/ByteArrayWebOutputStream.java b/impl/src/main/java/com/sun/faces/application/ByteArrayWebOutputStream.java
index 739834efb5..87bdc36ebe 100644
--- a/impl/src/main/java/com/sun/faces/application/ByteArrayWebOutputStream.java
+++ b/impl/src/main/java/com/sun/faces/application/ByteArrayWebOutputStream.java
@@ -45,7 +45,7 @@ class ByteArrayWebOutputStream extends ServletOutputStream {
// Log instance for this class
private static final Logger LOGGER = FacesLogger.APPLICATION.getLogger();
- private DirectByteArrayOutputStream baos;
+ private final DirectByteArrayOutputStream baos;
private boolean committed;
public ByteArrayWebOutputStream() {
diff --git a/impl/src/main/java/com/sun/faces/application/ConverterPropertyEditorFactory.java b/impl/src/main/java/com/sun/faces/application/ConverterPropertyEditorFactory.java
index 660e566abb..f5a824a2e6 100644
--- a/impl/src/main/java/com/sun/faces/application/ConverterPropertyEditorFactory.java
+++ b/impl/src/main/java/com/sun/faces/application/ConverterPropertyEditorFactory.java
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.ref.WeakReference;
+import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
@@ -118,7 +119,7 @@ public int compareTo(Utf8InfoReplacement rhs) {
// The source template class on which to base the definition of the new
// PropertyEditor classes.
- private Class extends ConverterPropertyEditorBase> templateClass;
+ private final Class extends ConverterPropertyEditorBase> templateClass;
// The bytes that define the source template class.
private byte[] templateBytes;
// The constant_pool_count from the template class bytecodes.
@@ -341,7 +342,7 @@ private byte[] replaceInTemplate(Utf8InfoReplacement... replacements) {
*/
public byte[] generateClassBytesFor(String newClassName, String targetClassName) {
return replaceInTemplate(new Utf8InfoReplacement(classNameConstant, newClassName),
- new Utf8InfoReplacement(classNameRefConstant, new StringBuilder(32).append('L').append(newClassName).append(';').toString()),
+ new Utf8InfoReplacement(classNameRefConstant, 'L' + newClassName + ';'),
new Utf8InfoReplacement(targetClassConstant, targetClassName));
}
}
@@ -361,9 +362,9 @@ public byte[] generateClassBytesFor(String newClassName, String targetClassName)
*/
private class DisposableClassLoader extends ClassLoader {
// The class loader which loaded the target class.
- private ClassLoader targetLoader;
+ private final ClassLoader targetLoader;
// The class loader which loaded the base class
- private ClassLoader myLoader;
+ private final ClassLoader myLoader;
public DisposableClassLoader(ClassLoader targetLoader) {
super(targetLoader);
@@ -439,7 +440,7 @@ protected Class> findClass(String className) throws ClassNotFoundException {
private static final Pattern MultipleUnderscorePattern = Pattern.compile("_(_+)");
private static ConverterPropertyEditorFactory defaultInstance;
// Template information extracted from the source template class.
- private ClassTemplateInfo templateInfo;
+ private final ClassTemplateInfo templateInfo;
// Cache of DisposableClassLoaders keyed on the class loader of the target.
private Map> classLoaderCache;
@@ -543,14 +544,7 @@ private static String getVMClassName(Class> c) {
*/
private static byte[] getUtf8InfoBytes(String text) {
byte[] utf8;
- try {
- utf8 = text.getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- // The DM_DEFAULT_ENCODING warning is acceptable here
- // because we explicitly *want* to use the Java runtime's
- // default encoding.
- utf8 = text.getBytes();
- }
+ utf8 = text.getBytes(StandardCharsets.UTF_8);
byte[] info = new byte[utf8.length + 3];
info[0] = 1;
info[1] = (byte) (utf8.length >> 8 & 0xff);
diff --git a/impl/src/main/java/com/sun/faces/application/NamedEventManager.java b/impl/src/main/java/com/sun/faces/application/NamedEventManager.java
index 1dea5a5230..7d28fdef9d 100644
--- a/impl/src/main/java/com/sun/faces/application/NamedEventManager.java
+++ b/impl/src/main/java/com/sun/faces/application/NamedEventManager.java
@@ -38,8 +38,8 @@
*/
public class NamedEventManager {
- private Map> namedEvents = new ConcurrentHashMap<>();
- private Map>> duplicateNames = new ConcurrentHashMap<>();
+ private final Map> namedEvents = new ConcurrentHashMap<>();
+ private final Map>> duplicateNames = new ConcurrentHashMap<>();
public NamedEventManager() {
namedEvents.put("jakarta.faces.event.PreRenderComponent", PreRenderComponentEvent.class);
@@ -81,12 +81,8 @@ public Class extends SystemEvent> getNamedEvent(String name) {
public void addDuplicateName(String name, Class extends SystemEvent> event) {
Class extends SystemEvent> registeredEvent = namedEvents.remove(name);
- Set> events = duplicateNames.get(name);
+ Set> events = duplicateNames.computeIfAbsent(name, k -> new HashSet<>());
- if (events == null) {
- events = new HashSet<>();
- duplicateNames.put(name, events);
- }
events.add(event);
if (registeredEvent != null) {
diff --git a/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java b/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java
index 46753ab080..634bf21d24 100644
--- a/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java
+++ b/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java
@@ -55,7 +55,7 @@ public NoOpWriter() {
}
@Override
- public void write(char cbuf[], int off, int len) throws IOException {
+ public void write(char[] cbuf, int off, int len) throws IOException {
// no-op
}
@@ -75,7 +75,7 @@ public void write(int c) throws IOException {
}
@Override
- public void write(char cbuf[]) throws IOException {
+ public void write(char[] cbuf) throws IOException {
// no-op
}
diff --git a/impl/src/main/java/com/sun/faces/application/WebappLifecycleListener.java b/impl/src/main/java/com/sun/faces/application/WebappLifecycleListener.java
index f85da517f9..5f8e478880 100644
--- a/impl/src/main/java/com/sun/faces/application/WebappLifecycleListener.java
+++ b/impl/src/main/java/com/sun/faces/application/WebappLifecycleListener.java
@@ -56,7 +56,7 @@ public class WebappLifecycleListener {
private ServletContext servletContext;
private ApplicationAssociate applicationAssociate;
- private Set activeSessions = ConcurrentHashMap.newKeySet();
+ private final Set activeSessions = ConcurrentHashMap.newKeySet();
// ------------------------------------------------------------ Constructors
diff --git a/impl/src/main/java/com/sun/faces/application/annotation/AnnotationManager.java b/impl/src/main/java/com/sun/faces/application/annotation/AnnotationManager.java
index c53bb58f1f..cbd0a78ed6 100644
--- a/impl/src/main/java/com/sun/faces/application/annotation/AnnotationManager.java
+++ b/impl/src/main/java/com/sun/faces/application/annotation/AnnotationManager.java
@@ -102,7 +102,7 @@ private enum ProcessingTarget {
Renderer(RENDERER_SCANNERS),
SystemEvent(EVENTS_SCANNERS);
- private Scanner[] scanners;
+ private final Scanner[] scanners;
ProcessingTarget(Scanner[] scanners) {
this.scanners = scanners;
@@ -113,7 +113,7 @@ private enum ProcessingTarget {
/**
* The backing cache for all annotation metadata.
*/
- private ConcurrentMap, Future
*/
- private List initializedContexts = new CopyOnWriteArrayList<>();
+ private final List initializedContexts = new CopyOnWriteArrayList<>();
- private final List configProcessors = unmodifiableList(
- asList(
+ private final List configProcessors = List.of(
new FactoryConfigProcessor(),
new LifecycleConfigProcessor(),
new ApplicationConfigProcessor(),
@@ -144,7 +143,7 @@ public class ConfigManager {
new FacesConfigExtensionProcessor(),
new ProtectedViewsConfigProcessor(),
new FacesFlowDefinitionConfigProcessor(),
- new ResourceLibraryContractsConfigProcessor()));
+ new ResourceLibraryContractsConfigProcessor());
/**
*
@@ -152,8 +151,8 @@ public class ConfigManager {
* Mojarra, and two other providers to satisfy the requirements of the specification.
*
*/
- private final List facesConfigProviders = unmodifiableList(
- asList(new MetaInfFacesConfigResourceProvider(), new WebAppFlowConfigResourceProvider(), new WebFacesConfigResourceProvider()));
+ private final List facesConfigProviders = List.of(
+ new MetaInfFacesConfigResourceProvider(), new WebAppFlowConfigResourceProvider(), new WebFacesConfigResourceProvider());
/**
*
@@ -161,8 +160,8 @@ public class ConfigManager {
* Mojarra, and one other providers to satisfy the requirements of the specification.
*
*/
- private final List facesletsTagLibConfigProviders = unmodifiableList(
- asList(new MetaInfFaceletTaglibraryConfigProvider(), new WebFaceletTaglibResourceProvider()));
+ private final List facesletsTagLibConfigProviders = List.of(
+ new MetaInfFaceletTaglibraryConfigProvider(), new WebFaceletTaglibResourceProvider());
/**
*
@@ -403,7 +402,7 @@ private List getConfigPopulators() {
configPopulators.add(new MojarraRuntimePopulator());
- ServiceLoader.load(ApplicationConfigurationPopulator.class).forEach(e -> configPopulators.add(e));
+ ServiceLoader.load(ApplicationConfigurationPopulator.class).forEach(configPopulators::add);
return configPopulators;
}
diff --git a/impl/src/main/java/com/sun/faces/config/ConfigureListener.java b/impl/src/main/java/com/sun/faces/config/ConfigureListener.java
index fa975e1f73..fbe1f9a190 100644
--- a/impl/src/main/java/com/sun/faces/config/ConfigureListener.java
+++ b/impl/src/main/java/com/sun/faces/config/ConfigureListener.java
@@ -687,7 +687,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
private class WebConfigResourceMonitor implements Runnable {
private List monitors;
- private ServletContext servletContext;
+ private final ServletContext servletContext;
// -------------------------------------------------------- Constructors
@@ -702,7 +702,7 @@ public WebConfigResourceMonitor(ServletContext servletContext, Collection u
monitors.add(new Monitor(uri));
} catch (IOException ioe) {
LOGGER.log(SEVERE, () -> "Unable to setup resource monitor for " + uri.toString() + ". Resource will not be monitored for changes.");
- LOGGER.log(FINE, ioe, () -> ioe.toString());
+ LOGGER.log(FINE, ioe, ioe::toString);
}
}
@@ -743,7 +743,7 @@ public void run() {
private class Monitor {
- private URI uri;
+ private final URI uri;
private long timestamp = -1;
// ---------------------------------------------------- Constructors
diff --git a/impl/src/main/java/com/sun/faces/config/FaceletsConfiguration.java b/impl/src/main/java/com/sun/faces/config/FaceletsConfiguration.java
index bd7b289636..ddb6fc793a 100644
--- a/impl/src/main/java/com/sun/faces/config/FaceletsConfiguration.java
+++ b/impl/src/main/java/com/sun/faces/config/FaceletsConfiguration.java
@@ -36,11 +36,11 @@ public class FaceletsConfiguration {
// private static final String CONSUME_COMMENTS_ATTRIBUTE_NAME = "com.sun.faces.config.ConsumeComments";
- private static Pattern EXTENSION_PATTERN = Pattern.compile("\\.[^/]+$");
+ private static final Pattern EXTENSION_PATTERN = Pattern.compile("\\.[^/]+$");
- private WebConfiguration config;
+ private final WebConfiguration config;
- private Map faceletsProcessingMappings;
+ private final Map faceletsProcessingMappings;
public FaceletsConfiguration(WebConfiguration config) {
this.config = config;
diff --git a/impl/src/main/java/com/sun/faces/config/InitFacesContext.java b/impl/src/main/java/com/sun/faces/config/InitFacesContext.java
index 96c3312dec..d2f88c00c5 100644
--- a/impl/src/main/java/com/sun/faces/config/InitFacesContext.java
+++ b/impl/src/main/java/com/sun/faces/config/InitFacesContext.java
@@ -51,7 +51,7 @@
*/
public class InitFacesContext extends NoOpFacesContext {
- private static Logger LOGGER = FacesLogger.CONFIG.getLogger();
+ private static final Logger LOGGER = FacesLogger.CONFIG.getLogger();
private static final String INIT_FACES_CONTEXT_ATTR_NAME = RIConstants.FACES_PREFIX + "InitFacesContext";
private ServletContextAdapter servletContextAdapter;
diff --git a/impl/src/main/java/com/sun/faces/config/Verifier.java b/impl/src/main/java/com/sun/faces/config/Verifier.java
index dc35d7a28c..a652dce125 100644
--- a/impl/src/main/java/com/sun/faces/config/Verifier.java
+++ b/impl/src/main/java/com/sun/faces/config/Verifier.java
@@ -46,7 +46,7 @@ public enum ObjectType {
/**
* Container for any messages that may be queued.
*/
- private List messages;
+ private final List messages;
// ------------------------------------------------------- Constructors
diff --git a/impl/src/main/java/com/sun/faces/config/WebConfiguration.java b/impl/src/main/java/com/sun/faces/config/WebConfiguration.java
index 012bb5cd16..c9021dda45 100644
--- a/impl/src/main/java/com/sun/faces/config/WebConfiguration.java
+++ b/impl/src/main/java/com/sun/faces/config/WebConfiguration.java
@@ -95,19 +95,19 @@ public class WebConfiguration {
// Logging level. Defaults to FINE
private Level loggingLevel = Level.FINE;
- private Map booleanContextParameters = new EnumMap<>(BooleanWebContextInitParameter.class);
+ private final Map booleanContextParameters = new EnumMap<>(BooleanWebContextInitParameter.class);
- private Map contextParameters = new EnumMap<>(WebContextInitParameter.class);
+ private final Map contextParameters = new EnumMap<>(WebContextInitParameter.class);
- private Map> facesConfigParameters = new EnumMap<>(WebContextInitParameter.class);
+ private final Map> facesConfigParameters = new EnumMap<>(WebContextInitParameter.class);
- private Map envEntries = new EnumMap<>(WebEnvironmentEntry.class);
+ private final Map envEntries = new EnumMap<>(WebEnvironmentEntry.class);
- private Map cachedListParams;
+ private final Map cachedListParams;
- private Set setParams = new HashSet<>();
+ private final Set setParams = new HashSet<>();
- private ServletContext servletContext;
+ private final ServletContext servletContext;
private ArrayList deferredLoggingActions;
@@ -315,7 +315,7 @@ public void overrideContextInitParameter(BooleanWebContextInitParameter param, b
return;
}
- boolean oldVal = booleanContextParameters.put(param, value);
+ boolean oldVal = Boolean.TRUE.equals(booleanContextParameters.put(param, value));
if (LOGGER.isLoggable(FINE) && oldVal != value) {
LOGGER.log(FINE, "Overriding init parameter {0}. Changing from {1} to {2}.", new Object[] { param.getQualifiedName(), oldVal, value });
}
@@ -462,8 +462,7 @@ private void discoverResourceLibraryContracts() {
}
}
} else {
- contractsToExpose = new ArrayList<>();
- contractsToExpose.addAll(foundContracts);
+ contractsToExpose = new ArrayList<>(foundContracts);
contractMappings.put("*", contractsToExpose);
}
extContex.getApplicationMap().put(FaceletViewHandlingStrategy.RESOURCE_LIBRARY_CONTRACT_DATA_STRUCTURE_KEY, contractMappings);
@@ -513,7 +512,7 @@ private boolean isValueValid(BooleanWebContextInitParameter param, String value)
*/
private void processBooleanParameters(ServletContext servletContext, String contextName) {
- // process boolean contxt parameters
+ // process boolean context parameters
for (BooleanWebContextInitParameter param : BooleanWebContextInitParameter.values()) {
String strValue = servletContext.getInitParameter(param.getQualifiedName());
boolean value;
@@ -534,7 +533,7 @@ private void processBooleanParameters(ServletContext servletContext, String cont
if (alternate != null) {
if (isValueValid(param, strValue)) {
- value = Boolean.valueOf(strValue);
+ value = Boolean.parseBoolean(strValue);
} else {
value = param.getDefaultValue();
}
@@ -555,7 +554,7 @@ private void processBooleanParameters(ServletContext servletContext, String cont
value = param.getDefaultValue();
} else {
if (isValueValid(param, strValue)) {
- value = Boolean.valueOf(strValue);
+ value = Boolean.parseBoolean(strValue);
} else {
value = param.getDefaultValue();
}
@@ -586,8 +585,8 @@ private void processBooleanParameters(ServletContext servletContext, String cont
* @param servletContext the ServletContext of interest
*/
private void initSetList(ServletContext servletContext) {
- for (Enumeration e = servletContext.getInitParameterNames(); e.hasMoreElements();) {
- String name = e.nextElement().toString();
+ for (Enumeration e = servletContext.getInitParameterNames(); e.hasMoreElements();) {
+ String name = e.nextElement();
if (name.startsWith("com.sun.faces") || name.startsWith("jakarta.faces")) {
setParams.add(name);
}
@@ -677,9 +676,9 @@ private void processJndiEntries(String contextName) {
initialContext = new InitialContext();
} catch (NoClassDefFoundError nde) {
// On google app engine InitialContext is forbidden to use and GAE throws NoClassDefFoundError
- LOGGER.log(FINE, nde, () -> nde.toString());
+ LOGGER.log(FINE, nde, nde::toString);
} catch (NamingException ne) {
- LOGGER.log(Level.WARNING, ne, () -> ne.toString());
+ LOGGER.log(Level.WARNING, ne, ne::toString);
}
if (initialContext != null) {
@@ -691,7 +690,7 @@ private void processJndiEntries(String contextName) {
try {
value = (String) initialContext.lookup(entryName);
} catch (NamingException root) {
- LOGGER.log(Level.FINE, () -> root.toString());
+ LOGGER.log(Level.FINE, root::toString);
}
if (value != null) {
@@ -778,11 +777,11 @@ public enum WebContextInitParameter {
WebAppContractsDirectory(ResourceHandler.WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, "/contracts"),
;
- private String defaultValue;
- private String qualifiedName;
- private WebContextInitParameter alternate;
- private boolean deprecated;
- private DeprecationLoggingStrategy loggingStrategy;
+ private final String defaultValue;
+ private final String qualifiedName;
+ private final WebContextInitParameter alternate;
+ private final boolean deprecated;
+ private final DeprecationLoggingStrategy loggingStrategy;
// ---------------------------------------------------------- Public Methods
@@ -888,12 +887,12 @@ public enum BooleanWebContextInitParameter {
UseFaceletsID("com.sun.faces.useFaceletsID",false),
;
- private BooleanWebContextInitParameter alternate;
+ private final BooleanWebContextInitParameter alternate;
- private String qualifiedName;
- private boolean defaultValue;
- private boolean deprecated;
- private DeprecationLoggingStrategy loggingStrategy;
+ private final String qualifiedName;
+ private final boolean defaultValue;
+ private final boolean deprecated;
+ private final DeprecationLoggingStrategy loggingStrategy;
// ---------------------------------------------------------- Public Methods
@@ -952,7 +951,7 @@ public enum WebEnvironmentEntry {
ProjectStage(jakarta.faces.application.ProjectStage.PROJECT_STAGE_JNDI_NAME);
private static final String JNDI_PREFIX = "java:comp/env/";
- private String qualifiedName;
+ private final String qualifiedName;
// ---------------------------------------------------------- Public Methods
@@ -1017,10 +1016,10 @@ private interface DeferredLoggingAction {
private class DeferredParameterLoggingAction implements DeferredLoggingAction {
- private WebContextInitParameter parameter;
- private Level loggingLevel;
- private String logKey;
- private Object[] params;
+ private final WebContextInitParameter parameter;
+ private final Level loggingLevel;
+ private final String logKey;
+ private final Object[] params;
DeferredParameterLoggingAction(WebContextInitParameter parameter, Level loggingLevel, String logKey, Object[] params) {
@@ -1047,10 +1046,10 @@ public void log() {
private class DeferredBooleanParameterLoggingAction implements DeferredLoggingAction {
- private BooleanWebContextInitParameter parameter;
- private Level loggingLevel;
- private String logKey;
- private Object[] params;
+ private final BooleanWebContextInitParameter parameter;
+ private final Level loggingLevel;
+ private final String logKey;
+ private final Object[] params;
DeferredBooleanParameterLoggingAction(BooleanWebContextInitParameter parameter, Level loggingLevel, String logKey, Object[] params) {
this.parameter = parameter;
diff --git a/impl/src/main/java/com/sun/faces/config/manager/FacesConfigInfo.java b/impl/src/main/java/com/sun/faces/config/manager/FacesConfigInfo.java
index 8686434fe3..2ecf003df3 100644
--- a/impl/src/main/java/com/sun/faces/config/manager/FacesConfigInfo.java
+++ b/impl/src/main/java/com/sun/faces/config/manager/FacesConfigInfo.java
@@ -48,8 +48,8 @@ public class FacesConfigInfo {
private static final String OTHERS = "others";
private double version = 2.0;
- private boolean isWebInfFacesConfig;
- private boolean metadataComplete;
+ private final boolean isWebInfFacesConfig;
+ private final boolean metadataComplete;
private List absoluteOrdering;
// -------------------------------------------------------- Constructors
@@ -141,7 +141,7 @@ private boolean isMetadataComplete(Document document) {
if (isVersionGreaterOrEqual(2.0)) {
String metadataComplete = document.getDocumentElement().getAttributeNS(document.getNamespaceURI(), "metadata-complete");
- return metadataComplete != null ? Boolean.valueOf(metadataComplete) : false;
+ return Boolean.parseBoolean(metadataComplete);
}
// not a 2.0 application, so annotation processing will not occur
diff --git a/impl/src/main/java/com/sun/faces/config/manager/documents/DocumentOrderingWrapper.java b/impl/src/main/java/com/sun/faces/config/manager/documents/DocumentOrderingWrapper.java
index e76202de62..517ec59319 100644
--- a/impl/src/main/java/com/sun/faces/config/manager/documents/DocumentOrderingWrapper.java
+++ b/impl/src/main/java/com/sun/faces/config/manager/documents/DocumentOrderingWrapper.java
@@ -54,7 +54,7 @@ public class DocumentOrderingWrapper {
/**
* {@link Comparator} implementation to aid in sorting faces-config documents.
*/
- private static Comparator COMPARATOR = new DocumentOrderingComparator();
+ private static final Comparator COMPARATOR = new DocumentOrderingComparator();
/**
* This is the limit on the number of attempts made to sort the documents. Any attempt to exceed this limit will result
@@ -105,7 +105,7 @@ public class DocumentOrderingWrapper {
/**
* The wrapped Document.
*/
- private DocumentInfo documentInfo;
+ private final DocumentInfo documentInfo;
/**
* The wrapped Document's ID.
@@ -229,8 +229,7 @@ public String toString() {
*/
public static DocumentOrderingWrapper[] sort(DocumentOrderingWrapper[] documents, List absoluteOrder) {
- List sourceList = new CopyOnWriteArrayList<>();
- sourceList.addAll(Arrays.asList(documents));
+ List sourceList = new CopyOnWriteArrayList<>(Arrays.asList(documents));
List targetList = new ArrayList<>();
for (String name : absoluteOrder) {
@@ -362,8 +361,8 @@ public static boolean done(DocumentOrderingWrapper[] documents, LinkedList getIds(DocumentOrderingWrapper[] documents) {
LinkedList ids = new LinkedList<>();
- for (int i = 0; i < documents.length; i++) {
- ids.add(documents[i].getDocumentId());
+ for (DocumentOrderingWrapper document : documents) {
+ ids.add(document.getDocumentId());
}
return ids;
}
@@ -377,11 +376,11 @@ public static int innerSort(DocumentOrderingWrapper[] documents) {
numberOfPasses++;
if (numberOfPasses == MAX_SORT_PASSED) {
if (LOGGER.isLoggable(Level.SEVERE)) {
- String msg = "Exceeded maximum number of attempts to sort the application's faces-config documents.\nDocument Info\n==================";
+ StringBuilder msg = new StringBuilder("Exceeded maximum number of attempts to sort the application's faces-config documents.\nDocument Info\n==================");
for (DocumentOrderingWrapper w : documents) {
- msg += " " + w.toString() + '\n';
+ msg.append(" ").append(w.toString()).append('\n');
}
- LOGGER.severe(msg);
+ LOGGER.severe(msg.toString());
}
throw new ConfigurationException("Exceeded maximum number of attempts to sort the faces-config documents.");
}
@@ -447,8 +446,7 @@ private static void enhanceOrderingData(DocumentOrderingWrapper[] wrappers) thro
if (OTHERS_KEY.equals(id)) {
continue;
}
- for (int ii = 0; ii < wrappers.length; ii++) {
- DocumentOrderingWrapper other = wrappers[ii];
+ for (DocumentOrderingWrapper other : wrappers) {
if (id.equals(other.id)) {
String[] afterIds = other.getAfterIds();
if (Arrays.binarySearch(afterIds, w.id) < 0) {
@@ -463,8 +461,7 @@ private static void enhanceOrderingData(DocumentOrderingWrapper[] wrappers) thro
if (otherBeforeIds.length > 0) {
String[] currentBeforeIds = w.getBeforeIds();
- Set newBeforeIds = new HashSet<>();
- newBeforeIds.addAll(Arrays.asList(currentBeforeIds));
+ Set newBeforeIds = new HashSet<>(Arrays.asList(currentBeforeIds));
for (String bid : otherBeforeIds) {
if (OTHERS_KEY.equals(bid)) {
continue;
@@ -488,8 +485,7 @@ private static void enhanceOrderingData(DocumentOrderingWrapper[] wrappers) thro
if (OTHERS_KEY.equals(id)) {
continue;
}
- for (int ii = 0; ii < wrappers.length; ii++) {
- DocumentOrderingWrapper other = wrappers[ii];
+ for (DocumentOrderingWrapper other : wrappers) {
if (id.equals(other.id)) {
String[] beforeIds = other.getBeforeIds();
if (Arrays.binarySearch(beforeIds, w.id) < 0) {
@@ -502,8 +498,7 @@ private static void enhanceOrderingData(DocumentOrderingWrapper[] wrappers) thro
String[] otherAfterIds = other.getAfterIds();
if (otherAfterIds.length > 0) {
String[] currentAfterIds = w.getAfterIds();
- Set newAfterIds = new HashSet<>();
- newAfterIds.addAll(Arrays.asList(currentAfterIds));
+ Set newAfterIds = new HashSet<>(Arrays.asList(currentAfterIds));
for (String bid : otherAfterIds) {
if (OTHERS_KEY.equals(bid)) {
continue;
diff --git a/impl/src/main/java/com/sun/faces/config/manager/tasks/FindAnnotatedConfigClasses.java b/impl/src/main/java/com/sun/faces/config/manager/tasks/FindAnnotatedConfigClasses.java
index 4e5bde7527..75cbaa8168 100644
--- a/impl/src/main/java/com/sun/faces/config/manager/tasks/FindAnnotatedConfigClasses.java
+++ b/impl/src/main/java/com/sun/faces/config/manager/tasks/FindAnnotatedConfigClasses.java
@@ -39,10 +39,10 @@
*/
public class FindAnnotatedConfigClasses implements Callable, Set>>> {
- private InitFacesContext facesContext;
- private AnnotationProvider provider;
- private ProvideMetadataToAnnotationScanTask metadataGetter;
- private Set> annotatedSet;
+ private final InitFacesContext facesContext;
+ private final AnnotationProvider provider;
+ private final ProvideMetadataToAnnotationScanTask metadataGetter;
+ private final Set> annotatedSet;
// -------------------------------------------------------- Constructors
diff --git a/impl/src/main/java/com/sun/faces/config/manager/tasks/FindConfigResourceURIsTask.java b/impl/src/main/java/com/sun/faces/config/manager/tasks/FindConfigResourceURIsTask.java
index 270578ad9b..1ebacdf514 100644
--- a/impl/src/main/java/com/sun/faces/config/manager/tasks/FindConfigResourceURIsTask.java
+++ b/impl/src/main/java/com/sun/faces/config/manager/tasks/FindConfigResourceURIsTask.java
@@ -37,8 +37,8 @@
*/
public class FindConfigResourceURIsTask implements Callable> {
- private ConfigurationResourceProvider provider;
- private ServletContext servletContext;
+ private final ConfigurationResourceProvider provider;
+ private final ServletContext servletContext;
// -------------------------------------------------------- Constructors
@@ -63,7 +63,7 @@ public FindConfigResourceURIsTask(ConfigurationResourceProvider provider, Servle
@SuppressWarnings("unchecked")
@Override
public Collection call() throws Exception {
- Collection> untypedCollection = provider.getResources(servletContext);
+ Collection untypedCollection = provider.getResources(servletContext);
Iterator> untypedCollectionIterator = untypedCollection.iterator();
Collection result = emptyList();
@@ -80,7 +80,7 @@ public Collection call() throws Exception {
result.add(new URI(((URL) cur).toExternalForm()));
}
} else {
- result = (Collection) untypedCollection;
+ result = untypedCollection;
}
}
diff --git a/impl/src/main/java/com/sun/faces/config/manager/tasks/ParseConfigResourceToDOMTask.java b/impl/src/main/java/com/sun/faces/config/manager/tasks/ParseConfigResourceToDOMTask.java
index 80d9fd9aac..741a69264f 100644
--- a/impl/src/main/java/com/sun/faces/config/manager/tasks/ParseConfigResourceToDOMTask.java
+++ b/impl/src/main/java/com/sun/faces/config/manager/tasks/ParseConfigResourceToDOMTask.java
@@ -89,10 +89,10 @@ public class ParseConfigResourceToDOMTask implements Callable {
*/
private static final String FACES_TO_1_1_PRIVATE_XSL = "/com/sun/faces/faces1_0-1_1toSchema.xsl";
- private ServletContext servletContext;
- private URI documentURI;
+ private final ServletContext servletContext;
+ private final URI documentURI;
private DocumentBuilderFactory factory;
- private boolean validating;
+ private final boolean validating;
diff --git a/impl/src/main/java/com/sun/faces/config/processor/ConverterConfigProcessor.java b/impl/src/main/java/com/sun/faces/config/processor/ConverterConfigProcessor.java
index 35db5cf7bd..ec5cf41817 100644
--- a/impl/src/main/java/com/sun/faces/config/processor/ConverterConfigProcessor.java
+++ b/impl/src/main/java/com/sun/faces/config/processor/ConverterConfigProcessor.java
@@ -76,11 +76,11 @@ public void process(ServletContext sc, FacesContext facesContext, DocumentInfo[]
// via config files take precedence
processAnnotations(facesContext, FacesConverter.class);
- for (int i = 0; i < documentInfos.length; i++) {
+ for (DocumentInfo documentInfo : documentInfos) {
if (LOGGER.isLoggable(FINE)) {
- LOGGER.log(FINE, format("Processing converter elements for document: ''{0}''", documentInfos[i].getSourceURI()));
+ LOGGER.log(FINE, format("Processing converter elements for document: ''{0}''", documentInfo.getSourceURI()));
}
- Document document = documentInfos[i].getDocument();
+ Document document = documentInfo.getDocument();
String namespace = document.getDocumentElement().getNamespaceURI();
NodeList nodes = document.getDocumentElement().getElementsByTagNameNS(namespace, CONVERTER);
if (nodes != null && nodes.getLength() > 0) {
diff --git a/impl/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java b/impl/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java
index aeaf312fbe..7357d877ae 100644
--- a/impl/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java
+++ b/impl/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java
@@ -75,17 +75,17 @@ public FacesConfigExtensionProcessor() {
@Override
public void process(ServletContext sc, FacesContext facesContext, DocumentInfo[] documentInfos) throws Exception {
- for (int i = 0; i < documentInfos.length; i++) {
+ for (DocumentInfo documentInfo : documentInfos) {
if (LOGGER.isLoggable(FINE)) {
- LOGGER.log(FINE, format("Processing faces-config-extension elements for document: ''{0}''", documentInfos[i].getSourceURI()));
+ LOGGER.log(FINE, format("Processing faces-config-extension elements for document: ''{0}''", documentInfo.getSourceURI()));
}
- Document document = documentInfos[i].getDocument();
+ Document document = documentInfo.getDocument();
String namespace = document.getDocumentElement().getNamespaceURI();
NodeList facesConfigExtensions = document.getDocumentElement().getElementsByTagNameNS(namespace, FACES_CONFIG_EXTENSION);
if (facesConfigExtensions != null && facesConfigExtensions.getLength() > 0) {
- processFacesConfigExtensions(facesConfigExtensions, namespace, documentInfos[i]);
+ processFacesConfigExtensions(facesConfigExtensions, namespace, documentInfo);
}
}
diff --git a/impl/src/main/java/com/sun/faces/config/processor/LifecycleConfigProcessor.java b/impl/src/main/java/com/sun/faces/config/processor/LifecycleConfigProcessor.java
index 939a4a49fe..fbb3157b21 100644
--- a/impl/src/main/java/com/sun/faces/config/processor/LifecycleConfigProcessor.java
+++ b/impl/src/main/java/com/sun/faces/config/processor/LifecycleConfigProcessor.java
@@ -61,7 +61,7 @@ public class LifecycleConfigProcessor extends AbstractConfigProcessor {
*
*/
private static final String PHASE_LISTENER = "phase-listener";
- private List appPhaseListeners;
+ private final List appPhaseListeners;
public LifecycleConfigProcessor() {
appPhaseListeners = new CopyOnWriteArrayList<>();
@@ -73,12 +73,12 @@ public LifecycleConfigProcessor() {
public void process(ServletContext servletContext, FacesContext facesContext, DocumentInfo[] documentInfos) throws Exception {
LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- for (int i = 0; i < documentInfos.length; i++) {
+ for (DocumentInfo documentInfo : documentInfos) {
if (LOGGER.isLoggable(FINE)) {
- LOGGER.log(FINE, format("Processing lifecycle elements for document: ''{0}''", documentInfos[i].getSourceURI()));
+ LOGGER.log(FINE, format("Processing lifecycle elements for document: ''{0}''", documentInfo.getSourceURI()));
}
- Document document = documentInfos[i].getDocument();
+ Document document = documentInfo.getDocument();
String namespace = document.getDocumentElement().getNamespaceURI();
NodeList lifecycles = document.getElementsByTagNameNS(namespace, LIFECYCLE);
diff --git a/impl/src/main/java/com/sun/faces/context/AjaxNoAjaxExceptionHandler.java b/impl/src/main/java/com/sun/faces/context/AjaxNoAjaxExceptionHandler.java
index c397d3a113..b1690966ac 100644
--- a/impl/src/main/java/com/sun/faces/context/AjaxNoAjaxExceptionHandler.java
+++ b/impl/src/main/java/com/sun/faces/context/AjaxNoAjaxExceptionHandler.java
@@ -22,7 +22,7 @@
public class AjaxNoAjaxExceptionHandler extends ExceptionHandlerWrapper {
- private AjaxExceptionHandlerImpl ajaxExceptionHandlerImpl;
+ private final AjaxExceptionHandlerImpl ajaxExceptionHandlerImpl;
public AjaxNoAjaxExceptionHandler(AjaxExceptionHandlerImpl ajaxExceptionHandlerImpl, ExceptionHandlerImpl exceptionHandlerImpl) {
super(exceptionHandlerImpl);
diff --git a/impl/src/main/java/com/sun/faces/context/ExceptionHandlerImpl.java b/impl/src/main/java/com/sun/faces/context/ExceptionHandlerImpl.java
index 708ef57385..551c6b9961 100644
--- a/impl/src/main/java/com/sun/faces/context/ExceptionHandlerImpl.java
+++ b/impl/src/main/java/com/sun/faces/context/ExceptionHandlerImpl.java
@@ -56,7 +56,7 @@ public class ExceptionHandlerImpl extends ExceptionHandler {
private LinkedList unhandledExceptions;
private LinkedList handledExceptions;
private ExceptionQueuedEvent handled;
- private boolean errorPagePresent;
+ private final boolean errorPagePresent;
// ------------------------------------------------------------ Constructors
@@ -209,7 +209,7 @@ private void throwIt(FacesContext ctx, FacesException fe) {
LOGGER.log(Level.INFO, "Exception when handling error trying to reset the response.", wrapped);
}
}
- if (null != wrapped && wrapped instanceof FacesFileNotFoundException) {
+ if (wrapped instanceof FacesFileNotFoundException) {
extContext.setResponseStatus(404);
} else {
extContext.setResponseStatus(500);
@@ -225,7 +225,7 @@ private void throwIt(FacesContext ctx, FacesException fe) {
if (isDevelopment) {
// store the view root where the exception occurred into the
// request scope so that the error page can display that component
- // tree and not the one rendering the errorpage
+ // tree and not the one rendering the error page
ctx.getExternalContext().getRequestMap().put("com.sun.faces.error.view", ctx.getViewRoot());
}
throw fe;
diff --git a/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java b/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
index 2d650e03cf..6fc2bad1aa 100644
--- a/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
+++ b/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
@@ -65,7 +65,7 @@
public class PartialViewContextImpl extends PartialViewContext {
// Log instance for this class
- private static Logger LOGGER = FacesLogger.CONTEXT.getLogger();
+ private static final Logger LOGGER = FacesLogger.CONTEXT.getLogger();
private boolean released;
@@ -161,7 +161,7 @@ public void setRenderAll(boolean renderAll) {
@Override
public boolean isResetValues() {
Object value = PARTIAL_RESET_VALUES_PARAM.getValue(ctx);
- return null != value && "true".equals(value) ? true : false;
+ return Boolean.TRUE.toString().equals(value);
}
@Override
@@ -564,8 +564,8 @@ private void assertNotReleased() {
private static class PhaseAwareVisitCallback implements VisitCallback {
- private PhaseId curPhase;
- private FacesContext ctx;
+ private final PhaseId curPhase;
+ private final FacesContext ctx;
private PhaseAwareVisitCallback(FacesContext ctx, PhaseId curPhase) {
this.ctx = ctx;
@@ -620,7 +620,7 @@ public VisitResult visit(VisitContext context, UIComponent comp) {
private static final class DelayedInitPartialResponseWriter extends PartialResponseWriter {
private ResponseWriter writer;
- private PartialViewContextImpl ctx;
+ private final PartialViewContextImpl ctx;
// -------------------------------------------------------- Constructors
diff --git a/impl/src/main/java/com/sun/faces/context/StringArrayValuesMap.java b/impl/src/main/java/com/sun/faces/context/StringArrayValuesMap.java
index 07293ff87d..5401eafd8e 100644
--- a/impl/src/main/java/com/sun/faces/context/StringArrayValuesMap.java
+++ b/impl/src/main/java/com/sun/faces/context/StringArrayValuesMap.java
@@ -36,11 +36,11 @@ public boolean containsValue(Object value) {
return false;
}
- Set entrySet = entrySet();
- for (Object anEntrySet : entrySet) {
- Map.Entry entry = (Map.Entry) anEntrySet;
+ Set> entrySet = entrySet();
+ for (Map.Entry entry : entrySet) {
+
// values will be arrays
- if (Arrays.equals((Object[]) value, (Object[]) entry.getValue())) {
+ if (Arrays.equals((Object[]) value, entry.getValue())) {
return true;
}
}
@@ -89,10 +89,9 @@ public int hashCode() {
protected int hashCode(Object someObject) {
int hashCode = 7 * someObject.hashCode();
- for (Object o : entrySet()) {
- Map.Entry entry = (Map.Entry) o;
+ for (Map.Entry entry : entrySet()) {
hashCode += entry.getKey().hashCode();
- hashCode += Arrays.hashCode((Object[]) entry.getValue());
+ hashCode += Arrays.hashCode(entry.getValue());
}
return hashCode;
}
diff --git a/impl/src/main/java/com/sun/faces/context/flash/ELFlash.java b/impl/src/main/java/com/sun/faces/context/flash/ELFlash.java
index 85a728229f..a85cf21975 100644
--- a/impl/src/main/java/com/sun/faces/context/flash/ELFlash.java
+++ b/impl/src/main/java/com/sun/faces/context/flash/ELFlash.java
@@ -116,7 +116,7 @@ public class ELFlash extends Flash {
private final boolean distributable;
- private ByteArrayGuardAESCTR guard;
+ private final ByteArrayGuardAESCTR guard;
//
@@ -315,7 +315,7 @@ public boolean isKeepMessages() {
@Override
public void setKeepMessages(boolean newValue) {
- loggingGetPhaseMapForWriting(false).put(CONSTANTS.KeepAllMessagesAttributeName.toString(), Boolean.valueOf(newValue));
+ loggingGetPhaseMapForWriting(false).put(CONSTANTS.KeepAllMessagesAttributeName.toString(), newValue);
}
diff --git a/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java b/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java
index 6609db3803..4cb5b2d839 100644
--- a/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java
+++ b/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java
@@ -89,7 +89,7 @@ public Object getValue(ELContext context, Object base, Object property) {
notNull("context", context);
- if (base != null && base instanceof UIComponent && UIComponent.isCompositeComponent((UIComponent) base) && property != null) {
+ if (base instanceof UIComponent && UIComponent.isCompositeComponent((UIComponent) base) && property != null) {
String propertyName = property.toString();
if (COMPOSITE_COMPONENT_ATTRIBUTES_NAME.equals(propertyName)) {
@@ -271,11 +271,11 @@ public Map getEvalMapFor(UIComponent c, FacesContext ctx) {
*/
private static final class ExpressionEvalMap implements Map, CompositeComponentExpressionHolder {
- private Map attributesMap;
+ private final Map attributesMap;
private PropertyDescriptor[] declaredAttributes;
private Map