On Mon, Mar 3, 2014 at 9:21 AM, Luke Daley <l...@ldaley.com> wrote: > Hi, > > |task blowUp(type: JavaExec) { > main = 'MainClass' > classpath = sourceSets.main.runtimeClasspath > args null > }| > > This produces a less-than-user-friendly NPE: > > |Caused by: java.lang.NullPointerException > at org.gradle.util.GUtil.addToCollection(GUtil.java:135) > at org.gradle.process.internal.JavaExecHandleBuilder.args( > JavaExecHandleBuilder.java:179) > at org.gradle.api.tasks.JavaExec.args(JavaExec.java:261) > at build_7p31187sv6j4incv2nd9fufiog$_run_closure1.doCall(/home/ > kamils/dev/sandbox/gradle/null_arg/build.gradle:6)| > > > We have a PR that proposes just silently ignoring nulls here and in other > similar cases: https://github.com/gradle/gradle/pull/251 > > I'm not sure what we want to do here. Silently ignoring nulls doesn't sit > well with me. I'd prefer we validate the args early and not allow nulls. We > don't seem to do this anywhere though that I could find. > > So: > > 1. Is this current situation good enough? >
-1 > 2. Should we just silently drop nulls? > -1 > 3. Should we establish patterns/methods for validation and better error > messages in this case? > +1 IMHO, Ignoring nulls unavoidably leads inconsistent apis because we won't be able to ignore them everywhere. Cheers! -- Szczepan Faber Principal engineer@gradle; Founder@mockito