Browse Source

Use Bulk operation instead of iteration.

master
Arturo Bernal 3 years ago
parent
commit
6718c526a8
5 changed files with 6 additions and 7 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
  4. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  5. +2
    -3
      src/main/org/apache/tools/tar/TarOutputStream.java

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

@@ -470,7 +470,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
try (InputStream in = Files.newInputStream(weblogicDD.toPath())) { try (InputStream in = Files.newInputStream(weblogicDD.toPath())) {
saxParser.parse(new InputSource(in), handler); saxParser.parse(new InputSource(in), handler);
} }
handler.getFiles().forEach(ejbFiles::put);
ejbFiles.putAll(handler.getFiles());
} catch (Exception e) { } catch (Exception e) {
throw new BuildException( throw new BuildException(
"Exception while adding Vendor specific files: " "Exception while adding Vendor specific files: "


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

@@ -1220,7 +1220,7 @@ public class JUnitTask extends Task {
+ propsFile.getAbsolutePath()); + propsFile.getAbsolutePath());
final Hashtable<String, Object> p = getProject().getProperties(); final Hashtable<String, Object> p = getProject().getProperties();
final Properties props = new Properties(); final Properties props = new Properties();
p.forEach(props::put);
props.putAll(p);
try { try {
final OutputStream outstream = Files.newOutputStream(propsFile.toPath()); final OutputStream outstream = Files.newOutputStream(propsFile.toPath());
props.store(outstream, "Ant JUnitTask generated properties file"); props.store(outstream, "Ant JUnitTask generated properties file");


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

@@ -472,7 +472,7 @@ public class JUnitTest extends BaseTest implements Cloneable {
*/ */
public void setProperties(Hashtable<?, ?> p) { public void setProperties(Hashtable<?, ?> p) {
props = new Properties(); props = new Properties();
p.forEach(props::put);
props.putAll(p);
} }


/** /**


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

@@ -981,7 +981,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
} }


// Add/overlay system properties on the properties from the Ant project // Add/overlay system properties on the properties from the Ant project
System.getProperties().forEach(props::put);
props.putAll(System.getProperties());


int returnCode = SUCCESS; int returnCode = SUCCESS;
if (multipleTests) { if (multipleTests) {


+ 2
- 3
src/main/org/apache/tools/tar/TarOutputStream.java View File

@@ -29,6 +29,7 @@ import java.io.OutputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -537,9 +538,7 @@ public class TarOutputStream extends FilterOutputStream {
* An EOF record consists of a record of all zeros. * An EOF record consists of a record of all zeros.
*/ */
private void writeEOFRecord() throws IOException { private void writeEOFRecord() throws IOException {
for (int i = 0; i < recordBuf.length; ++i) {
recordBuf[i] = 0;
}
Arrays.fill(recordBuf, (byte) 0);


buffer.writeRecord(recordBuf); buffer.writeRecord(recordBuf);
} }


Loading…
Cancel
Save