Ant custom task, throwing stackoverflowerror

Source: Internet
Author: User

The ant extension task throws the stackoverflowerror exception. When the inherited task performs the extension task, it uses the LOG method in the project instance of the parent class. At the same time, it uses other output stream instances to output information to the command line, in this case, stackoverflowerror occurs.

Java. Lang. stackoverflowerror

Java source code, which defines an ant task. Pay attention to the application of the project instance.

/*** Custom ant task * @ author wangyancheng * @ version 2011-10-20 */public class simpletask extends task {private project; private list filelistarr = new arraylist (); @ override public void execute () throws buildexception {string message = project. getproperty ("ant. project. name "); Project. log ("here is project" + message + ". ", project. msg_err); Project. log ("My location is" + getlocation (); For (iterator = filelistarr. iterator (); iterator. hasnext ();) {// project. log (iterator. next (). path, project. msg_info); system. out. println (iterator. next (). path) ;}} public void setproject (Project proj) {This. project = proj;} public filelist createfilelist () {filelist = new filelist (); filelistarr. add (filelist); Return filelist;}/*** nested object * @ author wangyancheng * @ version 2011-10-20 */public class filelist {string path; Public filelist () {} Public String getpath () {return path;} public void setpath (string path) {This. path = path ;}}}

Ant source code, which describes ant tasks

<?xml version="1.0" encoding="UTF-8"?>
 
  
   
    
   
   
    
    
     
      
     
    
   
  
 

Exception Information

Buildfile: D:\work\workspace\mywork\leanant\SimpleTask.xmljar:      [jar] Building jar: D:\work\workspace\mywork\leanant\SimpleTask.jarmain:Here is project SimpleTask.My location is D:\work\workspace\mywork\leanant\SimpleTask.xml:9: ABCABCABCABCABCABCABCABCABCABCABCABCBUILD FAILEDD:\work\workspace\mywork\leanant\SimpleTask.xml:9: java.lang.StackOverflowErrorTotal time: 922 milliseconds

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.