GitHub user PurelyApplied opened a pull request: https://github.com/apache/geode/pull/521
GEODE-1994: Overhaul of internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils * geode.internal.lang.StringUtils has been deprecated. In the interim, it has been heavily refactored and extends commons.lang.StringUtils. * * Renamed: * -- EMPTY_STRING -> EMPTY (inherited) * -- toUpperCase -> upperCase (inherited) * -- toLowerCase -> lowerCase (inherited) * -- padEnding -> rightPad (inherited) * * Removed: * -- EMPTY_STRING_ARRAY; usage replaced with commons.lang.ArrayUtils.EMPTY_STRING_ARRAY * -- SPACES * -- UTF_8; rare usage replaced with raw string * -- concat; usage replaced with commons.lang.join, refactoring as necessary. * -- getLettersOnly * -- getSpaces * -- truncate * -- valueOf; usage refactored to use defaultString * * Refactored * -- defaultIfBlank: previously relied on varargs and could return null. Usage refactored to allow inheritance from commons. * -- defaultString(s, EMPTY) refactored to use standard signature defaultString(s) for consistency throughout codebase. * -- isBlank: usage refactored to resolve discrepancies with commons.lang.isBlank, which is now inherited. * -- isEmpty: usage refactored to resolve discrepancies with commons.lang.isEmpty, which is now inherited. * * Code Cleanup: * -- Many uses of !isBlank -> isNotBlank * -- Changes suggested by Inspections on most touched files. * -- Explicit <T> -> <> when type is inferable * -- while loops operating on iterators converted to for each loops * -- for loops operating on array indices converted to for each loops * -- Various string typos corrected. * -- isEmpty(s.trim()) -> isBlank(s) * -- s.trim().isEmpty() -> isEmpty(s) * -- Removed some instances of 'dead' code * -- Optimized imports in every touched file * * Qualitative Changes: * -- The following functions now throw an error when called with a null string input: * -- * LocatorLauncher.Builder.setMemberName * -- * ServerLauncher.Builder.setMemberName * -- * ServerLauncher.Builder.setHostnameForClients * -- (Unit tests added to capture these changes) * * Notes: * -- StringUtils.wraps may be inherited from Apache Commons when the dependency is updated. * -- AbstractLauncher.getMember has the documented behavior of returning null when both MemberName and ID are blank. Is this the best behavior for this method? You can merge this pull request into a Git repository by running: $ git pull https://github.com/PurelyApplied/geode geode-1994 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/geode/pull/521.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #521 ---- commit 327e1ae4b7b6e3503b0e295e6c883c387fa03b47 Author: Patrick Rhomberg <prhomb...@pivotal.io> Date: 2017-05-17T23:57:07Z GEODE-1994: Overhaul of internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils * geode.internal.lang.StringUtils has been deprecated. In the interim, it has been heavily refactored and extends commons.lang.StringUtils. * * Renamed: * -- EMPTY_STRING -> EMPTY (inherited) * -- toUpperCase -> upperCase (inherited) * -- toLowerCase -> lowerCase (inherited) * -- padEnding -> rightPad (inherited) * * Removed: * -- EMPTY_STRING_ARRAY; usage replaced with commons.lang.ArrayUtils.EMPTY_STRING_ARRAY * -- SPACES * -- UTF_8; rare usage replaced with raw string * -- concat; usage replaced with commons.lang.join, refactoring as necessary. * -- getLettersOnly * -- getSpaces * -- truncate * -- valueOf; usage refactored to use defaultString * * Refactored * -- defaultIfBlank: previously relied on varargs and could return null. Usage refactored to allow inheritance from commons. * -- defaultString(s, EMPTY) refactored to use standard signature defaultString(s) for consistency throughout codebase. * -- isBlank: usage refactored to resolve discrepancies with commons.lang.isBlank, which is now inherited. * -- isEmpty: usage refactored to resolve discrepancies with commons.lang.isEmpty, which is now inherited. * * Code Cleanup: * -- Many uses of !isBlank -> isNotBlank * -- Changes suggested by Inspections on most touched files. * -- Explicit <T> -> <> when type is inferable * -- while loops operating on iterators converted to for each loops * -- for loops operating on array indices converted to for each loops * -- Various string typos corrected. * -- isEmpty(s.trim()) -> isBlank(s) * -- s.trim().isEmpty() -> isEmpty(s) * -- Removed some instances of 'dead' code * -- Optimized imports in every touched file * * Qualitative Changes: * -- The following functions now throw an error when called with a null string input: * -- * LocatorLauncher.Builder.setMemberName * -- * ServerLauncher.Builder.setMemberName * -- * ServerLauncher.Builder.setHostnameForClients * -- (Unit tests added to capture these changes) * * Notes: * -- StringUtils.wraps may be inherited from Apache Commons when the dependency is updated. * -- AbstractLauncher.getMember has the documented behavior of returning null when both MemberName and ID are blank. Is this the best behavior for this method? ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---