ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <duvelbier-tsm...@yahoo.com>
Subject Re: invoking the logger in the constructor
Date Mon, 17 Oct 2005 07:27:16 GMT
When I define only the following constructor : 

<snip>
	/**
	 * 
	 */
	public MyTask() {
		log("Test");
	}
</snip>



The trace I have is the following :

  BUILD FAILED
  C:\MyProject\spike\SpecialLibraries\XLtoCSV\SpecialBuild.xml:21: Could not create type
XLconverter due to java.lang.NullPointerException


but AMOF this "solves" the problem :
<snip>
	/**
	 * 
	 */
	public XLconverter() {
		this(new Project());		
	}
	
	/**
	 * 
	 * @param aProject
	 */
	public XLconverter(Project aProject) {
		super();
		setProject(aProject);
	}
</snip>


I was only reading page 257 of the O'Reilly book...
I am a bit further now !

\T,


--- Peter Reilly <peter.kitt.reilly@gmail.com> wrote:

> The two init calls issue has been fixed in the ant-core SVN head.
> 
> If you want to use log in a constructor, you can use the (Project p)
> constructor:
> 
> public MyCustomTask (Project project)
> {
> setProject(project);
> System.out.println("Instanciated");
> log("Hello");
> 


--
Any fool can write code that a computer can understand. 
Good programmers write code that humans can understand.
                                                   Martin Fowler 
T. : +32 (0)2 742 05 94
M. : +32 (0)497 44 68 12
@  : duvelbier-tsmets@yahoo.com
Do you skype too ... ?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message