jcricket / gwt-syncproxy

Provides Synchronous and Asynchronous access to GWT-RPC servlets from Java and Android
http://www.blueesoteric.com/open-source/gwt-syncproxy
Apache License 2.0
23 stars 14 forks source link

Class cast exception if ant called from source code #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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:

GoogleCodeExporter commented 9 years ago

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