Browse Source

Vector is iterable

master
Gintas Grigelionis 7 years ago
parent
commit
0020d1a16b
3 changed files with 7 additions and 12 deletions
  1. +5
    -8
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
  3. +1
    -3
      src/main/org/apache/tools/ant/types/FilterSet.java

+ 5
- 8
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -742,8 +742,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
private InputStream loadResource(final String name) { private InputStream loadResource(final String name) {
// we need to search the components of the path to see if we can // we need to search the components of the path to see if we can
// find the class we want. // find the class we want.
return Collections.list(pathComponents.elements()).stream()
.map(path -> getResourceStream(path, name))
return pathComponents.stream().map(path -> getResourceStream(path, name))
.filter(Objects::nonNull).findFirst().orElse(null); .filter(Objects::nonNull).findFirst().orElse(null);
} }


@@ -826,10 +825,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo


// TODO - shouldn't this always return false in isolated mode? // TODO - shouldn't this always return false in isolated mode?


return Collections.list(loaderPackages.elements()).stream()
.noneMatch(resourceName::startsWith)
&& (Collections.list(systemPackages.elements()).stream()
.anyMatch(resourceName::startsWith) || parentFirst);
return loaderPackages.stream().noneMatch(resourceName::startsWith)
&& (systemPackages.stream().anyMatch(resourceName::startsWith) || parentFirst);
} }


/** /**
@@ -869,7 +866,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
} else { } else {
// try and load from this loader if the parent either didn't find // try and load from this loader if the parent either didn't find
// it or wasn't consulted. // it or wasn't consulted.
for (final File pathComponent : Collections.list(pathComponents.elements())) {
for (final File pathComponent : pathComponents) {
url = getResourceURL(pathComponent, name); url = getResourceURL(pathComponent, name);
if (url != null) { if (url != null) {
log("Resource " + name + " loaded from ant loader", Project.MSG_DEBUG); log("Resource " + name + " loaded from ant loader", Project.MSG_DEBUG);
@@ -1343,7 +1340,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
// we need to search the components of the path to see if // we need to search the components of the path to see if
// we can find the class we want. // we can find the class we want.
final String classFilename = getClassFilename(name); final String classFilename = getClassFilename(name);
for (final File pathComponent : Collections.list(pathComponents.elements())) {
for (final File pathComponent : pathComponents) {
InputStream stream = null; InputStream stream = null;
try { try {
stream = getResourceStream(pathComponent, classFilename); stream = getResourceStream(pathComponent, classFilename);


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

@@ -737,7 +737,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {
newJarStream.setLevel(0); newJarStream.setLevel(0);


// Copy files from old WebSphere jar // Copy files from old WebSphere jar
for (JarEntry je : Collections.list(wasEntries.elements())) {
for (JarEntry je : wasEntries.values()) {
if (je.getCompressedSize() == -1 if (je.getCompressedSize() == -1
|| je.getCompressedSize() == je.getSize()) { || je.getCompressedSize() == je.getSize()) {
newJarStream.setLevel(0); newJarStream.setLevel(0);


+ 1
- 3
src/main/org/apache/tools/ant/types/FilterSet.java View File

@@ -20,7 +20,6 @@ package org.apache.tools.ant.types;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Collections;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@@ -252,8 +251,7 @@ public class FilterSet extends DataType implements Cloneable {
dieOnCircularReference(); dieOnCircularReference();
if (filterHash == null) { if (filterHash == null) {
filterHash = new Hashtable<>(getFilters().size()); filterHash = new Hashtable<>(getFilters().size());
Collections.list(getFilters().elements())
.forEach(filter -> filterHash.put(filter.getToken(), filter.getValue()));
getFilters().forEach(filter -> filterHash.put(filter.getToken(), filter.getValue()));
} }
return filterHash; return filterHash;
} }


Loading…
Cancel
Save