From 8c4715fb450a2d5c53f24b7bf80f343bb2eea69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Sier=C5=BC=C4=99ga?= Date: Sun, 12 Jun 2022 23:12:28 +0200 Subject: [PATCH] Remove unused/dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emil Sierżęga --- .../com/sun/faces/application/WebPrintWriter.java | 4 ---- .../el/CompositeComponentAttributesELResolver.java | 5 ----- .../faces/facelets/compiler/CompilationManager.java | 2 -- .../el/ContextualCompositeMethodExpression.java | 3 --- .../sun/faces/facelets/impl/DefaultFaceletCache.java | 4 ---- .../sun/faces/facelets/tag/CompositeTagLibrary.java | 1 - .../facelets/tag/composite/InterfaceHandler.java | 4 ---- .../facelets/tag/faces/FacesComponentTagLibrary.java | 4 ---- .../com/sun/faces/facelets/util/ReflectionUtil.java | 6 ------ .../renderkit/html_basic/HtmlResponseWriter.java | 3 --- .../java/com/sun/faces/util/ByteArrayGuardAESCTR.java | 1 - impl/src/main/java/com/sun/faces/util/Cache.java | 4 ---- .../jakarta/faces/CurrentThreadToServletContext.java | 3 --- .../faces/event/MethodExpressionActionListener.java | 4 ---- .../test/java/com/sun/faces/mock/MockApplication.java | 3 --- .../com/sun/faces/mock/MockResultSetMetaData.java | 3 --- .../test/java/com/sun/faces/util/TestUtil_local.java | 11 ++++------- .../jakarta/faces/component/UICommandTestCase.java | 4 ---- .../UIComponentBaseAttachedStateTestCase.java | 2 -- .../jakarta/faces/component/UIGraphicTestCase.java | 1 - .../java/jakarta/faces/component/UIInputTestCase.java | 2 -- .../faces/component/ValueHolderTestCaseBase.java | 11 ----------- 22 files changed, 4 insertions(+), 81 deletions(-) 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 ab4a85d55b..46753ab080 100644 --- a/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java +++ b/impl/src/main/java/com/sun/faces/application/WebPrintWriter.java @@ -69,10 +69,6 @@ public void close() throws IOException { // no-op } - protected NoOpWriter(Object lock) { - // no-op - } - @Override public void write(int c) throws IOException { // no-op 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 a2ef29353e..d8d015d1d6 100644 --- a/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java +++ b/impl/src/main/java/com/sun/faces/el/CompositeComponentAttributesELResolver.java @@ -28,10 +28,8 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import java.util.logging.Logger; import com.sun.faces.component.CompositeComponentStackManager; -import com.sun.faces.util.FacesLogger; import jakarta.el.ELContext; import jakarta.el.ELResolver; @@ -49,9 +47,6 @@ */ public class CompositeComponentAttributesELResolver extends ELResolver { - // Log instance for this class - private static final Logger LOGGER = FacesLogger.CONTEXT.getLogger(); - /** * Implicit object related only to the cc implicitObject. */ diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java index fe6969b678..beffb6f3f7 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java @@ -219,8 +219,6 @@ public void pushTag(Tag orig) { String[] qname = determineQName(t); t = trimAttributes(t); - boolean handled = false; - if (isTrimmed(qname[0], qname[1])) { if (log.isLoggable(Level.FINE)) { log.fine("Composition Found, Popping Parent Tags"); diff --git a/impl/src/main/java/com/sun/faces/facelets/el/ContextualCompositeMethodExpression.java b/impl/src/main/java/com/sun/faces/facelets/el/ContextualCompositeMethodExpression.java index 4e29fca2c0..ade1d118e3 100644 --- a/impl/src/main/java/com/sun/faces/facelets/el/ContextualCompositeMethodExpression.java +++ b/impl/src/main/java/com/sun/faces/facelets/el/ContextualCompositeMethodExpression.java @@ -249,9 +249,6 @@ private class SetClientIdListener implements ComponentSystemEventListener { private ContextualCompositeMethodExpression ccME; - public SetClientIdListener() { - } - public SetClientIdListener(ContextualCompositeMethodExpression ccME) { this.ccME = ccME; } diff --git a/impl/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java b/impl/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java index 605b725d3a..e53267c109 100644 --- a/impl/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java +++ b/impl/src/main/java/com/sun/faces/facelets/impl/DefaultFaceletCache.java @@ -20,11 +20,9 @@ import java.net.URL; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Logger; import com.sun.faces.util.ConcurrentCache; import com.sun.faces.util.ExpiringConcurrentCache; -import com.sun.faces.util.FacesLogger; import com.sun.faces.util.Util; import jakarta.faces.FacesException; @@ -35,8 +33,6 @@ */ final class DefaultFaceletCache extends FaceletCache { - private final static Logger LOGGER = FacesLogger.FACELETS_FACTORY.getLogger(); - /** * Constructor * diff --git a/impl/src/main/java/com/sun/faces/facelets/tag/CompositeTagLibrary.java b/impl/src/main/java/com/sun/faces/facelets/tag/CompositeTagLibrary.java index c86e80bfd7..f2843f8211 100644 --- a/impl/src/main/java/com/sun/faces/facelets/tag/CompositeTagLibrary.java +++ b/impl/src/main/java/com/sun/faces/facelets/tag/CompositeTagLibrary.java @@ -62,7 +62,6 @@ public CompositeTagLibrary(TagLibrary[] libraries) { */ @Override public boolean containsNamespace(String ns, Tag t) { - boolean result = true; for (int i = 0; i < libraries.length; i++) { if (libraries[i].containsNamespace(ns, null)) { return true; diff --git a/impl/src/main/java/com/sun/faces/facelets/tag/composite/InterfaceHandler.java b/impl/src/main/java/com/sun/faces/facelets/tag/composite/InterfaceHandler.java index dd42c4a571..52cb6c9d6f 100644 --- a/impl/src/main/java/com/sun/faces/facelets/tag/composite/InterfaceHandler.java +++ b/impl/src/main/java/com/sun/faces/facelets/tag/composite/InterfaceHandler.java @@ -23,12 +23,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.logging.Logger; import com.sun.faces.application.view.FaceletViewHandlingStrategy; import com.sun.faces.facelets.tag.TagHandlerImpl; import com.sun.faces.facelets.tag.faces.ComponentSupport; -import com.sun.faces.util.FacesLogger; import com.sun.faces.util.MessageUtils; import jakarta.el.ValueExpression; @@ -46,8 +44,6 @@ public class InterfaceHandler extends TagHandlerImpl { - private final Logger LOGGER = FacesLogger.TAGLIB.getLogger(); - private static final String[] ATTRIBUTES_DEV = { "displayName", "expert", "hidden", "preferred", "shortDescription", "name", "componentType" }; private static final PropertyHandlerManager INTERFACE_HANDLERS = PropertyHandlerManager.getInstance(ATTRIBUTES_DEV); diff --git a/impl/src/main/java/com/sun/faces/facelets/tag/faces/FacesComponentTagLibrary.java b/impl/src/main/java/com/sun/faces/facelets/tag/faces/FacesComponentTagLibrary.java index a8db535a6f..94050d5483 100644 --- a/impl/src/main/java/com/sun/faces/facelets/tag/faces/FacesComponentTagLibrary.java +++ b/impl/src/main/java/com/sun/faces/facelets/tag/faces/FacesComponentTagLibrary.java @@ -17,11 +17,9 @@ package com.sun.faces.facelets.tag.faces; import java.util.List; -import java.util.logging.Logger; import com.sun.faces.application.ApplicationAssociate; import com.sun.faces.application.annotation.FacesComponentUsage; -import com.sun.faces.util.FacesLogger; import com.sun.faces.util.Util; import jakarta.faces.FacesException; @@ -33,8 +31,6 @@ public class FacesComponentTagLibrary extends LazyTagLibrary { - private static final Logger LOGGER = FacesLogger.FACELETS_COMPONENT.getLogger(); - private ApplicationAssociate appAss; public FacesComponentTagLibrary(String ns) { diff --git a/impl/src/main/java/com/sun/faces/facelets/util/ReflectionUtil.java b/impl/src/main/java/com/sun/faces/facelets/util/ReflectionUtil.java index 14e61b836e..d0a578f2a4 100644 --- a/impl/src/main/java/com/sun/faces/facelets/util/ReflectionUtil.java +++ b/impl/src/main/java/com/sun/faces/facelets/util/ReflectionUtil.java @@ -23,8 +23,6 @@ import java.util.Arrays; import com.sun.faces.config.ConfigurationException; -import com.sun.faces.config.WebConfiguration; -import com.sun.faces.config.WebConfiguration.WebContextInitParameter; import com.sun.faces.util.ReflectionUtils; import com.sun.faces.util.Util; @@ -231,8 +229,4 @@ private static Class loadClass(String className, Object fallback, Class ex } - private static boolean isDevModeEnabled() { - WebConfiguration webconfig = WebConfiguration.getInstance(); - return webconfig != null && "Development".equals(webconfig.getOptionValue(WebContextInitParameter.JakartaFacesProjectStage)); - } } diff --git a/impl/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java b/impl/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java index 8697fcf8ce..bebbafe66b 100644 --- a/impl/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java +++ b/impl/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java @@ -160,9 +160,6 @@ public class HtmlResponseWriter extends ResponseWriter { private static final char[] ESCAPEDSTART = ("<" + BREAKCDATA + "![").toCharArray(); private static final char[] ESCAPEDEND = ("]" + BREAKCDATA + "]>").toCharArray(); - private static final int CLOSEBRACKET = ']'; - private static final int LT = '<'; - static final Pattern CDATA_START_SLASH_SLASH; static final Pattern CDATA_END_SLASH_SLASH; diff --git a/impl/src/main/java/com/sun/faces/util/ByteArrayGuardAESCTR.java b/impl/src/main/java/com/sun/faces/util/ByteArrayGuardAESCTR.java index 1ef181ffd4..dfdad60cd8 100644 --- a/impl/src/main/java/com/sun/faces/util/ByteArrayGuardAESCTR.java +++ b/impl/src/main/java/com/sun/faces/util/ByteArrayGuardAESCTR.java @@ -59,7 +59,6 @@ public final class ByteArrayGuardAESCTR { private static final Logger LOGGER = FacesLogger.RENDERKIT.getLogger(); private static final int KEY_LENGTH = 128; - private static final int IV_LENGTH = 16; private static final String KEY_ALGORITHM = "AES"; private static final String CIPHER_CODE = "AES/CTR/NoPadding"; diff --git a/impl/src/main/java/com/sun/faces/util/Cache.java b/impl/src/main/java/com/sun/faces/util/Cache.java index 5ab7b359f1..b2249f9bfa 100644 --- a/impl/src/main/java/com/sun/faces/util/Cache.java +++ b/impl/src/main/java/com/sun/faces/util/Cache.java @@ -18,16 +18,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.logging.Logger; /** * A concurrent caching mechanism. */ public class Cache { - // Log instance for this class - private static final Logger LOGGER = FacesLogger.UTIL.getLogger(); - /** * Factory interface for creating various cacheable objects. */ diff --git a/impl/src/main/java/jakarta/faces/CurrentThreadToServletContext.java b/impl/src/main/java/jakarta/faces/CurrentThreadToServletContext.java index 22ed881c05..4f02188633 100644 --- a/impl/src/main/java/jakarta/faces/CurrentThreadToServletContext.java +++ b/impl/src/main/java/jakarta/faces/CurrentThreadToServletContext.java @@ -27,15 +27,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.logging.Logger; import jakarta.faces.context.ExternalContext; import jakarta.faces.context.FacesContext; final class CurrentThreadToServletContext { - private static final Logger LOGGER = Logger.getLogger("jakarta.faces", "jakarta.faces.LogStrings"); - // Bug 20458755: This instance provides a method to look up the current FacesContext // that bypasses the additional check for the InitFacesContext introduced // by the fix for 20458755 diff --git a/impl/src/main/java/jakarta/faces/event/MethodExpressionActionListener.java b/impl/src/main/java/jakarta/faces/event/MethodExpressionActionListener.java index ba18597dfa..b77c6bf785 100644 --- a/impl/src/main/java/jakarta/faces/event/MethodExpressionActionListener.java +++ b/impl/src/main/java/jakarta/faces/event/MethodExpressionActionListener.java @@ -16,8 +16,6 @@ package jakarta.faces.event; -import java.util.logging.Logger; - import jakarta.el.ELContext; import jakarta.el.ELException; import jakarta.el.MethodExpression; @@ -36,8 +34,6 @@ public class MethodExpressionActionListener implements ActionListener, StateHolder { - private static final Logger LOGGER = Logger.getLogger("jakarta.faces.event", "jakarta.faces.LogStrings"); - // ------------------------------------------------------ Instance Variables private MethodExpression methodExpressionOneArg = null; diff --git a/impl/src/test/java/com/sun/faces/mock/MockApplication.java b/impl/src/test/java/com/sun/faces/mock/MockApplication.java index 347610a04c..ab5877ab39 100644 --- a/impl/src/test/java/com/sun/faces/mock/MockApplication.java +++ b/impl/src/test/java/com/sun/faces/mock/MockApplication.java @@ -61,7 +61,6 @@ import jakarta.faces.event.SystemEventListener; import jakarta.faces.event.SystemEventListenerHolder; import jakarta.faces.validator.Validator; -import jakarta.servlet.ServletContext; public class MockApplication extends Application { @@ -81,10 +80,8 @@ public MockApplication() { addConverter("jakarta.faces.Long", "jakarta.faces.convert.LongConverter"); addValidator("Length", "jakarta.faces.validator.LengthValidator"); - servletContext = new MockServletContext(); } - private ServletContext servletContext = null; private ActionListener actionListener = null; private static boolean processActionCalled = false; diff --git a/impl/src/test/java/com/sun/faces/mock/MockResultSetMetaData.java b/impl/src/test/java/com/sun/faces/mock/MockResultSetMetaData.java index 128f58ce95..cfad0ee596 100644 --- a/impl/src/test/java/com/sun/faces/mock/MockResultSetMetaData.java +++ b/impl/src/test/java/com/sun/faces/mock/MockResultSetMetaData.java @@ -37,7 +37,6 @@ public class MockResultSetMetaData implements ResultSetMetaData { * @param clazz Class whose properties we treat like columns */ public MockResultSetMetaData(Class clazz) throws SQLException { - this.clazz = clazz; try { descriptors = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); @@ -47,8 +46,6 @@ public MockResultSetMetaData(Class clazz) throws SQLException { } // ------------------------------------------------------ Instance Variables - // The Class whose properties we are treating as columns - private Class clazz = null; // The PropertyDescriptors for the Class we are wrapping private PropertyDescriptor descriptors[] = null; diff --git a/impl/src/test/java/com/sun/faces/util/TestUtil_local.java b/impl/src/test/java/com/sun/faces/util/TestUtil_local.java index 948c1b446c..9f6aa42223 100644 --- a/impl/src/test/java/com/sun/faces/util/TestUtil_local.java +++ b/impl/src/test/java/com/sun/faces/util/TestUtil_local.java @@ -20,7 +20,6 @@ import junit.framework.TestCase; import java.util.HashMap; -import java.util.Locale; /** * TestUtil_local.java is a class ... @@ -59,13 +58,11 @@ public TestUtil_local(String name) { // General Methods // public void testGetLocaleFromString() { - Locale result = null; - // positive tests - assertNotNull(result = Util.getLocaleFromString("ps")); - assertNotNull(result = Util.getLocaleFromString("tg_AF")); - assertNotNull(result = Util.getLocaleFromString("tk_IQ-Traditional")); - assertNotNull(result = Util.getLocaleFromString("tk-IQ_Traditional")); + assertNotNull(Util.getLocaleFromString("ps")); + assertNotNull(Util.getLocaleFromString("tg_AF")); + assertNotNull(Util.getLocaleFromString("tk_IQ-Traditional")); + assertNotNull(Util.getLocaleFromString("tk-IQ_Traditional")); try { Util.getLocaleFromString("aoeuhoentuhtnhtnhoaenhnhu"); diff --git a/impl/src/test/java/jakarta/faces/component/UICommandTestCase.java b/impl/src/test/java/jakarta/faces/component/UICommandTestCase.java index 74fbef998c..612846400f 100644 --- a/impl/src/test/java/jakarta/faces/component/UICommandTestCase.java +++ b/impl/src/test/java/jakarta/faces/component/UICommandTestCase.java @@ -50,8 +50,6 @@ public UICommandTestCase(String name) { super(name); } - private static Class actionListenerSignature[] = { ActionEvent.class }; - // ---------------------------------------------------- Overall Test Methods // Set up instance variables required by this test case. @Override @@ -177,7 +175,6 @@ public void testEventsMixedImmediate() { public void testListeners() { CommandTestImpl command = new CommandTestImpl(); - ActionListenerTestImpl listener = null; command.addActionListener(new ActionListenerTestImpl("ARV0")); command.addActionListener(new ActionListenerTestImpl("ARV1")); @@ -197,7 +194,6 @@ public void testListeners() { public void testEmptyListeners() { CommandTestImpl command = new CommandTestImpl(); - ActionListenerTestImpl listener = null; // No listeners added, should be empty ActionListener listeners[] = command.getActionListeners(); diff --git a/impl/src/test/java/jakarta/faces/component/UIComponentBaseAttachedStateTestCase.java b/impl/src/test/java/jakarta/faces/component/UIComponentBaseAttachedStateTestCase.java index d9de276184..fcf2cbafb9 100644 --- a/impl/src/test/java/jakarta/faces/component/UIComponentBaseAttachedStateTestCase.java +++ b/impl/src/test/java/jakarta/faces/component/UIComponentBaseAttachedStateTestCase.java @@ -40,7 +40,6 @@ public class UIComponentBaseAttachedStateTestCase extends TestCase { - private UIComponentBase component; private MockFacesContext facesContext = null; private MockServletContext servletContext; private MockHttpServletRequest request; @@ -58,7 +57,6 @@ public static Test suite() { @Override public void setUp() throws Exception { super.setUp(); - component = new UIOutput(); facesContext = new MockFacesContext(); servletContext = new MockServletContext(); diff --git a/impl/src/test/java/jakarta/faces/component/UIGraphicTestCase.java b/impl/src/test/java/jakarta/faces/component/UIGraphicTestCase.java index cf185a3db3..e3399e052f 100644 --- a/impl/src/test/java/jakarta/faces/component/UIGraphicTestCase.java +++ b/impl/src/test/java/jakarta/faces/component/UIGraphicTestCase.java @@ -100,7 +100,6 @@ public void testPristine() { @Override public void testPropertiesInvalid() throws Exception { super.testPropertiesInvalid(); - UIGraphic graphic = (UIGraphic) component; } // --------------------------------------------------------- Support Methods diff --git a/impl/src/test/java/jakarta/faces/component/UIInputTestCase.java b/impl/src/test/java/jakarta/faces/component/UIInputTestCase.java index 02b1d58383..964ff2fbe1 100644 --- a/impl/src/test/java/jakarta/faces/component/UIInputTestCase.java +++ b/impl/src/test/java/jakarta/faces/component/UIInputTestCase.java @@ -166,7 +166,6 @@ public void testEventsMixed() { // Test listener registration and deregistration public void testListeners() { InputTestImpl input = new InputTestImpl(); - ValueChangeListenerTestImpl listener = null; input.addValueChangeListener(new ValueChangeListenerTestImpl("ARV0")); input.addValueChangeListener(new ValueChangeListenerTestImpl("ARV1")); @@ -184,7 +183,6 @@ public void testListeners() { // Test empty listener list public void testEmptyListeners() { InputTestImpl input = new InputTestImpl(); - ValueChangeListenerTestImpl listener = null; // No listeners added, should be empty ValueChangeListener listeners[] = input.getValueChangeListeners(); diff --git a/impl/src/test/java/jakarta/faces/component/ValueHolderTestCaseBase.java b/impl/src/test/java/jakarta/faces/component/ValueHolderTestCaseBase.java index 44c0dff667..552ac4797a 100644 --- a/impl/src/test/java/jakarta/faces/component/ValueHolderTestCaseBase.java +++ b/impl/src/test/java/jakarta/faces/component/ValueHolderTestCaseBase.java @@ -16,10 +16,6 @@ package jakarta.faces.component; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Field; -import java.util.Map; - import jakarta.faces.component.html.HtmlInputText; import jakarta.faces.convert.LongConverter; import jakarta.faces.convert.NumberConverter; @@ -134,13 +130,6 @@ public void run() { } } - private void clearDescriptors() throws Exception { - Field descriptorsField = UIComponentBase.class.getDeclaredField("descriptors"); - descriptorsField.setAccessible(true); - Map, Map> descriptors = (Map, Map>) descriptorsField.get(null); - descriptors.clear(); - } - @Override public void testAttributesTransparency() { super.testAttributesTransparency();