Skip to content

Commit

Permalink
Merge pull request #3829 from hansva/main
Browse files Browse the repository at this point in the history
code cleanup, fixes #3828 and #3827
  • Loading branch information
hansva authored Apr 19, 2024
2 parents 29ca714 + 7cbb052 commit e969c04
Show file tree
Hide file tree
Showing 196 changed files with 75 additions and 291 deletions.
1 change: 0 additions & 1 deletion core/src/main/java/org/apache/hop/core/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,6 @@ public static String getMACAddress() throws Exception {
String mac = "none";
String os = getSystemOs();
String s = "";
@SuppressWarnings("unused")
boolean errorOccured = false;
if (os.equalsIgnoreCase("Windows NT")
|| os.equalsIgnoreCase("Windows 2000")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// CHECKSTYLE:EmptyBlock:OFF
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// CHECKSTYLE:FileLength:OFF
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.core.database;

import org.apache.commons.lang.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public FileObject[] findFiles(FileSelector arg0) throws FileSystemException {
}

@Override
public void findFiles(FileSelector arg0, boolean arg1, @SuppressWarnings("rawtypes") List arg2)
public void findFiles(FileSelector arg0, boolean arg1, List arg2)
throws FileSystemException {
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ protected int hash(Object key) {
}
}

@SuppressWarnings("unchecked")
public List<byte[]> getKeys() {
List<byte[]> rtn = new ArrayList<>(this.size());
Set<byte[]> kSet = this.keySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ private String createSupplemantalKey(String pluginName, String id) {
* @return The instantiated class
* @throws HopPluginException In case there was a class loading problem somehow
*/
@SuppressWarnings("unchecked")
public <T> T loadClass(IPlugin plugin, Class<T> pluginClass) throws HopPluginException {
if (plugin == null) {
throw new HopPluginException(
Expand Down Expand Up @@ -795,7 +794,6 @@ public RowBuffer getPluginInformation(Class<? extends IPluginType> pluginType)
* @return the name of the class
* @throws HopPluginException In case there is something wrong
*/
@SuppressWarnings("unchecked")
public <T> T getClass(IPlugin plugin, String className) throws HopPluginException {
try {
if (plugin.isNativePlugin()) {
Expand Down Expand Up @@ -843,7 +841,6 @@ public <T> T getClass(IPlugin plugin, String className) throws HopPluginExceptio
* @return the name of the class
* @throws HopPluginException In case there is something wrong
*/
@SuppressWarnings("unchecked")
public <T> T getClass(IPlugin plugin, T classType) throws HopPluginException {
String className = plugin.getClassMap().get(classType);
if (className == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// CHECKSTYLE:FileLength:OFF
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down Expand Up @@ -4911,7 +4910,6 @@ public void setIgnoreWhitespace(boolean ignoreWhitespace) {
this.ignoreWhitespace = ignoreWhitespace;
}

@SuppressWarnings("fallthrough")
@Override
public IValueMeta getValueFromSqlType(
IVariables variables,
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/org/apache/hop/core/util/DateDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class DateDetector {

private static final String LOCALE_en_US = "en_US";

@SuppressWarnings("serial")
static final BidiMap<String, String> DATE_FORMAT_TO_REGEXPS_US =
new DualHashBidiMap<String, String>() {
{
Expand Down Expand Up @@ -109,7 +108,6 @@ public class DateDetector {
}
};

@SuppressWarnings("serial")
static final BidiMap DATE_FORMAT_TO_REGEXPS =
new DualHashBidiMap() {
{
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/org/apache/hop/laf/LafDelegate.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private void init() {
* @param classname
* @return
*/
@SuppressWarnings("unchecked")
public E newHandlerInstance(String classname) throws ClassNotFoundException {
E h = null;
Class<E> c = null;
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/org/apache/hop/laf/LafFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class LafFactory {
}
}

@SuppressWarnings("unchecked")
protected static synchronized <V extends IHandler> LafDelegate<V> getDelegate(Class<V> handler) {
LafDelegate<V> l = (LafDelegate<V>) delegateRegistry.get(handler);
if (l == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class ConcurrencyTestRunner<M, B> {
* @param condition stop condition
* @throws Exception exception
*/
@SuppressWarnings("unchecked")
static void runAndCheckNoExceptionRaised(
List<? extends Callable<?>> monitoredTasks,
List<? extends Callable<?>> backgroundTasks,
Expand Down Expand Up @@ -137,7 +136,6 @@ void runConcurrentTest() throws Exception {

for (int i = 0; i < background.size(); i++) {
Future<? extends B> future = background.get(i);
// CHECKSTYLE IGNORE EmptyBlock FOR NEXT 3 LINES
while (!future.isDone()) {
// wait: condition flag is cleared, thus background tasks must complete by convention
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@SuppressWarnings("deprecation")
public class DatabaseTest {

@ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class MetricsDurationTest {
@ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment();

@Test
@SuppressWarnings("deprecation")
public void test() {
Date startDate = new Date((2016 - 1900), Calendar.JANUARY, 10);
Long duration = Long.valueOf(4L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import static org.junit.Assert.fail;

/** Test functionality in ValueMeta */
@SuppressWarnings("deprecation")
public class ValueMetaTest {
@ClassRule public static RestoreHopEnvironment env = new RestoreHopEnvironment();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,6 @@ private static void assertSignum(String msg, int expected, int actual) {
}
}

@SuppressWarnings("deprecation")
private static class ConfigurableMeta extends ValueMetaString {
private boolean nullsAndEmptyAreDifferent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public void testinItializeVariablesFrom() {
final Variables variablesMock = mock(Variables.class);
doCallRealMethod().when(variablesMock).initializeFrom(any(IVariables.class));

@SuppressWarnings("unchecked")
final Map<String, String> propertiesMock = mock(Map.class);
when(variablesMock.getProperties()).thenReturn(propertiesMock);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public synchronized boolean containsKey(Object key) {
return storageMap.containsKey(key);
}

@SuppressWarnings("unchecked")
@Override
public synchronized Enumeration<Object> elements() {
return (Enumeration<Object>) IteratorUtils.asEnumeration(storageMap.values().iterator());
Expand All @@ -150,7 +149,6 @@ public synchronized Object getOrDefault(Object key, Object defaultValue) {
return storageMap.getOrDefault(key, defaultValue);
}

@SuppressWarnings("unchecked")
@Override
public synchronized Enumeration<Object> keys() {
return (Enumeration<Object>) IteratorUtils.asEnumeration(storageMap.keySet().iterator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public <ReturnType, ConsumedType> void registerConsumerClass(
for (Entry<Class<?>, IAuthenticationConsumerFactory<?, ?, ?>> entry :
createTypeMap.entrySet()) {
for (IAuthenticationProvider provider : authenticationProviders) {
@SuppressWarnings("unchecked")
IAuthenticationPerformer<ReturnType, CreateArgType> authenticationPerformer =
(IAuthenticationPerformer<ReturnType, CreateArgType>)
authenticationPerformerFactory.create(provider, entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public ClassloaderBridgingAuthenticationPerformer(
this.authenticationConsumerFactory = authenticationConsumerFactory;
}

@SuppressWarnings("unchecked")
@Override
public ReturnType perform(CreateArgType consumerCreateArg)
throws AuthenticationConsumptionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class DefaultAuthenticationConsumerFactory
private final Class<Object> returnType;
private final Class<Object> createArgType;

@SuppressWarnings("unchecked")
public DefaultAuthenticationConsumerFactory(Class<?> consumerClass)
throws AuthenticationFactoryException {
Constructor<?>[] constructors = consumerClass.getConstructors();
Expand Down Expand Up @@ -97,7 +96,6 @@ public Class<Object> getCreateArgType() {
return createArgType;
}

@SuppressWarnings("unchecked")
@Override
public IAuthenticationConsumer<Object, Object> create(Object createArg) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

public class DefaultAuthenticationPerformerFactory implements IAuthenticationPerformerFactory {

@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public <ReturnType, CreateArgType, ConsumedType>
IAuthenticationPerformer<ReturnType, CreateArgType> create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public LoginContextInvocationHandler(
this.interfacesToDelegate = interfacesToDelegate;
}

@SuppressWarnings("unchecked")
public static <T> T forObject(
T delegate, LoginContext loginContext, Set<Class<?>> interfacesToDelegate) {
return (T)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public Object getPropVal(Object root, String propName) {
return getPropVal(root, propName, beanInfos);
}

@SuppressWarnings("unchecked")
private Object getPropVal(Object obj, String propName, Queue<BeanLevelInfo> beanInfos) {
BeanLevelInfo info = beanInfos.remove();
if (beanInfos.isEmpty()) {
Expand Down Expand Up @@ -423,7 +422,6 @@ private Object checkArray(BeanLevelInfo s, Object obj, int index) throws Excepti
}

private List<Object> extendList(BeanLevelInfo s, Object obj, int newSize) throws Exception {
@SuppressWarnings("unchecked")
List<Object> existList = (List<Object>) s.field.get(obj);
if (existList == null) {
existList = new ArrayList<>();
Expand All @@ -437,7 +435,6 @@ private List<Object> extendList(BeanLevelInfo s, Object obj, int newSize) throws
}

private List<Object> checkList(BeanLevelInfo s, Object obj, int index) throws Exception {
@SuppressWarnings("unchecked")
List<Object> existList = (List<Object>) s.field.get(obj);
if (existList == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class AddClosureArrayList<T> extends ArrayList<T> implements Closure {
* @see org.apache.commons.collections.Closure#execute(java.lang.Object)
*/
@Override
@SuppressWarnings("unchecked")
public void execute(final Object input) {
this.add((T) input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
public class ExecutionDataSetMetaDeserializer
extends JsonDeserializer<Map<String, ExecutionDataSetMeta>> {
@Override
@SuppressWarnings("unchecked")
public Map<String, ExecutionDataSetMeta> deserialize(
JsonParser parser, DeserializationContext context) throws IOException, JacksonException {
JsonDeserializer<Object> deserializer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public ExecutionDataSamplerBase(ExecutionDataSamplerBase<Store> base) {
@Override
public abstract Store createSamplerStore(ExecutionDataSamplerMeta samplerMeta);

@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
1 change: 0 additions & 1 deletion engine/src/main/java/org/apache/hop/pipeline/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.pipeline;

import org.apache.commons.lang.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.pipeline;

import com.google.common.annotations.VisibleForTesting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.pipeline.transform;

import com.google.common.annotations.VisibleForTesting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public BaseTransformMeta() {
}

@Override
@SuppressWarnings({"unchecked"})
public ITransform createTransform(
TransformMeta transformMeta,
ITransformData data,
Expand Down Expand Up @@ -120,7 +119,6 @@ public ITransform createTransform(
}

@Override
@SuppressWarnings({"unchecked"})
public ITransformData createTransformData() {
try {
Type[] parameterizedTypes = getParameterizedTypes(getClass());
Expand Down
1 change: 0 additions & 1 deletion engine/src/main/java/org/apache/hop/workflow/Workflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.workflow;

import org.apache.commons.vfs2.FileName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

// CHECKSTYLE:FileLength:OFF
package org.apache.hop.workflow;

import org.apache.commons.lang.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public void init(ServletConfig config) throws ServletException {
}

// Servlets configured in web.xml take precedence to those discovered during plugin scan
@SuppressWarnings("unchecked")
Enumeration<String> initParameterNames = config.getInitParameterNames();
while (initParameterNames.hasMoreElements()) {
final String paramName = initParameterNames.nextElement();
Expand Down
2 changes: 0 additions & 2 deletions engine/src/test/java/org/apache/hop/base/LoadSaveBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,12 @@ public T createMeta() {
}
}

@SuppressWarnings({"unchecked"})
protected Map<String, IFieldLoadSaveValidator<?>> createValidatorMapAndInvokeSetters(
List<String> attributes, T metaToSave) {
Map<String, IFieldLoadSaveValidator<?>> validatorMap = new HashMap<>();
metadataProvider = new MemoryMetadataProvider();
for (String attribute : attributes) {
IGetter<?> getter = manipulator.getGetter(attribute);
@SuppressWarnings("rawtypes")
ISetter setter = manipulator.getSetter(attribute);
IFieldLoadSaveValidator<?> validator = fieldLoadSaveValidatorFactory.createValidator(getter);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public void fiveShufflersAgainstTenSearchers() throws Exception {
ConcurrencyTestRunner.runAndCheckNoExceptionRaised(shufflers, searchers, condition);
}

@SuppressWarnings("unchecked")
@Test
public void addRemoveSearch() throws Exception {
final int addersAmount = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public class WorkflowTrackerConcurrencyTest {

private static final int jobsLimit = 20;

@SuppressWarnings("ConstantConditions")
@BeforeClass
public static void setUp() {
// a guarding check for tests' parameters
Expand Down
Loading

0 comments on commit e969c04

Please sign in to comment.