Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) #205

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -478,9 +478,9 @@ protected String getArtifactType(MavenProject p) {
* @return the list of source paths for the given project.
*/
protected List<String> getProjectSourceRoots(MavenProject p) {
return (p.getCompileSourceRoots() == null
return p.getCompileSourceRoots() == null
? Collections.<String>emptyList()
: new LinkedList<>(p.getCompileSourceRoots()));
: new LinkedList<>(p.getCompileSourceRoots());
}

/**
Expand All @@ -490,9 +490,9 @@ protected List<String> getProjectSourceRoots(MavenProject p) {
* if any
*/
protected List<String> getCompileClasspathElements(MavenProject p) throws DependencyResolutionRequiredException {
return (p.getCompileClasspathElements() == null
return p.getCompileClasspathElements() == null
? Collections.<String>emptyList()
: new LinkedList<>(p.getCompileClasspathElements()));
: new LinkedList<>(p.getCompileClasspathElements());
}

/**
Expand All @@ -512,7 +512,7 @@ protected static String getJavaMethodAsString(JavaExecutable javaExecutable) {
*/
private void init() {
// defaultAuthor
if (StringUtils.isEmpty(defaultAuthor)) {
if (defaultAuthor == null || defaultAuthor.isEmpty()) {
defaultAuthor = System.getProperty("user.name");
}

Expand Down Expand Up @@ -550,7 +550,7 @@ private void init() {
fixTagsSplitted = StringUtils.split(fixTags, ",");

// encoding
if (StringUtils.isEmpty(encoding)) {
if (encoding == null || encoding.isEmpty()) {
if (getLog().isWarnEnabled()) {
getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
Expand Down Expand Up @@ -1027,7 +1027,7 @@ private void takeCareSingleComment(

String javadocComment = trimRight(extractOriginalJavadoc(originalContent, entity));
String extraComment = javadocComment.substring(javadocComment.indexOf(END_JAVADOC) + END_JAVADOC.length());
if (StringUtils.isNotEmpty(extraComment)) {
if (extraComment != null && !extraComment.isEmpty()) {
if (extraComment.contains(EOL)) {
stringWriter.write(extraComment.substring(extraComment.indexOf(EOL) + EOL.length()));
} else {
Expand Down Expand Up @@ -1082,7 +1082,7 @@ private boolean isInLevel(List<String> modifiers) {
}

if (LEVEL_PROTECTED.equalsIgnoreCase(level.trim())) {
return (modifiers.contains(LEVEL_PUBLIC) || modifiers.contains(LEVEL_PROTECTED));
return modifiers.contains(LEVEL_PUBLIC) || modifiers.contains(LEVEL_PROTECTED);
}

if (LEVEL_PACKAGE.equalsIgnoreCase(level.trim())) {
Expand Down Expand Up @@ -1887,7 +1887,7 @@ private void writeReturnTag(
return;
}

if (StringUtils.isNotEmpty(originalJavadocTag)
if ((originalJavadocTag != null && !originalJavadocTag.isEmpty())
&& javaMethod.getReturns() != null
&& !javaMethod.getReturns().isVoid()) {
sb.append(originalJavadocTag);
Expand Down Expand Up @@ -3044,7 +3044,7 @@ private static String alignIndentationJavadocLines(final String content, final S
* @return the indentation for the given line.
*/
private static String autodetectIndentation(final String line) {
if (StringUtils.isEmpty(line)) {
if (line == null || line.isEmpty()) {
return "";
}

Expand Down Expand Up @@ -3084,7 +3084,7 @@ private static String[] getLines(final String content) throws IOException {
* @return the text trimmed on left side or empty if text is null.
*/
private static String trimLeft(final String text) {
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(text.trim())) {
if ((text == null || text.isEmpty()) || StringUtils.isEmpty(text.trim())) {
return "";
}

Expand All @@ -3106,7 +3106,7 @@ private static String trimLeft(final String text) {
* @return the text trimmed on tight side or empty if text is null.
*/
private static String trimRight(final String text) {
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(text.trim())) {
if ((text == null || text.isEmpty()) || StringUtils.isEmpty(text.trim())) {
return "";
}

Expand Down