java-getopt
java-getopt copied to clipboard
System.err.println should not be used within an API
Considering the fact that your great API is supposed to be used in a lot of different contexts like web service (Tomcat, Jetty, ...) as well as applications/other APIs it is very annoying to have calls to System.err.println which
- may be do not produce any output (web service)
- may pollute the user program/other API using GnuGetopt
In my case I have replaced all calls to System.err.println to throw new IllegalArgumentException which leaves it to the user/programmer to decide what he wants to do with the Exception
I second this – Errors should be thrown for the user of the API to handle, not effectively swallowed
Hello. Thanks for your comments. The reason this API prints errors is because the original design goal was 100% compatibility with the glibc version. I will evaluate an option to turn this off for a future update.
Good answer. Yours may turn out to be the better model On Dec 6, 2015 4:37 PM, "arenn" [email protected] wrote:
Hello. Thanks for your comments. The reason this API prints errors is because the original design goal was 100% compatibility with the glibc version. I will evaluate an option to turn this off for a future update.
— Reply to this email directly or view it on GitHub https://github.com/arenn/java-getopt/issues/3#issuecomment-162349813.