[ https://issues.apache.org/jira/browse/NUTCH-2848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lewis John McGibbney updated NUTCH-2848: ---------------------------------------- Summary: Consider use of StringUtil#isEmpty (was: Consider usefulness of StringUtil#isEmpty) > Consider use of StringUtil#isEmpty > ---------------------------------- > > Key: NUTCH-2848 > URL: https://issues.apache.org/jira/browse/NUTCH-2848 > Project: Nutch > Issue Type: Improvement > Components: util > Reporter: Lewis John McGibbney > Priority: Minor > Fix For: 1.19 > > > We should consider 'standardizing' the use of > [StringUtil#isEmpty()|https://github.com/apache/nutch/blob/master/src/java/org/apache/nutch/util/StringUtil.java#L133-L138] > across the codebase. > {code:java} > /** > * Checks if a string is empty (ie is null or empty). > */ > public static boolean isEmpty(String str) { > return (str == null) || (str.equals("")); > } > {code} > So far the impact is as follows > {code:bash} > grep -lr ".equals(\"\")" . > ./plugin/urlnormalizer-protocol/src/java/org/apache/nutch/net/urlnormalizer/protocol/ProtocolURLNormalizer.java > ./plugin/parse-ext/src/java/org/apache/nutch/parse/ext/ExtParser.java > ./plugin/urlnormalizer-host/src/java/org/apache/nutch/net/urlnormalizer/host/HostURLNormalizer.java > ./plugin/parsefilter-regex/src/java/org/apache/nutch/parsefilter/regex/RegexParseFilter.java > ./plugin/feed/src/java/org/apache/nutch/parse/feed/FeedParser.java > ./plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/Train.java > ./plugin/language-identifier/src/test/org/apache/nutch/analysis/lang/TestHTMLLanguageParser.java > ./plugin/urlnormalizer-slash/src/java/org/apache/nutch/net/urlnormalizer/slash/SlashURLNormalizer.java > ./java/org/apache/nutch/tools/FileDumper.java > ./java/org/apache/nutch/net/URLNormalizers.java > ./java/org/apache/nutch/util/StringUtil.java > ./java/org/apache/nutch/util/domain/DomainStatistics.java > ./java/org/apache/nutch/util/MimeUtil.java > {code} > We may wish to also consider the following implementation as well > {code:java} > public static boolean isEmpty(String str) { > return str.length == 0; > } > {code} > Any comments? -- This message was sent by Atlassian Jira (v8.3.4#803005)