Browse Source

Inline/whitespace/format

master
Gintas Grigelionis 7 years ago
parent
commit
96ed9bdfd0
9 changed files with 13 additions and 30 deletions
  1. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/Checksum.java
  2. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
  3. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  4. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  5. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
  6. +1
    -5
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
  7. +2
    -3
      src/main/org/apache/tools/ant/util/FileUtils.java
  8. +1
    -6
      src/main/org/apache/tools/ant/util/Native2AsciiUtils.java
  9. +1
    -2
      src/main/org/apache/tools/tar/TarUtils.java

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

@@ -578,11 +578,7 @@ public class Checksum extends MatchingTask implements Condition {
private String createDigestString(byte[] fileDigest) {
StringBuilder checksumSb = new StringBuilder();
for (byte digestByte : fileDigest) {
String hexStr = Integer.toHexString(BYTE_MASK & digestByte);
if (hexStr.length() < 2) {
checksumSb.append('0');
}
checksumSb.append(hexStr);
checksumSb.append(String.format("%02x", BYTE_MASK & digestByte));
}
return checksumSb.toString();
}


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

@@ -76,9 +76,8 @@ public class ManifestClassPath extends Task {
final FileUtils fileUtils = FileUtils.getFileUtils();
dir = fileUtils.normalize(dir.getAbsolutePath());

String[] elements = path.list();
StringBuilder buffer = new StringBuilder();
for (String element : elements) {
for (String element : path.list()) {
// Normalize the current file
File pathEntry = new File(element);
String fullPath = pathEntry.getAbsolutePath();


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

@@ -906,7 +906,8 @@ public class SQLExec extends JDBCTask {
}

private String maybeQuote(String s) {
if (csvQuoteChar == null || s == null || (!forceCsvQuoteChar && !s.contains(csvColumnSep) && !s.contains(csvQuoteChar))) {
if (csvQuoteChar == null || s == null
|| (!forceCsvQuoteChar && !s.contains(csvColumnSep) && !s.contains(csvQuoteChar))) {
return s;
}
StringBuilder sb = new StringBuilder(csvQuoteChar);


+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -34,7 +34,6 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.StringUtils;
import org.apache.tools.ant.util.facade.FacadeTaskHelper;
import org.apache.tools.ant.util.facade.ImplementationSpecificArgument;

@@ -484,11 +483,10 @@ public class Javah extends Task {
if (c.length > 1) {
message.append("es");
}
message.append(" to be compiled:");
message.append(StringUtils.LINE_SEP);
message.append(String.format(" to be compiled:%n"));
for (String element : c) {
cmd.createArgument().setValue(element);
message.append(" ").append(element).append(StringUtils.LINE_SEP);
message.append(String.format(" %s%n", element));
}
log(message.toString(), Project.MSG_VERBOSE);
}


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

@@ -278,7 +278,7 @@ public class RExecTask extends Task {
} else {
Calendar endTime = Calendar.getInstance();
endTime.add(Calendar.SECOND, timeout);
int read = 0;
int read = 0;
while (read != -1) {
while (Calendar.getInstance().before(endTime) && is.available() == 0) {
Thread.sleep(PAUSE_TIME);
@@ -289,7 +289,7 @@ public class RExecTask extends Task {
"Response timed-out waiting for EOF",
getLocation());
}
read = is.read();
read = is.read();
if (read != -1) {
char c = (char) read;
sb.append(c);


+ 1
- 5
src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java View File

@@ -166,11 +166,7 @@ public class DigestAlgorithm implements Algorithm {
}
StringBuilder checksumSb = new StringBuilder();
for (byte digestByte : messageDigest.digest()) {
String hexStr = Integer.toHexString(BYTE_MASK & digestByte);
if (hexStr.length() < 2) {
checksumSb.append('0');
}
checksumSb.append(hexStr);
checksumSb.append(String.format("%02x", BYTE_MASK & digestByte));
}
return checksumSb.toString();
} catch (IOException ignored) {


+ 2
- 3
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -1073,15 +1073,14 @@ public class FileUtils {
}
final char[] buffer = new char[bufferSize];
int bufferLength = 0;
StringBuilder textBuffer = null;
StringBuilder textBuffer = new StringBuilder();
while (bufferLength != -1) {
bufferLength = rdr.read(buffer);
if (bufferLength > 0) {
textBuffer = (textBuffer == null) ? new StringBuilder() : textBuffer;
textBuffer.append(buffer, 0, bufferLength);
}
}
return (textBuffer == null) ? null : textBuffer.toString();
return (textBuffer.length() == 0) ? null : textBuffer.toString();
}

/**


+ 1
- 6
src/main/org/apache/tools/ant/util/Native2AsciiUtils.java View File

@@ -38,12 +38,7 @@ public class Native2AsciiUtils {
if (c <= MAX_ASCII) {
sb.append(c);
} else {
sb.append("\\u");
String encoded = Integer.toHexString(c);
for (int i = encoded.length(); i < 4; i++) {
sb.append("0");
}
sb.append(encoded);
sb.append(String.format("\\u%04x", (int) c));
}
}
return sb.toString();


+ 1
- 2
src/main/org/apache/tools/tar/TarUtils.java View File

@@ -62,8 +62,7 @@ public class TarUtils {
}

public String decode(final byte[] buffer) {
final int length = buffer.length;
final StringBuilder result = new StringBuilder(length);
final StringBuilder result = new StringBuilder(buffer.length);

for (final byte b : buffer) {
if (b == 0) { // Trailing null


Loading…
Cancel
Save