Skip to content

Commit

Permalink
Merge pull request #5136 from Emkas/dead-unused-code
Browse files Browse the repository at this point in the history
Remove unused/dead code
  • Loading branch information
BalusC authored Jun 26, 2022
2 parents a6b2ac5 + 8c4715f commit a2b535f
Show file tree
Hide file tree
Showing 22 changed files with 4 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ private class SetClientIdListener implements ComponentSystemEventListener {

private ContextualCompositeMethodExpression ccME;

public SetClientIdListener() {
}

public SetClientIdListener(ContextualCompositeMethodExpression ccME) {
this.ccME = ccME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,8 +33,6 @@
*/
final class DefaultFaceletCache extends FaceletCache<DefaultFacelet> {

private final static Logger LOGGER = FacesLogger.FACELETS_FACTORY.getLogger();

/**
* Constructor
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ public class HtmlResponseWriter extends ResponseWriter {
private static final char[] ESCAPEDSTART = ("&lt;" + 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 0 additions & 4 deletions impl/src/main/java/com/sun/faces/util/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V> {

// Log instance for this class
private static final Logger LOGGER = FacesLogger.UTIL.getLogger();

/**
* Factory interface for creating various cacheable objects.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions impl/src/test/java/com/sun/faces/mock/MockApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
11 changes: 4 additions & 7 deletions impl/src/test/java/com/sun/faces/util/TestUtil_local.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import junit.framework.TestCase;

import java.util.HashMap;
import java.util.Locale;

/**
* <B>TestUtil_local.java</B> is a class ...
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"));
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

public class UIComponentBaseAttachedStateTestCase extends TestCase {

private UIComponentBase component;
private MockFacesContext facesContext = null;
private MockServletContext servletContext;
private MockHttpServletRequest request;
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public void testPristine() {
@Override
public void testPropertiesInvalid() throws Exception {
super.testPropertiesInvalid();
UIGraphic graphic = (UIGraphic) component;
}

// --------------------------------------------------------- Support Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -134,13 +130,6 @@ public void run() {
}
}

private void clearDescriptors() throws Exception {
Field descriptorsField = UIComponentBase.class.getDeclaredField("descriptors");
descriptorsField.setAccessible(true);
Map<Class<?>, Map<String, PropertyDescriptor>> descriptors = (Map<Class<?>, Map<String, PropertyDescriptor>>) descriptorsField.get(null);
descriptors.clear();
}

@Override
public void testAttributesTransparency() {
super.testAttributesTransparency();
Expand Down

0 comments on commit a2b535f

Please sign in to comment.