This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Ability to exit app when wrong CLI options passed in | ||
---|---|---|---|
Product: | platform | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Launchers&CLI | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | AngeloD, apireviews, jglick |
Priority: | P1 | Keywords: | API_REVIEW_FAST |
Version: | 7.0 | ||
Hardware: | Other | ||
OS: | Linux | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: | Implementation and API documentation |
Description
Jaroslav Tulach
2011-02-27 07:56:18 UTC
Created attachment 106488 [details]
Implementation and API documentation
I'd like to get this change into 7.0. That means to integrate by Tuesday. Can I find few reviewers that could approve/verify the change and let me integrate without a week of waiting time? "...when some CLI cannot..." - missing "option" I guess. [JG01] This change seems very magical and relies on an atypical use of a special bundle key. Why does it need to be so complicated? Just define a constant in CommandException: public static final int FORCE_EXIT = -1; // or whatever If some processor throws a CE with this exit code, terminate the app rather than just issuing a warning. (I find it surprising that the exit code param to CE does not already terminate the app; its Javadoc does say "the value to be usually send to as a return value to System.exit".) > relies on an atypical use of a special bundle key C'mon. Using bundles to differentiate the behavior between different applications build on top of Netbeans Platform is normal. Window system does that. If the behavior of the IDE and other applications shall be different, Bundle is a perfect way to specify that. > (I find it surprising that the exit code param to CE does not already terminate > the app; its Javadoc does say "the value to be usually send to as a return > value to System.exit".) Right, the error code shall terminate the app I can change the default in the platform. Shall the NetBeans IDE exit if someone passes non-existent file to --open too? > . Why does it need to be so complicated? Just define a > constant in CommandException: public static final int FORCE_EXIT = -1; OK, this would be compatible extension with a bunch of freedom for OptionProcessor writers. If none of the above approaches is acceptable, then I can implement this one. (In reply to comment #4) > this would be compatible extension with a bunch of freedom for > OptionProcessor writers. And much more discoverable than the current proposal, which forces you to go looking for a magic bundle value hidden in an arch document which is not even in the public API set. I guess I try something else: I exit the system whenever a processor yields non-zero value. I keep the branding API for those who want to keep current behavior. (In reply to comment #6) > I exit the system whenever a processor yields non-zero value. Seems reasonable default behavior, seeing as this is what the documentation already implies. After all, if there is some problem but you _don't_ want your processor to exit, you can simply print a warning message but return 0; is there any other reason to return a nonzero value? (To stop parsing of subsequent args perhaps?) OK, I change the code to exit the application if non-zero code is returned. ergonomics#df53730d2efa Integrated into 'main-golden', will be available in build *201105150400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/df53730d2efa User: Jaroslav Tulach <jtulach@netbeans.org> Log: #196052: Exit when command line options cannot be parsed |