zhiqinghuang / lambdaj

Automatically exported from code.google.com/p/lambdaj
Apache License 2.0
0 stars 0 forks source link

Problem with sum if we have null and not null fields #111

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. We have Class A with field Double B.
2. Create List<A> list and put there few objects A.
3. In some A objects we have B = null and in some we have B = 0.0
4. Call sum(list, on(A.class).getB())
5. And got NullPointerException inside lambdaj library:
java.lang.NullPointerException at 
ch.lambdaj.function.aggregate.SumDouble.aggregate(SumDouble.java:28)

I use version 2.4

Original issue reported on code.google.com by vishka.n...@gmail.com on 15 Jul 2013 at 4:52

GoogleCodeExporter commented 8 years ago
I think that problem is in 
ch.lambdaj.function.aggregate.SumDouble.aggregate(Double first, Double second) 
where there is no any null check.

Original comment by vishka.n...@gmail.com on 15 Jul 2013 at 4:55