Bug 34725 - sysproperty gives unhelpful message when value omitted
Summary: sysproperty gives unhelpful message when value omitted
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5.1
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: ErrorMessage
Depends on:
Blocks:
 
Reported: 2005-05-03 18:27 UTC by smiley
Modified: 2005-05-04 03:24 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description smiley 2005-05-03 18:27:39 UTC
There is nothing wrong with providing system properties such as the following:
  java -DFLAG ExampleClass
rather than
  java -DFLAG=true ExampleClass

I know I can achieve this in a <java> task using
  <jvmarg value="-DFLAG"/>
but since this is actually a system property, I would also expect to be able to
do:
  <sysproperty key="FLAG"/>
but apparently not.  If I miss out the 'value', rather than getting a message 
explaining that ant makes the value mandatory (even though it arguably 
shouldn't be), it just throws a java.lang.NullPointerException.
Comment 1 Stefan Bodewig 2005-05-04 11:24:06 UTC
Fixed in CVS HEAD and HEAD of 1.6.x branch.  It now results in a better error
message.

Checking in src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java;
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java,v  <-- 
ExecuteJava.java
new revision: 1.38.2.8; previous revision: 1.38.2.7
done
More commits to come...
Checking in src/main/org/apache/tools/ant/types/CommandlineJava.java;
/home/cvs/ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v  <-- 
CommandlineJava.java
new revision: 1.47.2.10; previous revision: 1.47.2.9
done
Checking in src/main/org/apache/tools/ant/types/Environment.java;
/home/cvs/ant/src/main/org/apache/tools/ant/types/Environment.java,v  <-- 
Environment.java
new revision: 1.13.2.5; previous revision: 1.13.2.4
done