ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [4/4] ant git commit: Merge branch '1.9.x'
Date Fri, 09 Feb 2018 17:50:47 GMT
Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/e90f7119
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/e90f7119
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/e90f7119

Branch: refs/heads/master
Commit: e90f71193adc819ee27d2067cbd662ce7efacaf4
Parents: 3bb66d9 21b8700
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Fri Feb 9 18:49:52 2018 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Fri Feb 9 18:49:52 2018 +0100

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/taskdefs/Copy.java                | 5 ++++-
 src/main/org/apache/tools/ant/taskdefs/CopyPath.java            | 3 +++
 src/main/org/apache/tools/ant/taskdefs/Rmic.java                | 3 +++
 .../org/apache/tools/ant/taskdefs/optional/Native2Ascii.java    | 5 ++++-
 src/main/org/apache/tools/ant/types/mappers/CutDirsMapper.java  | 3 +++
 src/main/org/apache/tools/ant/types/mappers/FilterMapper.java   | 3 +++
 src/main/org/apache/tools/ant/util/ChainedMapper.java           | 3 +++
 src/main/org/apache/tools/ant/util/FileNameMapper.java          | 4 +++-
 src/main/org/apache/tools/ant/util/FlatFileNameMapper.java      | 2 ++
 src/main/org/apache/tools/ant/util/GlobPatternMapper.java       | 3 +++
 src/main/org/apache/tools/ant/util/RegexpPatternMapper.java     | 3 +++
 11 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/taskdefs/Copy.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/taskdefs/Rmic.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/taskdefs/Rmic.java
index c42ad41,0a54b3e..aa762b1
--- a/src/main/org/apache/tools/ant/taskdefs/Rmic.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Rmic.java
@@@ -705,8 -709,12 +705,11 @@@ public class Rmic extends MatchingTask 
          String classFileName = classname.replace('.', File.separatorChar)
              + ".class";
          String[] generatedFiles = adapter.getMapper().mapFileName(classFileName);
+         if (generatedFiles == null) {
+             return;
+         }
  
 -        for (int i = 0; i < generatedFiles.length; i++) {
 -            final String generatedFile = generatedFiles[i];
 +        for (String generatedFile : generatedFiles) {
              if (!generatedFile.endsWith(".class")) {
                  // don't know how to handle that - a IDL file doesn't
                  // have a corresponding Java source for example.

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/types/mappers/CutDirsMapper.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
index b4c07e9,9ef922e..3a0109b
--- a/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
+++ b/src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
@@@ -64,8 -62,10 +64,11 @@@ public class FilterMapper extends Filte
       * @return  a one-element array of converted filenames, or null if
       *          the filterchain returns an empty string.
       */
 +    @Override
      public String[] mapFileName(String sourceFileName) {
+         if (sourceFileName == null) {
+             return null;
+         }
          try {
              Reader stringReader = new StringReader(sourceFileName);
              ChainReaderHelper helper = new ChainReaderHelper();

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/util/ChainedMapper.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/util/ChainedMapper.java
index 8b3e32f,6e07aa6..cec4f2e
--- a/src/main/org/apache/tools/ant/util/ChainedMapper.java
+++ b/src/main/org/apache/tools/ant/util/ChainedMapper.java
@@@ -30,13 -32,32 +30,16 @@@ import java.util.stream.Stream
  public class ChainedMapper extends ContainerMapper {
  
      /** {@inheritDoc}. */
 +    @Override
      public String[] mapFileName(String sourceFileName) {
 -        List inputs = new ArrayList();
 -        List results = new ArrayList();
 -        // we do this even if the sourceFileName is null. Some
++        // we invoke the chain even if the sourceFileName is null. Some
+         // resources have a null name and users may use a mapper like
+         // MergeMapper to provide a name for it.
 -        results.add(sourceFileName);
 -        FileNameMapper mapper = null;
 -
 -        for (Iterator mIter = getMappers().iterator(); mIter.hasNext();) {
 -            mapper = (FileNameMapper) (mIter.next());
 -            if (mapper != null) {
 -                inputs.clear();
 -                inputs.addAll(results);
 -                results.clear();
 -
 -                for (Iterator it = inputs.iterator(); it.hasNext();) {
 -                    String[] mapped = mapper.mapFileName((String) (it.next()));
 -                    if (mapped != null) {
 -                        results.addAll(Arrays.asList(mapped));
 -                    }
 -                }
 -            }
 -        }
 -        return (results.size() == 0) ? null
 -            : (String[]) results.toArray(new String[results.size()]);
 +        String[] result = getMappers().stream()
 +            .reduce(new String[] { sourceFileName }, (i, m) -> Stream.of(i)
 +                .map(m::mapFileName).filter(Objects::nonNull).flatMap(Stream::of).toArray(String[]::new),
 +                (i, o) -> o);
 +        return result == null || result.length == 0 ? null : result;
      }
  }
  

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
index 8465c78,04d58be..37383b6
--- a/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
+++ b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
@@@ -50,8 -48,8 +50,10 @@@ public class FlatFileNameMapper impleme
       * @param sourceFileName the name to map.
       * @return the file name in a one-element array.
       */
 +    @Override
      public String[] mapFileName(String sourceFileName) {
 +        return new String[] { new java.io.File(sourceFileName).getName() };
+         return sourceFileName == null ? null
+             : new String[] {new java.io.File(sourceFileName).getName()};
      }
  }

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/util/GlobPatternMapper.java
index 8e470ac,a0f0ca9..63a8f36
--- a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
@@@ -153,8 -153,10 +153,11 @@@ public class GlobPatternMapper implemen
       * @param sourceFileName the filename to map
       * @return a list of converted filenames
       */
 +    @Override
      public String[] mapFileName(String sourceFileName) {
+         if (sourceFileName == null) {
+             return null;
+         }
          String modName = modifyName(sourceFileName);
          if (fromPrefix == null
              || (sourceFileName.length() < (prefixLength + postfixLength))

http://git-wip-us.apache.org/repos/asf/ant/blob/e90f7119/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
----------------------------------------------------------------------
diff --cc src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
index 82bc109,6a2f4b5..495a644
--- a/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
@@@ -113,8 -113,10 +113,11 @@@ public class RegexpPatternMapper implem
       * @return a one-element array containing the translated file or
       *         null if the to pattern did not match
       */
 +    @Override
      public String[] mapFileName(String sourceFileName) {
+         if (sourceFileName == null) {
+             return null;
+         }
          if (handleDirSep) {
              if (sourceFileName.indexOf("\\") != -1) {
                  sourceFileName = sourceFileName.replace('\\', '/');


Mime
View raw message