You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2018/02/08 13:42:53 UTC
[Bug 62086] New: NullPointerException in ChainedMapper.mapFileName
when building Lucene with Ant 1.10.2
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
Bug ID: 62086
Summary: NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Product: Ant
Version: 1.10.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: notifications@ant.apache.org
Reporter: jpountz@gmail.com
Target Milestone: ---
Ant 1.10.2 fails to build Lucene/Solr while 1.10.1 succeeds. Here is what the
error looks like:
BUILD FAILED
/home/jpountz/src/lucene-solr/build.xml:21: The following error occurred while
executing this line:
/home/jpountz/src/lucene-solr/lucene/common-build.xml:624:
java.lang.NullPointerException
at java.base/java.util.Arrays.stream(Arrays.java:5610)
at java.base/java.util.stream.Stream.of(Stream.java:1187)
at
java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
at
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550)
at
java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at
java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:450)
at
org.apache.tools.ant.util.ChainedMapper.lambda$mapFileName$1(ChainedMapper.java:36)
at
java.base/java.util.stream.ReduceOps$1ReducingSink.accept(ReduceOps.java:80)
at
java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1494)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:496)
at
org.apache.tools.ant.util.ChainedMapper.mapFileName(ChainedMapper.java:35)
at
org.apache.tools.ant.util.CompositeMapper.lambda$mapFileName$0(CompositeMapper.java:32)
at
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at
java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at
java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1494)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550)
at
java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at
java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:450)
at
org.apache.tools.ant.util.CompositeMapper.mapFileName(CompositeMapper.java:33)
at
org.apache.tools.ant.taskdefs.PathConvert.execute(PathConvert.java:363)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:346)
at org.apache.tools.ant.Target.execute(Target.java:448)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:172)
at
org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:221)
at
org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:165)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:346)
at org.apache.tools.ant.Target.execute(Target.java:448)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:183)
at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
at org.apache.tools.ant.Main.runBuild(Main.java:824)
at org.apache.tools.ant.Main.startAnt(Main.java:228)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Total time: 0 seconds
This is due to the fact that ChainedMapper.mapFileName was refactored to use
streams rather than an explicit for loop but some null checks haven't been
migrated.
Specifically, one of the sub mappers is a GlobPatternMapper, which sometimes
returns null. This is problematic since ChainedMapper.mapFileNamp calls
Arrays.stream on the result array without checking for nulls.
Replacing ".map(m::mapFileName).flatMap(Stream::of).toArray(String[]::new)"
with
".map(m::mapFileName).filter(Objects::nonNull).flatMap(Stream::of).toArray(String[]::new)"
seems to fix the issue but I don't know Ant well enough to know whether this is
the appropriate fix.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
Jaikiran Pai <ja...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |1.10.3
Resolution|--- |FIXED
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
--- Comment #5 from Stefan Bodewig <bo...@apache.org> ---
I just merged Adrien's test and it passes in the 1.9,x branch, so we "only"
need a new 1.10.x release.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
--- Comment #3 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
Looks good, Adrien. +1 to fix this ASAP as it's a regression in a minor update!
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
--- Comment #1 from Jaikiran Pai <ja...@apache.org> ---
I think the change you suggest is fine. Would you like to submit a pull request
with this change to our github repo here https://github.com/apache/ant so that
it can be reviewed and merged?
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
--- Comment #4 from Stefan Bodewig <bo...@apache.org> ---
we'll need to check whether 1.9.10 is affected as well - the Streams
refactoring didn't happen over there, so chances are it is not.
Looking at bug 62076 we probably ought to look at a few more places where the
results of mappers are used and check how they deal with null return values.
@Uwe we would have caught this earlier if Lucene still was built by Gump ;-)
Seriously, I agree a new release should be following soonish. Many thnk for the
quick report and patch, Adrien.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 62086] NullPointerException in ChainedMapper.mapFileName when
building Lucene with Ant 1.10.2
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62086
--- Comment #2 from Adrien Grand <jp...@gmail.com> ---
Done at https://github.com/apache/ant/pull/59.
--
You are receiving this mail because:
You are the assignee for the bug.