You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2021/01/17 16:01:06 UTC
[commons-jcs] branch master updated: Simplify
This is an automated email from the ASF dual-hosted git repository.
tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
The following commit(s) were added to refs/heads/master by this push:
new d4e13e0 Simplify
new f5641dd Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-jcs.git
d4e13e0 is described below
commit d4e13e03b5a0eec4b0f238b2ab64dee29b020cbe
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Sun Jan 17 16:58:17 2021 +0100
Simplify
---
.../jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java | 2 +-
.../jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java | 2 +-
.../org/apache/commons/jcs3/utils/config/PropertySetter.java | 9 ++-------
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
index 899ce2c..2da700f 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java
@@ -158,7 +158,7 @@ public class LateralTCPListener<K, V>
shutdown = new AtomicBoolean(false);
ServerSocket serverSocket;
- if (host != null && host.length() > 0)
+ if (host != null && !host.isEmpty())
{
log.info( "Listening on {0}:{1}", host, port );
// Resolve host name
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
index acac70d..5c1e40d 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java
@@ -78,7 +78,7 @@ public class LateralTCPSender
final int po = Integer.parseInt( p1.substring( p1.indexOf( ":" ) + 1 ) );
log.debug( "h2 = {0}, po = {1}", h2, po );
- if ( h2.length() == 0 )
+ if ( h2.isEmpty() )
{
throw new IOException( "Cannot connect to invalid address [" + h2 + ":" + po + "]" );
}
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
index 1bf07ea..b40363e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/PropertySetter.java
@@ -25,7 +25,6 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.File;
import java.lang.reflect.Method;
-import java.util.Enumeration;
import java.util.Properties;
import org.apache.commons.jcs3.log.Log;
@@ -113,14 +112,11 @@ public class PropertySetter
{
final int len = prefix.length();
- for ( final Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); )
+ for (final String key : properties.stringPropertyNames())
{
- String key = (String) e.nextElement();
-
// handle only properties that start with the desired prefix.
if ( key.startsWith( prefix ) )
{
-
// ignore key if it contains dots after the prefix
if ( key.indexOf( '.', len + 1 ) > 0 )
{
@@ -130,9 +126,8 @@ public class PropertySetter
}
final String value = OptionConverter.findAndSubst( key, properties );
- key = key.substring( len );
- setProperty( key, value );
+ setProperty( key.substring( len ), value );
}
}