Browse Source

Yet more isEmpty()

master
Gintas Grigelionis 7 years ago
parent
commit
547d7a8b88
6 changed files with 15 additions and 23 deletions
  1. +9
    -17
      src/main/org/apache/tools/ant/DefaultLogger.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Zip.java
  4. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java

+ 9
- 17
src/main/org/apache/tools/ant/DefaultLogger.java View File

@@ -150,7 +150,7 @@ public class DefaultLogger implements BuildLogger {
if (verbose || !(error instanceof BuildException)) {
m.append(StringUtils.getStackTrace(error));
} else {
m.append(error).append(StringUtils.LINE_SEP);
m.append(String.format("%s%n", error));
}
}

@@ -166,17 +166,13 @@ public class DefaultLogger implements BuildLogger {
Throwable error = event.getException();
StringBuffer message = new StringBuffer();
if (error == null) {
message.append(StringUtils.LINE_SEP);
message.append(getBuildSuccessfulMessage());
message.append(String.format("%n%s", getBuildSuccessfulMessage()));
} else {
message.append(StringUtils.LINE_SEP);
message.append(getBuildFailedMessage());
message.append(StringUtils.LINE_SEP);
message.append(String.format("%n%s%n", getBuildFailedMessage()));
throwableMessage(message, error, Project.MSG_VERBOSE <= msgOutputLevel);
}
message.append(StringUtils.LINE_SEP);
message.append("Total time: ");
message.append(formatTime(System.currentTimeMillis() - startTime));
message.append(String.format("%nTotal time: %s",
formatTime(System.currentTimeMillis() - startTime)));

String msg = message.toString();
if (error == null) {
@@ -214,9 +210,8 @@ public class DefaultLogger implements BuildLogger {
*/
public void targetStarted(BuildEvent event) {
if (Project.MSG_INFO <= msgOutputLevel
&& !event.getTarget().getName().equals("")) {
String msg = StringUtils.LINE_SEP
+ event.getTarget().getName() + ":";
&& !event.getTarget().getName().isEmpty()) {
String msg = String.format("%n%s:", event.getTarget().getName());
printMessage(msg, out, event.getPriority());
log(msg);
}
@@ -261,7 +256,7 @@ public class DefaultLogger implements BuildLogger {

StringBuilder message = new StringBuilder();
if (event.getTask() == null || emacsMode) {
//emacs mode or there is no task
// emacs mode or there is no task
message.append(event.getMessage());
} else {
// Print out the name of the task if we're in one
@@ -275,10 +270,7 @@ public class DefaultLogger implements BuildLogger {
new BufferedReader(new StringReader(event.getMessage()))) {

message.append(r.lines().map(line -> prefix + line)
.collect(Collectors.joining(StringUtils.LINE_SEP)));
if (message.length() == 0) {
message.append(prefix);
}
.collect(Collectors.joining(System.lineSeparator(), prefix, "")));
} catch (IOException e) {
// shouldn't be possible
message.append(label).append(event.getMessage());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java View File

@@ -133,7 +133,7 @@ public class JikesOutputParser implements ExecuteStreamHandler {

while ((line = reader.readLine()) != null) {
lower = line.toLowerCase();
if (line.trim().equals("")) {
if (line.trim().isEmpty()) {
continue;
}
if (lower.contains("error")) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -1418,7 +1418,7 @@ public class Zip extends MatchingTask {
if (filesets[i] instanceof ZipFileSet) {
final ZipFileSet zfs = (ZipFileSet) filesets[i];
if (zfs.getFullpath(getProject()) != null
&& !zfs.getFullpath(getProject()).equals("")) {
&& !zfs.getFullpath(getProject()).isEmpty()) {
// in this case all files from origin map to
// the fullPath attribute of the zipfileset at
// destination
@@ -1427,7 +1427,7 @@ public class Zip extends MatchingTask {
myMapper = fm;

} else if (zfs.getPrefix(getProject()) != null
&& !zfs.getPrefix(getProject()).equals("")) {
&& !zfs.getPrefix(getProject()).isEmpty()) {
final GlobPatternMapper gm = new GlobPatternMapper();
gm.setFrom("*");
String prefix = zfs.getPrefix(getProject());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java View File

@@ -543,7 +543,7 @@ public class FTPTask extends Task implements FTPTaskConfig {
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setServerLanguageCodeConfig(String serverLanguageCode) {
if (serverLanguageCode != null && !serverLanguageCode.equals("")) {
if (serverLanguageCode != null && !serverLanguageCode.isEmpty()) {
this.serverLanguageCodeConfig = serverLanguageCode;
configurationHasBeenSet();
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -463,7 +463,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
// Use getShortLabel() so labels longer then 30 char are truncated
// and the user is warned
String shortLabel = getShortLabel();
if (shortLabel != null && !shortLabel.equals("")) {
if (shortLabel != null && !shortLabel.isEmpty()) {
versionDateLabel = FLAG_VERSION_LABEL + shortLabel;
}
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java View File

@@ -41,7 +41,7 @@ public class MSVSSLABEL extends MSVSS {
}

String label = getLabel();
if (label.equals("")) {
if (label.isEmpty()) {
String msg = "label attribute must be set!";
throw new BuildException(msg, getLocation());
}


Loading…
Cancel
Save