Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340679 - JGit pgm should extract usage of System.exit() into a Main class wrapper to enable embedding
Summary: JGit pgm should extract usage of System.exit() into a Main class wrapper to e...
Status: RESOLVED WONTFIX
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 0.12   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-22 12:24 EDT by Lincoln Baxter, III CLA
Modified: 2011-05-16 10:34 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lincoln Baxter, III CLA 2011-03-22 12:24:34 EDT
Build Identifier: 

It is currently impossible to use JGit PGM in embedded java applications because of the use of System.exit() in pgm class files.

For example:...



	protected void parseArguments(final String[] args) {
		final CmdLineParser clp = new CmdLineParser(this);
		try {
			clp.parseArgument(args);
		} catch (CmdLineException err) {
			if (!help) {
				System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
				System.exit(1);
			}
		}
        ...
        }

Reproducible: Always

Steps to Reproduce:
1. Run Main.main(args...) with a bad git command
2. JVM exits, which is unrecoverable
Comment 1 Chris Aniszczyk CLA 2011-03-22 12:25:58 EDT
We'd love contributions!

http://wiki.eclipse.org/EGit/Contributor_Guide
Comment 2 Shawn Pearce CLA 2011-05-16 10:34:49 EDT
Use the api package, not the pgm package. The api package offers about the same usage, but is designed to be run from your own application code.