jcricket/gwt-syncproxy

Class cast exception if ant called from source code

Closed this issue · 1 comments

What steps will reproduce the problem?
1. Implements cll of ant from source code
        File buildFile = new File("build.xml");
        Project p = new Project();
        p.setUserProperty("ant.file", buildFile.getAbsolutePath());
        DefaultLogger consoleLogger = new DefaultLogger();
        consoleLogger.setErrorPrintStream(System.err);
        consoleLogger.setOutputPrintStream(System.out);
        consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
        p.addBuildListener(consoleLogger);
        p.setProperty("runtime", RUNTIME);
        try {
            p.fireBuildStarted();
            p.init();
            ProjectHelper helper = ProjectHelper.getProjectHelper();
            p.addReference("ant.projectHelper", helper);
            helper.parse(p, buildFile);

            p.executeTarget("compile");
            p.fireBuildFinished(null);
        } catch (BuildException e) {
            p.fireBuildFinished(e);
        }
2. Class cast exception will be raised since class loader is not AntClass 
loader, but AppClassLoader that is already is URL class loader. In this case 
there is no need to replace classloader.

I habe attached patch that fixing this problem

Original issue reported on code.google.com by AlexeyBa...@gmail.com on 22 Aug 2012 at 7:39

Attachments:

Original comment by gwtdevel...@gmail.com on 16 Oct 2012 at 6:59

  • Changed state: Invalid