[ https://issues.apache.org/jira/browse/GEODE-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16016649#comment-16016649 ]
ASF GitHub Bot commented on GEODE-1994: --------------------------------------- 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? ---- > Change geode StringUtils to extend commons StringUtils > ------------------------------------------------------ > > Key: GEODE-1994 > URL: https://issues.apache.org/jira/browse/GEODE-1994 > Project: Geode > Issue Type: Wish > Components: general, management > Reporter: Kirk Lund > Assignee: Patrick Rhomberg > > org.apache.geode.internal.lang.StringUtils duplicates some of the methods in > org.apache.commons.lang.StringUtils with some inconsistencies. > isBlank is implemented identically > isEmpty is inconsistent -- commons version returns true if string is null, > while geode version returns false if string is null -- This message was sent by Atlassian JIRA (v6.3.15#6346)