You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by Chip Childers <ch...@sungard.com> on 2012/08/16 16:30:38 UTC
Issue with the Whisker CLI
Hi all,
I've found an issue with the Whisker CLI command line parsing logic,
which the diff below resolves. Basically, as it stands in trunk
today, the CLI is only able to run the help function, since the parse
method isn't being provided the full list of possible options.
We're trying to setup Whisker for the CloudStack project, and I was
hoping to use the CLI for development of the required metadata files.
Is there a specific method you would like me to follow to get this fix
(or something more appropriate) into the codebase?
-chip
Index: apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java
===================================================================
--- apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (revision
1373827)
+++ apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (working
copy)
@@ -188,9 +188,13 @@
*/
private boolean printHelp(String[] args) throws ParseException {
final CommandLineOption help = CommandLineOption.PRINT_HELP;
- return help.isSetOn(
- parser().parse(new Options().addOption(
- help.create()), args));
+ try {
+ return help.isSetOn(
+ parser().parse(new Options().addOption(
+ help.create()), args));
+ } catch (ParseException e) {
+ return false;
+ }
}
/**
Re: Issue with the Whisker CLI
Posted by Robert Burrell Donkin <rd...@apache.org>.
On 08/16/12 15:30, Chip Childers wrote:
> Hi all,
Hi Chip
<snip>
> Is there a specific method you would like me to follow to get this fix
> (or something more appropriate) into the codebase?
Committed. Many thanks.
Robert
> -chip
>
>
> Index: apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java
> ===================================================================
> --- apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (revision
> 1373827)
> +++ apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (working
> copy)
> @@ -188,9 +188,13 @@
> */
> private boolean printHelp(String[] args) throws ParseException {
> final CommandLineOption help = CommandLineOption.PRINT_HELP;
> - return help.isSetOn(
> - parser().parse(new Options().addOption(
> - help.create()), args));
> + try {
> + return help.isSetOn(
> + parser().parse(new Options().addOption(
> + help.create()), args));
> + } catch (ParseException e) {
> + return false;
> + }
> }
>
> /**
Re: Issue with the Whisker CLI
Posted by sebb <se...@gmail.com>.
On 18 August 2012 12:48, Robert Burrell Donkin <rd...@apache.org> wrote:
> Chip :-)
>
> On 08/16/12 21:38, Chip Childers wrote:
>
> <snip>
>
>
>> This issue is entirely my fault. I was using the US spelling of
>> organisation.
>
>
> (I always get a bit confused about which is which...)
>
> I'll add a FAQ
>
> but...
>
> The parser could pick this up...
>
> Might be a good idea to log a warning and then handle both spellings[1]
>
> Opinions? Objections?
This is a general issue with Maven poms - invalid tags are not
rejected or even reported.
I'm not sure it's worth supporting alternate spellings - where does one stop?
For example, in the UK licence and license are noun and verb
respectively (cf. advice and advise, which is easier to remember) but
the US seem to use license for both. There may be other possible
variations, if not now, then when new tags are added.
If it's easy to report any unexpected tags, then it might be worth
doing so, but I think the code should only accept one spelling.
> Robert
>
> [1] "be conservative in what you send, liberal in what you accept" (Postal's
> Law)
>
Re: Issue with the Whisker CLI
Posted by Robert Burrell Donkin <rd...@apache.org>.
Chip :-)
On 08/16/12 21:38, Chip Childers wrote:
<snip>
> This issue is entirely my fault. I was using the US spelling of organisation.
(I always get a bit confused about which is which...)
I'll add a FAQ
but...
The parser could pick this up...
Might be a good idea to log a warning and then handle both spellings[1]
Opinions? Objections?
Robert
[1] "be conservative in what you send, liberal in what you accept"
(Postal's Law)
Re: Issue with the Whisker CLI
Posted by Chip Childers <ch...@sungard.com>.
On Thu, Aug 16, 2012 at 4:01 PM, Chip Childers
<ch...@sungard.com> wrote:
> 2 - In the following example, the copyright notice is not being added
> to the LICENSE file output:
>
> Assume the ApacheLicenseVersion2 exists above this snippet. Also
> assume the org for Clinton Begin exists.
>
> [snip...]
> <primary-license id='ApacheLicenseVersion2'>
> <copyright-notice>Copyright (c) 2012 The Apache Software
> Foundation</copyright-notice>
> </primary-license>
> <organisations>
> <organisation
> id='apache.org'
> name='The Apache Software Foundation'
> url='http://www.apache.org/'/>
> <organization
> id='person:Clinton.Begin'
> name='Clinton Begin'
> url='http://code.google.com/p/mybatis/' />
> </organisations>
> <within dir='utils/src/com/cloud/utils/db'>
> <with-license id='ApacheLicenseVersion2'>
> <copyright-notice>
> Copyright (c) 2004 Clinton Begin
> </copyright-notice>
> <by-organization id="person:Clinton.Begin">
> <resource name="ScriptRunner.java"/>
> </by-organization>
> </with-license>
> </within>
> [snip...]
>
> The relevant output is here:
>
> Within the utils/src/com/cloud/utils/db directory
> licensed under the Apache License, Version 2
> http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
>
> As you can see, there's no copyright attribution for that resource.
>
> Thanks in advance for any advice you can offer!
This issue is entirely my fault. I was using the US spelling of organisation.
-chip
Re: Issue with the Whisker CLI
Posted by Robert Burrell Donkin <ro...@blueyonder.co.uk>.
On 08/16/12 21:01, Chip Childers wrote:
<snip>
> 1 - How do I get a NOTICE output using the CLI? Or do I have to use
> Whisker as a Maven plugin.
I would expect that the NOTICE should be generated as well as the
LICENSE (when needed). If it's not then it's like to be a bug.
Robert
Re: Issue with the Whisker CLI
Posted by Chip Childers <ch...@sungard.com>.
On Thu, Aug 16, 2012 at 10:30 AM, Chip Childers
<ch...@sungard.com> wrote:
> Hi all,
>
> I've found an issue with the Whisker CLI command line parsing logic,
> which the diff below resolves. Basically, as it stands in trunk
> today, the CLI is only able to run the help function, since the parse
> method isn't being provided the full list of possible options.
>
> We're trying to setup Whisker for the CloudStack project, and I was
> hoping to use the CLI for development of the required metadata files.
>
> Is there a specific method you would like me to follow to get this fix
> (or something more appropriate) into the codebase?
>
> -chip
>
>
> Index: apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java
> ===================================================================
> --- apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (revision
> 1373827)
> +++ apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (working
> copy)
> @@ -188,9 +188,13 @@
> */
> private boolean printHelp(String[] args) throws ParseException {
> final CommandLineOption help = CommandLineOption.PRINT_HELP;
> - return help.isSetOn(
> - parser().parse(new Options().addOption(
> - help.create()), args));
> + try {
> + return help.isSetOn(
> + parser().parse(new Options().addOption(
> + help.create()), args));
> + } catch (ParseException e) {
> + return false;
> + }
> }
>
> /**
Using a locally patched version (see above patch), I'm making good
progress with using Whisker. Thanks for that goes to this community!
I do have two other Whisker CLI questions:
1 - How do I get a NOTICE output using the CLI? Or do I have to use
Whisker as a Maven plugin.
2 - In the following example, the copyright notice is not being added
to the LICENSE file output:
Assume the ApacheLicenseVersion2 exists above this snippet. Also
assume the org for Clinton Begin exists.
[snip...]
<primary-license id='ApacheLicenseVersion2'>
<copyright-notice>Copyright (c) 2012 The Apache Software
Foundation</copyright-notice>
</primary-license>
<organisations>
<organisation
id='apache.org'
name='The Apache Software Foundation'
url='http://www.apache.org/'/>
<organization
id='person:Clinton.Begin'
name='Clinton Begin'
url='http://code.google.com/p/mybatis/' />
</organisations>
<within dir='utils/src/com/cloud/utils/db'>
<with-license id='ApacheLicenseVersion2'>
<copyright-notice>
Copyright (c) 2004 Clinton Begin
</copyright-notice>
<by-organization id="person:Clinton.Begin">
<resource name="ScriptRunner.java"/>
</by-organization>
</with-license>
</within>
[snip...]
The relevant output is here:
Within the utils/src/com/cloud/utils/db directory
licensed under the Apache License, Version 2
http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
As you can see, there's no copyright attribution for that resource.
Thanks in advance for any advice you can offer!
Re: Issue with the Whisker CLI
Posted by Robert Burrell Donkin <ro...@blueyonder.co.uk>.
On 08/16/12 15:30, Chip Childers wrote:
> Hi all,
>
> I've found an issue with the Whisker CLI command line parsing logic,
> which the diff below resolves. Basically, as it stands in trunk
> today, the CLI is only able to run the help function, since the parse
> method isn't being provided the full list of possible options.
yes :-/
> We're trying to setup Whisker for the CloudStack project, and I was
> hoping to use the CLI for development of the required metadata files.
There's a quick way to do this in the code base, but I don't think it's
been tooled for any interface. I may post more on this a little later...
> Is there a specific method you would like me to follow to get this fix
> (or something more appropriate) into the codebase?
Patches on the mailing list are old skool but still cool :-)
(JIRA is more typical these days)
I'll try to find an suitable integration testing framework to stop this
sort of regression in future...
Robert
> -chip
>
>
> Index: apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java
> ===================================================================
> --- apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (revision
> 1373827)
> +++ apache-whisker-cli/src/main/java/org/apache/creadur/whisker/cli/Main.java (working
> copy)
> @@ -188,9 +188,13 @@
> */
> private boolean printHelp(String[] args) throws ParseException {
> final CommandLineOption help = CommandLineOption.PRINT_HELP;
> - return help.isSetOn(
> - parser().parse(new Options().addOption(
> - help.create()), args));
> + try {
> + return help.isSetOn(
> + parser().parse(new Options().addOption(
> + help.create()), args));
> + } catch (ParseException e) {
> + return false;
> + }
> }
>
> /**