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.

Bug 193649 - OptionProcessor not called after unknown parameter was encountered
Summary: OptionProcessor not called after unknown parameter was encountered
Status: RESOLVED WONTFIX
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.0
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 193681
Blocks: 168126
  Show dependency tree
 
Reported: 2010-12-20 14:02 UTC by mienamoo
Modified: 2011-02-24 18:52 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mienamoo 2010-12-20 14:02:24 UTC
When running a platform application from the IDE, I noticed that the command line parameters sometimes don't get passed to my OptionProcessor extensions. Debugging into the source, I found the reason.

When an unknown command line parameter is encountered in CommandLine.process, an exception is thrown indicating that the parameter was not processed (line 156). Hence the processing stops after the first unknown parameter.

If the lock file was not deleted after a debugging session, an extra command line parameter is passed: --test-userdir-lock-with-invalid-arg. This parameter is not recognised by any OptionProcessors and hence my parameters (which follow after it) do not get processed. The lock file not being deleted is a separate issue of course. But is it possible to ignore the unknown parameter and continue processing after it?
Comment 1 Antonin Nebuzelsky 2010-12-29 14:30:01 UTC
Reassigning to apisupport/project.

Related to issue 141069.
Comment 2 Jesse Glick 2011-01-07 23:25:52 UTC
Can try putting the bogus arg at the end, after ${run.args.extra}. Please verify fix.
Comment 3 Jesse Glick 2011-01-07 23:26:25 UTC
core-main #84db594dbf6e
Comment 4 Quality Engineering 2011-01-09 06:21:43 UTC
Integrated into 'main-golden', will be available in build *201101090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/84db594dbf6e
User: Jesse Glick <jglick@netbeans.org>
Log: #193649: OptionProcessor not called after unknown parameter was encountered
Comment 5 mienamoo 2011-01-12 15:58:06 UTC
Tested on development build #201101100000.

Thank you for the change in the order of the parameters, it is definitely a welcome one.

However, the issue remains. An exception is still thrown in the class org.netbeans.api.sendopts.CommandLine before the option processors are called, just slightly later than before. So it appears that there is no way to fix this by simply changing the order of the parameters.

Additionally, in a deployed application where the user can specify any command line parameters, it would not be ideal to disregard all the parameters if one is misspelled or simply unknown.
Comment 6 Jesse Glick 2011-01-12 17:11:48 UTC
Then nothing more to be done, I think; you need to delete $userdir/lock if you forcibly terminate the app.
Comment 7 Jesse Glick 2011-02-24 18:50:19 UTC
*** Bug 195885 has been marked as a duplicate of this bug. ***