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?
2. Should we just silently drop nulls?
3. Should we establish patterns/methods for validation and better error messages in this case?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to