Menu

#74 Remove apache commons StringUtils dependency

wont-fix
None
5
2016-04-28
2015-10-13
Raphael
No

apache commons depencency is >400KB. The dependency is only needed for checking for whitespace strings. I suggest removing the dependency and instead use the following three lines:

    protected boolean isAllWhiteSpace(CharSequence sb) {
        for( int i=0; i<sb.length(); i++ ){
            if( !Character.isWhitespace(sb.charAt(i)) )return false;
        }
        return true;
    }

Discussion

  • Scott Conway

    Scott Conway - 2015-10-14

    I see both sides on this issue so I will need to think on this. Eventually I would be expanding my use of the apache commons as I don't want to reinvent the wheel and it give me less code to maintain. But this project's final deliverable is less than 40k and has an dependency that is ten times its size.

     
  • Andrew Rucker Jones

    opencsv 3.8 (including my pending patch, if it is accepted) uses:
    ArrayUtils.indexOf()
    FieldUtils.writeField()
    ObjectUtils.toString()
    StrBuilder
    StringUtils.isBlank()
    StringUtils.isEmpty()
    StringUtils.isNotBlank()
    StringUtils.isNotEmpty()
    StringUtils.isWhitespace()

    I would much rather spend my time finding further ways to use Apache Commons Lang to simplify our code, rather than remove the dependency.

     
  • Andrew Rucker Jones

    • status: open --> wont-fix
    • assigned_to: Andrew Rucker Jones
     
  • Andrew Rucker Jones

    For the reasons given, the dependency to Apache Commons Lang will remain.

     

Log in to post a comment.