Community
Participate
Working Groups
Config methods should throw checked Exceptions instead of IllegalArgumentExceptions in case of invalid values: a user can easily introduce invalid values into .git/config. This does not represent an internal or API usage error. The current API, which is using IllegalArgumentException, makes it very hard to detect and handle such cases. see https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03445.html
I've uploaded a draft patch 119970 now to Gerrit, requesting for comments.
I'd like to bring this up again. Maybe we can address this problem as part of a larger concept, as discussed in: https://www.eclipse.org/lists/jgit-dev/msg03582.html (1) In a first step, we could introduce JGitException (extends Exception) and have ConfigInvalidException deriving from it. (2) In a second step we could introduce ConfigIllegalValueException (extends JGitException), as a substitute for the problematic IAEs. At the same time we would generalize "throws ConfigInvalidException" to "throws JGitException" where both kinds of Exceptions would occur. Checked JGitException should be used at least throughout the entire org.eclipse.jgit.internal package. At boundaries to other packages, we can convert into RuntimeExceptions to stay backwards compatible as far as possible. For example, for org.eclipse.jgit.transport, as suggested at: https://www.eclipse.org/lists/jgit-dev/msg03588.html