This is an automated email from the ASF dual-hosted git repository. klund pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git
commit cafe93b70f108727d21d42c5cbdf66da7bfb41ef Author: Kirk Lund <kl...@apache.org> AuthorDate: Fri Dec 10 11:28:17 2021 -0800 GEODE-9758: Move ClassUtils to geode-common (#7166) (cherry picked from commit b6fca291378a1bc334b0f9927c899a1892442939) --- .../src/main/java/org/apache/geode/internal/lang/ClassUtils.java | 2 +- .../java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java | 8 ++++---- .../main/java/org/apache/geode/distributed/AbstractLauncher.java | 2 +- .../java/org/apache/geode/internal/InternalDataSerializer.java | 2 +- .../InternalDataSerializerSerializationAcceptlistTest.java | 2 +- .../geode/internal/InternalDataSerializerShiroAcceptListTest.java | 2 +- .../internal/cli/commands/DescribeDiskStoreCommand.java | 2 +- .../java/org/apache/geode/management/internal/cli/shell/Gfsh.java | 2 +- .../java/org/apache/geode/codeAnalysis/CompiledClassUtils.java | 8 +++++--- .../internal/serialization/SerializationDependenciesTest.java | 3 ++- .../java/org/apache/geode/rest/internal/web/util/NumberUtils.java | 2 +- 11 files changed, 19 insertions(+), 16 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java b/geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java similarity index 99% rename from geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java rename to geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java index 82bae79..82198dd 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java +++ b/geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java @@ -13,7 +13,7 @@ * the License. */ -package org.apache.geode.internal.lang; +package org.apache.geode.internal.lang.utils; import org.apache.geode.annotations.Immutable; diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java b/geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java similarity index 97% rename from geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java rename to geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java index ad118ef..49e3714 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java +++ b/geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java @@ -12,7 +12,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.lang; +package org.apache.geode.internal.lang.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -22,20 +22,20 @@ import static org.junit.Assert.assertTrue; import java.util.Calendar; import java.util.Date; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; - /** * The ClassUtilsJUnitTest class is a test suite with test cases to test the contract and * functionality of the ClassUtils class. * <p/> * - * @see org.apache.geode.internal.lang.ClassUtils + * @see ClassUtils * @see org.junit.Assert * @see org.junit.Test * @since GemFire 7.0 */ -public class ClassUtilsJUnitTest { +public class ClassUtilsTest { @Test public void testForNameWithExistingClass() { diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java index c91e73a..8bac461 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java @@ -18,9 +18,9 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.join; import static org.apache.commons.lang3.StringUtils.lowerCase; import static org.apache.geode.distributed.ConfigurationProperties.NAME; -import static org.apache.geode.internal.lang.ClassUtils.forName; import static org.apache.geode.internal.lang.StringUtils.defaultString; import static org.apache.geode.internal.lang.SystemUtils.CURRENT_DIRECTORY; +import static org.apache.geode.internal.lang.utils.ClassUtils.forName; import java.io.File; import java.io.FileReader; diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java index 08f5de9..66241ba 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java @@ -103,7 +103,7 @@ import org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage; import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID; import org.apache.geode.internal.cache.tier.sockets.OldClientSupportService; import org.apache.geode.internal.cache.tier.sockets.Part; -import org.apache.geode.internal.lang.ClassUtils; +import org.apache.geode.internal.lang.utils.ClassUtils; import org.apache.geode.internal.logging.log4j.LogMarker; import org.apache.geode.internal.serialization.BasicSerializable; import org.apache.geode.internal.serialization.DSCODE; diff --git a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java index b460888..6242203 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java @@ -17,7 +17,7 @@ package org.apache.geode.internal; import static java.util.Collections.emptySet; import static org.apache.geode.distributed.internal.DistributionConfig.SERIALIZABLE_OBJECT_FILTER_NAME; import static org.apache.geode.distributed.internal.DistributionConfig.VALIDATE_SERIALIZABLE_OBJECTS_NAME; -import static org.apache.geode.internal.lang.ClassUtils.isClassAvailable; +import static org.apache.geode.internal.lang.utils.ClassUtils.isClassAvailable; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; import static org.junit.Assume.assumeTrue; diff --git a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java index 55bb9fe..d368a10b 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java @@ -16,7 +16,7 @@ package org.apache.geode.internal; import static java.util.Collections.emptySet; import static org.apache.geode.distributed.internal.DistributionConfig.VALIDATE_SERIALIZABLE_OBJECTS_NAME; -import static org.apache.geode.internal.lang.ClassUtils.isClassAvailable; +import static org.apache.geode.internal.lang.utils.ClassUtils.isClassAvailable; import static org.apache.geode.internal.serialization.Version.CURRENT; import static org.junit.Assume.assumeTrue; diff --git a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java index 688d541..2b5c72e 100644 --- a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java +++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java @@ -23,7 +23,7 @@ import org.springframework.shell.core.annotation.CliOption; import org.apache.geode.cache.execute.ResultCollector; import org.apache.geode.distributed.DistributedMember; -import org.apache.geode.internal.lang.ClassUtils; +import org.apache.geode.internal.lang.utils.ClassUtils; import org.apache.geode.management.cli.CliMetaData; import org.apache.geode.management.cli.ConverterHint; import org.apache.geode.management.cli.GfshCommand; diff --git a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java index 7c47f23..444cf01 100755 --- a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java +++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java @@ -46,7 +46,7 @@ import org.springframework.shell.event.ShellStatus.Status; import org.apache.geode.annotations.internal.MakeNotStatic; import org.apache.geode.annotations.internal.MutableForTesting; import org.apache.geode.internal.GemFireVersion; -import org.apache.geode.internal.lang.ClassUtils; +import org.apache.geode.internal.lang.utils.ClassUtils; import org.apache.geode.internal.logging.Banner; import org.apache.geode.internal.process.signal.AbstractSignalNotificationHandler; import org.apache.geode.internal.serialization.Version; diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java index c7e2d27..a82e80d 100644 --- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java +++ b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java @@ -14,6 +14,8 @@ */ package org.apache.geode.codeAnalysis; +import static org.apache.commons.lang3.StringUtils.isBlank; + import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -301,11 +303,11 @@ public class CompiledClassUtils { String line; while ((line = in.readLine()) != null) { line = line.trim(); - if (line.startsWith("#") || line.startsWith("//")) { + if (isBlank(line) || line.startsWith("#") || line.startsWith("//")) { // comment line - } else { - result.add(new ClassAndVariableDetails(line)); + continue; } + result.add(new ClassAndVariableDetails(line)); } return result; } diff --git a/geode-serialization/src/test/java/org/apache/geode/internal/serialization/SerializationDependenciesTest.java b/geode-serialization/src/test/java/org/apache/geode/internal/serialization/SerializationDependenciesTest.java index 199cb0f..3806564 100644 --- a/geode-serialization/src/test/java/org/apache/geode/internal/serialization/SerializationDependenciesTest.java +++ b/geode-serialization/src/test/java/org/apache/geode/internal/serialization/SerializationDependenciesTest.java @@ -43,6 +43,7 @@ public class SerializationDependenciesTest { resideInAPackage("org.apache.geode.internal.serialization..") .or(not(resideInAPackage("org.apache.geode.."))) .or(resideInAPackage("org.apache.geode.annotations..")) - .or(resideInAPackage("org.apache.geode.logging..")) + .or(resideInAPackage("org.apache.geode.internal.lang.utils..")) + .or(resideInAPackage("org.apache.geode.logging.internal.log4j.api..")) .or(resideInAPackage("org.apache.geode.test.."))); } diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/NumberUtils.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/NumberUtils.java index 72b4d41..6fcfcfc 100644 --- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/NumberUtils.java +++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/NumberUtils.java @@ -17,7 +17,7 @@ package org.apache.geode.rest.internal.web.util; import org.springframework.util.StringUtils; -import org.apache.geode.internal.lang.ClassUtils; +import org.apache.geode.internal.lang.utils.ClassUtils; /** * The NumberUtils class is a utility class for working with numbers.