Bug 65148 - AntLauncher terminates enclosing VM
Summary: AntLauncher terminates enclosing VM
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.10.9
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-18 02:03 UTC by Jörn Guy Süß
Modified: 2021-02-18 02:03 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörn Guy Süß 2021-02-18 02:03:38 UTC
org.apache.tools.ant.launch.Launcher.main() is the recommended way to launch ant from Java as per https://ant.apache.org/manual/running.html#viajava . However,

org.apache.tools.ant.launch.Launcher.main()
calls System.exit(exitCode); (l.114)

This means that integrating this launcher will kill a VM on an error.

This issue cannot be addressed by subclassing as the constructor of Launcher is private, not protected, and is called from main().

This means that any reuser either needs to spawn a VM, or copy the class into a private namespace, shadow it or copy the dispatch method under a different name to extend. None of these alternatives is appealing.

Please ensure that this reuse issue is fixed or deprecate the launcher if it  is not intended for this purpose or cannot be used this way.