geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [4/9] incubator-geode git commit: GEODE-584: Removes StringUtils class
Date Sat, 28 Nov 2015 06:14:40 GMT
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 <abaker@pivotal.io>
Authored: Fri Nov 20 13:26:53 2015 -0800
Committer: Anthony Baker <abaker@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 &lt;= 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);
-  }
-
-}


Mime
View raw message