You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ab...@apache.org on 2015/11/28 07:14:37 UTC
[1/9] incubator-geode git commit: GEODE-584: Removes Assert class
Repository: incubator-geode
Updated Branches:
refs/heads/develop 6e252309e -> b8fb18a5f
GEODE-584: Removes Assert class
Changes uses of .../cli/util/spring/Assert to spring-core library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0d47dd15
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0d47dd15
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0d47dd15
Branch: refs/heads/develop
Commit: 0d47dd1513eb97d46e7f6085195b5b2f599387d7
Parents: bc12784
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 20 13:16:31 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 20 13:16:31 2015 -0800
----------------------------------------------------------------------
.../internal/cli/converters/DirConverter.java | 2 +-
.../internal/cli/parser/GfshMethodTarget.java | 3 +-
.../cli/remote/RemoteExecutionStrategy.java | 2 +-
.../cli/shell/GfshExecutionStrategy.java | 2 +-
.../internal/cli/util/CommentSkipHelper.java | 2 +-
.../internal/cli/util/spring/Assert.java | 35 --------------------
6 files changed, 6 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/DirConverter.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/DirConverter.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/DirConverter.java
index 7778917..17a6130 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/DirConverter.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/converters/DirConverter.java
@@ -22,11 +22,11 @@ import java.util.List;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.MethodTarget;
import org.springframework.shell.support.util.FileUtils;
+import org.springframework.util.Assert;
import com.gemstone.gemfire.management.cli.ConverterHint;
import com.gemstone.gemfire.management.internal.cli.MultipleValueAdapter;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
-import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
/**
* @author Nikhil Jadhav
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
index 0802dab..87b9569 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
@@ -18,7 +18,8 @@ package com.gemstone.gemfire.management.internal.cli.parser;
import java.lang.reflect.Method;
-import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
+import org.springframework.util.Assert;
+
import com.gemstone.gemfire.management.internal.cli.util.spring.ObjectUtils;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
index ffa9a5c..33c2f8b 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
@@ -19,6 +19,7 @@ package com.gemstone.gemfire.management.internal.cli.remote;
import java.lang.reflect.Method;
import org.springframework.shell.event.ParseResult;
+import org.springframework.util.Assert;
import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
@@ -34,7 +35,6 @@ import com.gemstone.gemfire.management.internal.cli.GfshParseResult;
import com.gemstone.gemfire.management.internal.cli.LogWrapper;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
-import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
index 7f0c4b9..a51c763 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
@@ -24,6 +24,7 @@ import java.util.Map;
import org.springframework.shell.core.ExecutionStrategy;
import org.springframework.shell.core.Shell;
import org.springframework.shell.event.ParseResult;
+import org.springframework.util.Assert;
import com.gemstone.gemfire.internal.ClassPathLoader;
import com.gemstone.gemfire.management.cli.CliMetaData;
@@ -40,7 +41,6 @@ import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.multistep.MultiStepCommand;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
-import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/CommentSkipHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/CommentSkipHelper.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/CommentSkipHelper.java
index 030a198..d1b0568 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/CommentSkipHelper.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/CommentSkipHelper.java
@@ -16,7 +16,7 @@
*/
package com.gemstone.gemfire.management.internal.cli.util;
-import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
+import org.springframework.util.Assert;
/**
* Utility based on code extracted from
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d47dd15/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/Assert.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/Assert.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/Assert.java
deleted file mode 100644
index b71f453..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/Assert.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli.util.spring;
-
-/**
- * Replaces org.springframework.shell.support.util.Assert which is
- * now removed from SPring Shell & the same class is referred from Spring Core
- * to avoid GemFire code dependency on Spring Core.
- * Internally uses ({@link com.gemstone.gemfire.internal.Assert}
- */
-public class Assert {
-
- public static void isTrue(boolean b, String message) {
- com.gemstone.gemfire.internal.Assert.assertTrue(b, message);
- }
-
- public static void notNull(Object object, String message) {
- com.gemstone.gemfire.internal.Assert.assertTrue(object != null, message);
- }
-
-}
[3/9] incubator-geode git commit: GEODE-584: Removes ReflectionUtils
class
Posted by ab...@apache.org.
GEODE-584: Removes ReflectionUtils class
Replaces uses of .../cli/util/spring/ReflectionUtils to spring-core library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/eba2219c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/eba2219c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/eba2219c
Branch: refs/heads/develop
Commit: eba2219c5f055c2533c848a16b71c245982133bc
Parents: e6e1466
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 20 13:21:41 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 20 13:21:41 2015 -0800
----------------------------------------------------------------------
.../cli/multistep/CLIMultiStepHelper.java | 6 +-
.../cli/remote/RemoteExecutionStrategy.java | 2 +-
.../cli/shell/GfshExecutionStrategy.java | 2 +-
.../cli/util/spring/ReflectionUtils.java | 132 -------------------
4 files changed, 5 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eba2219c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/multistep/CLIMultiStepHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/multistep/CLIMultiStepHelper.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/multistep/CLIMultiStepHelper.java
index e04f444..f1a2ede 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/multistep/CLIMultiStepHelper.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/multistep/CLIMultiStepHelper.java
@@ -20,6 +20,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.springframework.shell.event.ParseResult;
+import org.springframework.util.ReflectionUtils;
+
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.management.cli.Result;
@@ -38,9 +41,6 @@ import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
-import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;
-
-import org.springframework.shell.event.ParseResult;
/**
* Utility class to abstract CompositeResultData for Multi-step commands
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eba2219c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
index 33c2f8b..375a387 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/remote/RemoteExecutionStrategy.java
@@ -20,6 +20,7 @@ import java.lang.reflect.Method;
import org.springframework.shell.event.ParseResult;
import org.springframework.util.Assert;
+import org.springframework.util.ReflectionUtils;
import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
@@ -35,7 +36,6 @@ import com.gemstone.gemfire.management.internal.cli.GfshParseResult;
import com.gemstone.gemfire.management.internal.cli.LogWrapper;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
-import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eba2219c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
index a51c763..f259ca1 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/shell/GfshExecutionStrategy.java
@@ -25,6 +25,7 @@ import org.springframework.shell.core.ExecutionStrategy;
import org.springframework.shell.core.Shell;
import org.springframework.shell.event.ParseResult;
import org.springframework.util.Assert;
+import org.springframework.util.ReflectionUtils;
import com.gemstone.gemfire.internal.ClassPathLoader;
import com.gemstone.gemfire.management.cli.CliMetaData;
@@ -41,7 +42,6 @@ import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.multistep.MultiStepCommand;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
-import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;
/**
* Defines the {@link ExecutionStrategy} for commands that are executed in
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eba2219c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ReflectionUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ReflectionUtils.java
deleted file mode 100644
index 4fe0759..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ReflectionUtils.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli.util.spring;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Replaces org.springframework.shell.support.util.ReflectionUtils which
- * is now removed from SPring Shell & the same class is referred from Spring
- * Core. With this we can avoid GemFire member's runtime dependency on Spring
- * Core.
- */
-/*
- * Code selectively taken from the original org.springframework.shell.support.util.ReflectionUtils
- */
-public class ReflectionUtils {
-
- /**
- * Invoke the specified {@link Method} against the supplied target object
- * with the supplied arguments. The target object can be <code>null</code>
- * when invoking a static {@link Method}.
- * <p>Thrown exceptions are handled via a call to {@link #handleReflectionException}.
- * @param method the method to invoke
- * @param target the target object to invoke the method on
- * @param args the invocation arguments (may be <code>null</code>)
- * @return the invocation result, if any
- */
- public static Object invokeMethod(final Method method, final Object target, final Object[] args) {
- try {
- return method.invoke(target, args);
- }
- catch (Exception ex) {
- handleReflectionException(ex);
- }
- throw new IllegalStateException("Should never get here");
- }
-
- /**
- * Handle the given reflection exception. Should only be called if
- * no checked exception is expected to be thrown by the target method.
- * <p>Throws the underlying RuntimeException or Error in case of an
- * InvocationTargetException with such a root cause. Throws an
- * IllegalStateException with an appropriate message else.
- * @param ex the reflection exception to handle
- */
- public static void handleReflectionException(final Exception ex) {
- if (ex instanceof NoSuchMethodException) {
- throw new IllegalStateException("Method not found: " + ex.getMessage());
- }
- if (ex instanceof IllegalAccessException) {
- throw new IllegalStateException("Could not access method: " + ex.getMessage());
- }
- if (ex instanceof InvocationTargetException) {
- handleInvocationTargetException((InvocationTargetException) ex);
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
- handleUnexpectedException(ex);
- }
-
- /**
- * Handle the given invocation target exception. Should only be called if
- * no checked exception is expected to be thrown by the target method.
- * <p>Throws the underlying RuntimeException or Error in case of such
- * a root cause. Throws an IllegalStateException else.
- * @param ex the invocation target exception to handle
- */
- public static void handleInvocationTargetException(final InvocationTargetException ex) {
- rethrowRuntimeException(ex.getTargetException());
- }
-
- /**
- * Rethrow the given {@link Throwable exception}, which is presumably the
- * <em>target exception</em> of an {@link InvocationTargetException}.
- * Should only be called if no checked exception is expected to be thrown by
- * the target method.
- * <p>Rethrows the underlying exception cast to an {@link RuntimeException}
- * or {@link Error} if appropriate; otherwise, throws an
- * {@link IllegalStateException}.
- * @param ex the exception to rethrow
- * @throws RuntimeException the rethrown exception
- */
- public static void rethrowRuntimeException(final Throwable ex) {
- if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
- if (ex instanceof Error) {
- throw (Error) ex;
- }
- handleUnexpectedException(ex);
- }
-
- /**
- * Throws an IllegalStateException with the given exception as root cause.
- * @param ex the unexpected exception
- */
- private static void handleUnexpectedException(final Throwable ex) {
- throw new IllegalStateException("Unexpected exception thrown", ex);
- }
-
-}
[9/9] incubator-geode git commit: Merge branch 'feature/GEODE-584'
into develop
Posted by ab...@apache.org.
Merge branch 'feature/GEODE-584' into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b8fb18a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b8fb18a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b8fb18a5
Branch: refs/heads/develop
Commit: b8fb18a5f4c0f54870aaa8a0ffd135d339a97599
Parents: 6e25230 91536e6
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 27 22:07:07 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 27 22:07:07 2015 -0800
----------------------------------------------------------------------
gemfire-assembly/build.gradle | 1 +
gemfire-core/build.gradle | 2 +-
.../management/internal/cli/GfshParser.java | 17 +-
.../internal/cli/converters/DirConverter.java | 2 +-
.../cli/multistep/CLIMultiStepHelper.java | 6 +-
.../internal/cli/parser/GfshMethodTarget.java | 8 +-
.../cli/parser/jopt/JoptOptionParser.java | 20 +-
.../parser/preprocessor/PreprocessorUtils.java | 11 +-
.../cli/remote/RemoteExecutionStrategy.java | 4 +-
.../cli/shell/GfshExecutionStrategy.java | 4 +-
.../internal/cli/util/CommentSkipHelper.java | 2 +-
.../internal/cli/util/spring/Assert.java | 35 ---
.../internal/cli/util/spring/ObjectUtils.java | 300 -------------------
.../cli/util/spring/ReflectionUtils.java | 132 --------
.../internal/cli/util/spring/StringUtils.java | 229 --------------
15 files changed, 40 insertions(+), 733 deletions(-)
----------------------------------------------------------------------
[5/9] incubator-geode git commit: GEODE-584: Fix StringUtils calls
Posted by ab...@apache.org.
GEODE-584: Fix StringUtils calls
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/1e339735
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/1e339735
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/1e339735
Branch: refs/heads/develop
Commit: 1e339735e8c4c86b634339c38812d93afd26ec97
Parents: 3498eec
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 20 22:18:20 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 20 22:18:20 2015 -0800
----------------------------------------------------------------------
.../gemstone/gemfire/management/internal/cli/GfshParser.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e339735/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
index 1febaae..e28ded0 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
@@ -545,7 +545,7 @@ public class GfshParser implements Parser {
// with an option specifier
if (userOptString.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Now remove the option specifier part
- userOptString = StringUtils.removeEnd(userOptString,
+ userOptString = StringUtils.removeStart(userOptString,
SyntaxConstants.LONG_OPTION_SPECIFIER);
if (option.getLongOption().startsWith(userOptString)
&& !userOptString.equals("")
@@ -1204,7 +1204,7 @@ public class GfshParser implements Parser {
// This means that the user has entered the command
CommandTarget commandTarget = commands.get(commandName);
if (isAvailable(commandTarget, commandName)) {
- String remainingBuffer = StringUtils.removeEnd(userInput, commandName);
+ String remainingBuffer = StringUtils.removeStart(userInput, commandName);
if (remainingBuffer.length() == 0
|| remainingBuffer.startsWith(" ")
|| remainingBuffer.startsWith(GfshParser.LINE_SEPARATOR)) {
@@ -1256,7 +1256,7 @@ public class GfshParser implements Parser {
// This means that the user has entered the command & name matches exactly
commandTarget = commandTargetsMap.get(commandName);
if (commandTarget != null) {
- String remainingBuffer = StringUtils.removeEnd(userInput, commandName);
+ String remainingBuffer = StringUtils.removeStart(userInput, commandName);
commandTarget = commandTarget.duplicate(commandName, remainingBuffer);
break;
}
[6/9] incubator-geode git commit: Merge branch 'develop' into
feature/GEODE-584
Posted by ab...@apache.org.
Merge branch 'develop' into feature/GEODE-584
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e38a9425
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e38a9425
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e38a9425
Branch: refs/heads/develop
Commit: e38a9425a5ef193759139a4933079bdb728c6489
Parents: 1e33973 52f0a1d
Author: Anthony Baker <ab...@pivotal.io>
Authored: Tue Nov 24 12:26:05 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Tue Nov 24 12:26:05 2015 -0800
----------------------------------------------------------------------
gemfire-assembly/build.gradle | 35 +-
.../internal/GetOperationContextImpl.java | 2 +-
.../query/internal/index/AbstractIndex.java | 2 +-
.../query/internal/index/DummyQRegion.java | 2 +-
.../cache/query/internal/index/HashIndex.java | 178 +-
.../query/internal/index/HashIndexSet.java | 1086 ++----
.../query/internal/index/HashIndexStrategy.java | 90 -
.../internal/DistributionManager.java | 2 +-
.../internal/InternalDistributedSystem.java | 8 +-
.../gms/messenger/JGroupsMessenger.java | 9 +-
.../internal/cache/AbstractRegionEntry.java | 29 +-
.../internal/cache/AbstractRegionMap.java | 16 +-
.../cache/BytesAndBitsForCompactor.java | 2 +-
.../gemfire/internal/cache/DiskEntry.java | 8 +-
.../internal/cache/DistributedRegion.java | 2 +-
.../gemfire/internal/cache/EntryEventImpl.java | 45 +-
.../internal/cache/GemFireCacheImpl.java | 4 -
.../gemfire/internal/cache/LocalRegion.java | 10 +-
.../gemstone/gemfire/internal/cache/Oplog.java | 6 +-
.../internal/cache/PartitionedRegion.java | 2 +-
.../internal/cache/VMThinRegionEntry.java | 5 -
.../internal/cache/tier/sockets/Part.java | 4 +-
.../cache/wan/GatewaySenderEventImpl.java | 10 +-
.../gemfire/internal/offheap/Chunk.java | 793 +++++
.../gemfire/internal/offheap/ChunkFactory.java | 51 +
.../gemfire/internal/offheap/ChunkType.java | 26 +
.../internal/offheap/ChunkWithHeapForm.java | 40 +
.../gemfire/internal/offheap/DataAsAddress.java | 205 ++
.../gemfire/internal/offheap/Fragment.java | 125 +
.../internal/offheap/FreeListManager.java | 807 +++++
.../gemfire/internal/offheap/GemFireChunk.java | 55 +
.../internal/offheap/GemFireChunkFactory.java | 52 +
.../internal/offheap/GemFireChunkSlice.java | 44 +
.../internal/offheap/LifecycleListener.java | 98 +
.../internal/offheap/MemoryAllocator.java | 1 -
.../gemfire/internal/offheap/MemoryBlock.java | 1 -
.../internal/offheap/MemoryBlockNode.java | 158 +
.../offheap/OffHeapCachedDeserializable.java | 1 -
.../gemfire/internal/offheap/OffHeapHelper.java | 8 +-
.../offheap/OffHeapRegionEntryHelper.java | 8 +-
.../internal/offheap/RefCountChangeInfo.java | 112 +
.../internal/offheap/ReferenceCountHelper.java | 235 ++
.../offheap/SimpleMemoryAllocatorImpl.java | 3242 +-----------------
.../internal/offheap/SyncChunkStack.java | 130 +
.../internal/tcp/ByteBufferInputStream.java | 2 +-
.../tcp/ImmutableByteBufferInputStream.java | 2 +-
.../gemfire/internal/util/BlobHelper.java | 2 +-
.../gemfire/internal/util/ObjectProcedure.java | 30 -
.../gemfire/internal/util/PrimeFinder.java | 159 -
.../gemfire/pdx/internal/PdxInputStream.java | 2 +-
.../internal/index/HashIndexJUnitTest.java | 23 +-
.../internal/index/HashIndexSetJUnitTest.java | 504 +++
.../cache30/ClientMembershipDUnitTest.java | 5 +-
.../gemfire/cache30/ReconnectDUnitTest.java | 4 +-
.../locator/GMSLocatorRecoveryJUnitTest.java | 4 +-
.../fd/GMSHealthMonitorJUnitTest.java | 3 +-
...wardCompatibilitySerializationDUnitTest.java | 13 +-
.../cache/ChunkValueWrapperJUnitTest.java | 2 +-
.../gemfire/internal/cache/OffHeapTestUtil.java | 5 +-
.../cache/OldValueImporterTestBase.java | 4 +-
.../offheap/ConcurrentBagJUnitTest.java | 130 -
.../offheap/FreeListOffHeapRegionJUnitTest.java | 2 +-
.../internal/offheap/OffHeapRegionBase.java | 1 -
.../offheap/OffHeapValidationJUnitTest.java | 1 -
.../OffHeapWriteObjectAsByteArrayJUnitTest.java | 2 -
.../OldFreeListOffHeapRegionJUnitTest.java | 2 +-
...mpleMemoryAllocatorFillPatternJUnitTest.java | 2 -
.../offheap/SimpleMemoryAllocatorJUnitTest.java | 9 +-
...moryAllocatorLifecycleListenerJUnitTest.java | 9 +-
.../OffHeapByteBufferByteSourceJUnitTest.java | 2 +-
.../gemfire/pdx/OffHeapByteSourceJUnitTest.java | 2 +-
.../gemfire/codeAnalysis/excludedClasses.txt | 1 +
.../codeAnalysis/sanctionedSerializables.txt | 1 -
gemfire-lucene/build.gradle | 4 +-
.../PartitionedRepositoryManagerJUnitTest.java | 4 +-
75 files changed, 4073 insertions(+), 4612 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e38a9425/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --cc gemfire-assembly/build.gradle
index de8b584,1324cb9..1f1b798
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@@ -73,14 -74,19 +74,19 @@@ task defaultCacheConfig(type: JavaExec
// This closure sets the gemfire classpath. If we add another jar to the classpath it must
// be included in the filter logic below.
def cp = {
- configurations.archives.dependencies.collect { it.dependencyProject }
+ // first add all the dependent project jars
+ def jars = configurations.archives.dependencies.collect { it.dependencyProject }
.findAll { !it.name.contains('web') }
.collect { it.jar.archiveName }
- .join(' ') + ' ' +
- project(':gemfire-core').configurations.runtime.collect { it.getName() }.findAll {
+ .join(' ')
+
+ // then add all the dependencies of the dependent jars
+ jars += ' ' + configurations.archives.dependencies.collect {
+ it.dependencyProject.configurations.runtime.collect { it.getName() }.findAll {
+ // depedencies from gemfire-core
it.contains('antlr') ||
it.contains('commons-io') ||
- it.contains('commons-logging') ||
+ it.contains('commons-lang') ||
it.contains('fastutil') ||
it.contains('jackson-annotations') ||
it.contains('jackson-core') ||
[4/9] incubator-geode git commit: GEODE-584: Removes StringUtils class
Posted by ab...@apache.org.
GEODE-584: Removes StringUtils class
Replaces use of .../cli/util/spring/StringUtils with commons-lang library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3498eec1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3498eec1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3498eec1
Branch: refs/heads/develop
Commit: 3498eec1c4f7f673898d8291ae6b7a9117f92d52
Parents: eba2219
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 20 13:26:53 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 20 13:26:53 2015 -0800
----------------------------------------------------------------------
gemfire-assembly/build.gradle | 2 +-
gemfire-core/build.gradle | 2 +-
.../management/internal/cli/GfshParser.java | 17 +-
.../internal/cli/parser/GfshMethodTarget.java | 3 +-
.../cli/parser/jopt/JoptOptionParser.java | 18 +-
.../parser/preprocessor/PreprocessorUtils.java | 11 +-
.../internal/cli/util/spring/StringUtils.java | 229 -------------------
7 files changed, 27 insertions(+), 255 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index dd7b9fa..de8b584 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -80,7 +80,7 @@ def cp = {
project(':gemfire-core').configurations.runtime.collect { it.getName() }.findAll {
it.contains('antlr') ||
it.contains('commons-io') ||
- it.contains('commons-logging') ||
+ it.contains('commons-lang') ||
it.contains('fastutil') ||
it.contains('jackson-annotations') ||
it.contains('jackson-core') ||
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-core/build.gradle b/gemfire-core/build.gradle
index aa143b1..8e45a97 100755
--- a/gemfire-core/build.gradle
+++ b/gemfire-core/build.gradle
@@ -22,7 +22,7 @@ dependencies {
compile 'com.google.code.findbugs:annotations:' + project.'annotations.version'
provided 'com.google.guava:guava:' + project.'guava.version'
compile 'commons-io:commons-io:' + project.'commons-io.version'
- provided 'commons-lang:commons-lang:' + project.'commons-lang.version'
+ compile 'commons-lang:commons-lang:' + project.'commons-lang.version'
compile 'commons-logging:commons-logging:' + project.'commons-logging.version'
compile 'commons-modeler:commons-modeler:' + project.'commons-modeler.version'
compile 'io.netty:netty-all:' + project.'netty-all.version'
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
index 85be6e2..1febaae 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
@@ -30,6 +30,7 @@ import java.util.TreeSet;
import java.util.logging.Logger;
import java.util.regex.Pattern;
+import org.apache.commons.lang.StringUtils;
import org.springframework.shell.core.AbstractShell;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
@@ -40,7 +41,6 @@ import org.springframework.shell.event.ParseResult;
import com.gemstone.gemfire.management.cli.CommandProcessingException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandMultiModeOptionException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionException;
-import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionHasMultipleValuesException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliException;
import com.gemstone.gemfire.management.internal.cli.exceptions.ExceptionHandler;
import com.gemstone.gemfire.management.internal.cli.help.format.NewHelp;
@@ -62,7 +62,6 @@ import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.Preproce
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedInput;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
import com.gemstone.gemfire.management.internal.cli.util.CLIConsoleBufferUtil;
-import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
/**
* Implementation of the {@link Parser} interface for GemFire SHell (gfsh)
@@ -354,10 +353,10 @@ public class GfshParser implements Parser {
for (String string : userOptionSet.getSplit()) {
if (string.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Remove option prefix
- string = StringUtils.removePrefix(string,
+ string = StringUtils.removeStart(string,
SyntaxConstants.LONG_OPTION_SPECIFIER);
// Remove value specifier
- string = StringUtils.removeSuffix(string,
+ string = StringUtils.removeEnd(string,
SyntaxConstants.OPTION_VALUE_SPECIFIER);
if (!string.equals("")) {
if (option.getLongOption().equals(string)) {
@@ -546,7 +545,7 @@ public class GfshParser implements Parser {
// with an option specifier
if (userOptString.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Now remove the option specifier part
- userOptString = StringUtils.removePrefix(userOptString,
+ userOptString = StringUtils.removeEnd(userOptString,
SyntaxConstants.LONG_OPTION_SPECIFIER);
if (option.getLongOption().startsWith(userOptString)
&& !userOptString.equals("")
@@ -910,10 +909,10 @@ public class GfshParser implements Parser {
public ParseResult parse(String userInput) {
GfshParseResult parseResult = null;
// First remove the trailing white spaces
- userInput = StringUtils.trimTrailingWhitespace(userInput);
+ userInput = StringUtils.stripEnd(userInput, null);
if ((ParserUtils.contains(userInput, SyntaxConstants.COMMAND_DELIMITER) && StringUtils.endsWithIgnoreCase(
userInput, SyntaxConstants.COMMAND_DELIMITER))) {
- userInput = StringUtils.removeSuffix(userInput, SyntaxConstants.COMMAND_DELIMITER);
+ userInput = StringUtils.removeEnd(userInput, SyntaxConstants.COMMAND_DELIMITER);
}
try {
@@ -1205,7 +1204,7 @@ public class GfshParser implements Parser {
// This means that the user has entered the command
CommandTarget commandTarget = commands.get(commandName);
if (isAvailable(commandTarget, commandName)) {
- String remainingBuffer = StringUtils.removePrefix(userInput, commandName);
+ String remainingBuffer = StringUtils.removeEnd(userInput, commandName);
if (remainingBuffer.length() == 0
|| remainingBuffer.startsWith(" ")
|| remainingBuffer.startsWith(GfshParser.LINE_SEPARATOR)) {
@@ -1257,7 +1256,7 @@ public class GfshParser implements Parser {
// This means that the user has entered the command & name matches exactly
commandTarget = commandTargetsMap.get(commandName);
if (commandTarget != null) {
- String remainingBuffer = StringUtils.removePrefix(userInput, commandName);
+ String remainingBuffer = StringUtils.removeEnd(userInput, commandName);
commandTarget = commandTarget.duplicate(commandName, remainingBuffer);
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
index 1d8df03..8675085 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
@@ -18,11 +18,10 @@ package com.gemstone.gemfire.management.internal.cli.parser;
import java.lang.reflect.Method;
+import org.apache.commons.lang.StringUtils;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
-import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
-
/**
* A method that can be executed via a shell command.
*
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
index 71c25e3..29ebb02 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
@@ -21,6 +21,14 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import joptsimple.ArgumentAcceptingOptionSpec;
+import joptsimple.MultipleArgumentsForOptionException;
+import joptsimple.OptionException;
+import joptsimple.OptionParser;
+import joptsimple.OptionSpecBuilder;
+
+import org.apache.commons.lang.StringUtils;
+
import com.gemstone.gemfire.management.internal.cli.MultipleValueConverter;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionException;
import com.gemstone.gemfire.management.internal.cli.exceptions.ExceptionGenerator;
@@ -32,12 +40,6 @@ import com.gemstone.gemfire.management.internal.cli.parser.SyntaxConstants;
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.Preprocessor;
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.PreprocessorUtils;
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedInput;
-import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
-import joptsimple.ArgumentAcceptingOptionSpec;
-import joptsimple.MultipleArgumentsForOptionException;
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSpecBuilder;
/**
* Implementation of {@link GfshOptionParser} which internally makes use of
@@ -172,10 +174,10 @@ public class JoptOptionParser implements GfshOptionParser {
outer: for (String inputSplit : preProcessedInput) {
if (inputSplit.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Remove option prefix
- inputSplit = StringUtils.removePrefix(inputSplit,
+ inputSplit = StringUtils.removeStart(inputSplit,
SyntaxConstants.LONG_OPTION_SPECIFIER);
// Remove value specifier
- inputSplit = StringUtils.removeSuffix(inputSplit,
+ inputSplit = StringUtils.removeEnd(inputSplit,
SyntaxConstants.OPTION_VALUE_SPECIFIER);
if (!inputSplit.equals("")) {
if (option.getLongOption().equals(inputSplit)) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/preprocessor/PreprocessorUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/preprocessor/PreprocessorUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/preprocessor/PreprocessorUtils.java
index 29c79e8..137d211 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/preprocessor/PreprocessorUtils.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/preprocessor/PreprocessorUtils.java
@@ -19,9 +19,10 @@ package com.gemstone.gemfire.management.internal.cli.parser.preprocessor;
import java.util.regex.Pattern;
+import org.apache.commons.lang.StringUtils;
+
import com.gemstone.gemfire.internal.lang.SystemUtils;
import com.gemstone.gemfire.management.internal.cli.parser.SyntaxConstants;
-import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
/**
* The methods in this class will be used by the {@link Preprocessor} class to
@@ -36,7 +37,7 @@ public class PreprocessorUtils {
if (input != null) {
// First remove the trailing white spaces, we do not need those
if (!containsOnlyWhiteSpaces(input)) {
- input = StringUtils.trimTrailingWhitespace(input);
+ input = StringUtils.stripEnd(input, null);
}
String output = input.trim();
return new TrimmedInput(output, input.length() - output.length());
@@ -77,7 +78,7 @@ public class PreprocessorUtils {
String inputCopy = input;
StringBuffer output = new StringBuffer();
// First remove the trailing white spaces, we do not need those
- inputCopy = StringUtils.trimTrailingWhitespace(inputCopy);
+ inputCopy = StringUtils.stripEnd(inputCopy, null);
// As this parser is for optionParsing, we also need to remove
// the trailing optionSpecifiers provided it has previous
// options. Remove the trailing LONG_OPTION_SPECIFIERs
@@ -85,11 +86,11 @@ public class PreprocessorUtils {
// the case of non-mandatory arguments.
// "^(.*)(\\s-+)$" - something that ends with a space followed by a series of hyphens.
while (Pattern.matches("^(.*)(\\s-+)$", inputCopy)) {
- inputCopy = StringUtils.removeSuffix(inputCopy, SyntaxConstants.SHORT_OPTION_SPECIFIER);
+ inputCopy = StringUtils.removeEnd(inputCopy, SyntaxConstants.SHORT_OPTION_SPECIFIER);
// Again we need to trim the trailing white spaces
// As we are in a loop
- inputCopy = StringUtils.trimTrailingWhitespace(inputCopy);
+ inputCopy = StringUtils.stripEnd(inputCopy, null);
}
// Here we made use of the String class function trim to remove the
// space and tabs if any at the
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3498eec1/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/StringUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/StringUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/StringUtils.java
deleted file mode 100644
index aca17b0..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/StringUtils.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli.util.spring;
-
-/**
- * Replaces org.springframework.shell.support.util.StringUtils which
- * is now removed from SPring Shell & the same class is referred from Spring
- * Core. With this we can avoid GemFire member's runtime dependency on Spring
- * Core.
- */
-/*
- * Code selectively taken from the original org.springframework.shell.support.util.StringUtils
- */
-public class StringUtils {
-
- /**
- * <p>
- * Removes leading and trailing whitespace from both ends of this String returning an empty String ("") if the String is empty after the trim or if it is <code>null</code>.
- *
- * <pre>
- * StringUtils.trimToNull(null) = ""
- * StringUtils.trimToNull("") = ""
- * StringUtils.trimToNull(" ") = ""
- * StringUtils.trimToNull("abc") = "abc"
- * StringUtils.trimToNull(" abc ") = "abc"
- * </pre>
- *
- * @param str the String to be trimmed, may be null
- * @return the trimmed String, an empty String("") if only chars <= 32, empty or null String input
- * @since 1.1
- */
- public static String trimToEmpty(final String str) {
- String ts = trimWhitespace(str);
- return !hasText(ts) ? "" : ts;
- }
-
- /**
- * Trim leading and trailing whitespace from the given String.
- * @param str the String to check
- * @return the trimmed String
- * @see java.lang.Character#isWhitespace
- */
- public static String trimWhitespace(final String str) {
- if (!hasLength(str)) {
- return str;
- }
- StringBuilder sb = new StringBuilder(str);
- while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) {
- sb.deleteCharAt(0);
- }
- while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }
- //---------------------------------------------------------------------
- // General convenience methods for working with Strings
- //---------------------------------------------------------------------
-
- /**
- * Check that the given CharSequence is neither <code>null</code> nor of length 0.
- * Note: Will return <code>true</code> for a CharSequence that purely consists of whitespace.
- * <p><pre>
- * StringUtils.hasLength(null) = false
- * StringUtils.hasLength("") = false
- * StringUtils.hasLength(" ") = true
- * StringUtils.hasLength("Hello") = true
- * </pre>
- * @param str the CharSequence to check (may be <code>null</code>)
- * @return <code>true</code> if the CharSequence is not null and has length
- * @see #hasText(String)
- */
- public static boolean hasLength(final CharSequence str) {
- return (str != null && str.length() > 0);
- }
-
- /**
- * Check that the given String is neither <code>null</code> nor of length 0.
- * Note: Will return <code>true</code> for a String that purely consists of whitespace.
- * @param str the String to check (may be <code>null</code>)
- * @return <code>true</code> if the String is not null and has length
- * @see #hasLength(CharSequence)
- */
- public static boolean hasLength(final String str) {
- return hasLength((CharSequence) str);
- }
-
- /**
- * Check whether the given CharSequence has actual text.
- * More specifically, returns <code>true</code> if the string not <code>null</code>,
- * its length is greater than 0, and it contains at least one non-whitespace character.
- * <p><pre>
- * StringUtils.hasText(null) = false
- * StringUtils.hasText("") = false
- * StringUtils.hasText(" ") = false
- * StringUtils.hasText("12345") = true
- * StringUtils.hasText(" 12345 ") = true
- * </pre>
- * @param str the CharSequence to check (may be <code>null</code>)
- * @return <code>true</code> if the CharSequence is not <code>null</code>,
- * its length is greater than 0, and it does not contain whitespace only
- * @see java.lang.Character#isWhitespace
- */
- public static boolean hasText(final CharSequence str) {
- if (!hasLength(str)) {
- return false;
- }
- int strLen = str.length();
- for (int i = 0; i < strLen; i++) {
- if (!Character.isWhitespace(str.charAt(i))) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Check whether the given String has actual text.
- * More specifically, returns <code>true</code> if the string not <code>null</code>,
- * its length is greater than 0, and it contains at least one non-whitespace character.
- * @param str the String to check (may be <code>null</code>)
- * @return <code>true</code> if the String is not <code>null</code>, its length is
- * greater than 0, and it does not contain whitespace only
- * @see #hasText(CharSequence)
- */
- public static boolean hasText(final String str) {
- return hasText((CharSequence) str);
- }
-
- /**
- * Removes the given prefix from the given string, if it exists
- *
- * @param str the string to modify (can be blank to do nothing)
- * @param prefix the prefix to remove (can be blank to do nothing)
- * @return <code>null</code> if a <code>null</code> string was given
- * @since 1.2.0
- */
- public static String removePrefix(final String str, final String prefix) {
- if (!hasText(str) || !hasText(prefix) || !str.startsWith(prefix)) {
- return str;
- }
- return str.substring(prefix.length());
- }
-
- /**
- * Removes the given suffix from the given string, if it exists
- *
- * @param str the string to modify (can be blank to do nothing)
- * @param suffix the suffix to remove (can be blank to do nothing)
- * @return <code>null</code> if a <code>null</code> string was given
- * @since 1.2.0
- */
- public static String removeSuffix(final String str, final String suffix) {
- if (!hasText(str) || !hasText(suffix) || !str.endsWith(suffix)) {
- return str;
- }
- return str.substring(0, str.length() - suffix.length());
- }
-
- /**
- * Trim trailing whitespace from the given String.
- * @param str the String to check
- * @return the trimmed String
- * @see java.lang.Character#isWhitespace
- */
- public static String trimTrailingWhitespace(final String str) {
- if (!hasLength(str)) {
- return str;
- }
- StringBuilder sb = new StringBuilder(str);
- while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }
-
- /**
- * Test if the given String ends with the specified suffix,
- * ignoring upper/lower case.
- * @param str the String to check
- * @param suffix the suffix to look for
- * @see java.lang.String#endsWith
- */
- public static boolean endsWithIgnoreCase(final String str, final String suffix) {
- if (str == null || suffix == null) {
- return false;
- }
- if (str.endsWith(suffix)) {
- return true;
- }
- if (str.length() < suffix.length()) {
- return false;
- }
-
- String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
- String lcSuffix = suffix.toLowerCase();
- return lcStr.equals(lcSuffix);
- }
-
-}
[8/9] incubator-geode git commit: GEODE-584: Update javadoc to fix
link to OptionParser
Posted by ab...@apache.org.
GEODE-584: Update javadoc to fix link to OptionParser
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/91536e66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/91536e66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/91536e66
Branch: refs/heads/develop
Commit: 91536e660e28cb7354db3e5d1819ff9deabb4146
Parents: f828a5e
Author: Anthony Baker <ab...@pivotal.io>
Authored: Wed Nov 25 11:34:52 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Wed Nov 25 11:34:52 2015 -0800
----------------------------------------------------------------------
.../management/internal/cli/parser/jopt/JoptOptionParser.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/91536e66/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
index 29ebb02..6a1a828 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
@@ -43,7 +43,7 @@ import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedI
/**
* Implementation of {@link GfshOptionParser} which internally makes use of
- * {@link com.gemstone.joptsimple.OptionParser}
+ * {@link joptsimple.OptionParser}
*
* @author Nikhil Jadhav
* @since 7.0
[7/9] incubator-geode git commit: GEODE-584: Fix classpath
Posted by ab...@apache.org.
GEODE-584: Fix classpath
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f828a5eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f828a5eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f828a5eb
Branch: refs/heads/develop
Commit: f828a5ebf9acf57081434203d5a0d8715c0ed797
Parents: e38a942
Author: Anthony Baker <ab...@pivotal.io>
Authored: Tue Nov 24 17:06:59 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Tue Nov 24 17:06:59 2015 -0800
----------------------------------------------------------------------
gemfire-assembly/build.gradle | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f828a5eb/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index 1f1b798..e097b65 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -87,6 +87,7 @@ def cp = {
it.contains('antlr') ||
it.contains('commons-io') ||
it.contains('commons-lang') ||
+ it.contains('commons-logging') ||
it.contains('fastutil') ||
it.contains('jackson-annotations') ||
it.contains('jackson-core') ||
[2/9] incubator-geode git commit: GEODE-584: Removes ObjectUtils class
Posted by ab...@apache.org.
GEODE-584: Removes ObjectUtils class
Replaces use of .../cli/util/spring/ObjectUtils to spring-core library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e6e1466c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e6e1466c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e6e1466c
Branch: refs/heads/develop
Commit: e6e1466c18316edfcee91b947ad7ce54abe2b91c
Parents: 0d47dd1
Author: Anthony Baker <ab...@pivotal.io>
Authored: Fri Nov 20 13:19:21 2015 -0800
Committer: Anthony Baker <ab...@pivotal.io>
Committed: Fri Nov 20 13:19:21 2015 -0800
----------------------------------------------------------------------
.../internal/cli/parser/GfshMethodTarget.java | 4 +-
.../internal/cli/util/spring/ObjectUtils.java | 300 -------------------
2 files changed, 2 insertions(+), 302 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e6e1466c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
index 87b9569..1d8df03 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/GfshMethodTarget.java
@@ -19,8 +19,8 @@ package com.gemstone.gemfire.management.internal.cli.parser;
import java.lang.reflect.Method;
import org.springframework.util.Assert;
+import org.springframework.util.ObjectUtils;
-import com.gemstone.gemfire.management.internal.cli.util.spring.ObjectUtils;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
/**
@@ -102,7 +102,7 @@ public class GfshMethodTarget {
@Override
public int hashCode() {
- return ObjectUtils.nullSafeHashCode(method, target);
+ return ObjectUtils.nullSafeHashCode(new Object[] { method, target });
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e6e1466c/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ObjectUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ObjectUtils.java
deleted file mode 100644
index 8209b3c..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/util/spring/ObjectUtils.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * Copyright 2011-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli.util.spring;
-
-/**
- * Replaces org.springframework.shell.support.util.ObjectUtils which
- * is now removed from SPring Shell & the same class is referred from Spring
- * Core. With this we can avoid GemFire member's runtime dependency on Spring
- * Core.
- */
-/*
- * Code selectively taken from the original org.springframework.shell.support.util.ObjectUtils
- */
-public class ObjectUtils {
- // Constants
- private static final int INITIAL_HASH = 7;
- private static final int MULTIPLIER = 31;
-
- /**
- * Return as hash code for the given object; typically the value of
- * <code>{@link Object#hashCode()}</code>. If the object is an array,
- * this method will delegate to any of the <code>nullSafeHashCode</code>
- * methods for arrays in this class. If the object is <code>null</code>,
- * this method returns 0.
- *
- * @see #nullSafeHashCode(Object[])
- * @see #nullSafeHashCode(boolean[])
- * @see #nullSafeHashCode(byte[])
- * @see #nullSafeHashCode(char[])
- * @see #nullSafeHashCode(double[])
- * @see #nullSafeHashCode(float[])
- * @see #nullSafeHashCode(int[])
- * @see #nullSafeHashCode(long[])
- * @see #nullSafeHashCode(short[])
- */
- public static int nullSafeHashCode(final Object obj) {
- if (obj == null) {
- return 0;
- }
- if (obj.getClass().isArray()) {
- if (obj instanceof Object[]) {
- return nullSafeHashCode((Object[]) obj);
- }
- if (obj instanceof boolean[]) {
- return nullSafeHashCode((boolean[]) obj);
- }
- if (obj instanceof byte[]) {
- return nullSafeHashCode((byte[]) obj);
- }
- if (obj instanceof char[]) {
- return nullSafeHashCode((char[]) obj);
- }
- if (obj instanceof double[]) {
- return nullSafeHashCode((double[]) obj);
- }
- if (obj instanceof float[]) {
- return nullSafeHashCode((float[]) obj);
- }
- if (obj instanceof int[]) {
- return nullSafeHashCode((int[]) obj);
- }
- if (obj instanceof long[]) {
- return nullSafeHashCode((long[]) obj);
- }
- if (obj instanceof short[]) {
- return nullSafeHashCode((short[]) obj);
- }
- }
- return obj.hashCode();
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array the array from whose elements to calculate the hash code (can be <code>null</code>)
- * @return 0 if the array is <code>null</code>
- */
- public static int nullSafeHashCode(final Object... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (final Object element : array) {
- hash = MULTIPLIER * hash + nullSafeHashCode(element);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final boolean... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + hashCode(array[i]);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final byte... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + array[i];
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final char... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + array[i];
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final double... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + hashCode(array[i]);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final float... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + hashCode(array[i]);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final int... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + array[i];
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final long... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + hashCode(array[i]);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array.
- *
- * @param array can be <code>null</code>
- * @return 0 if <code>array</code> is <code>null</code>
- */
- public static int nullSafeHashCode(final short... array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- int arraySize = array.length;
- for (int i = 0; i < arraySize; i++) {
- hash = MULTIPLIER * hash + array[i];
- }
- return hash;
- }
-
- /**
- * Returns the hash code of the given boolean value.
- *
- * @param bool the boolean for which to return the hash code
- * @return see {@link Boolean#hashCode()}
- */
- public static int hashCode(final boolean bool) {
- return Boolean.valueOf(bool).hashCode();
- }
-
- /**
- * Return the same value as <code>{@link Double#hashCode()}</code>.
- *
- * @see Double#hashCode()
- */
- public static int hashCode(final double dbl) {
- long bits = Double.doubleToLongBits(dbl);
- return hashCode(bits);
- }
-
- /**
- * Return the same value as <code>{@link Float#hashCode()}</code>.
- *
- * @see Float#hashCode()
- */
- public static int hashCode(final float flt) {
- return Float.floatToIntBits(flt);
- }
-
- /**
- * Return the same value as <code>{@link Long#hashCode()}</code>.
- *
- * @see Long#hashCode()
- */
- public static int hashCode(final long lng) {
- return (int) (lng ^ (lng >>> 32));
- }
-
-}