You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Jeroen Hoffman <j....@onehippo.com> on 2008/11/20 15:56:40 UTC

JetspeedSerializerApplicationImpl patch

Hi,
I've discovered some code in JetspeedSerializerApplicationImpl from the db-tools 
subproject that is not working, when command line arguments are parsed. First, 
at one point there is an "else if" needed instead of an "if" and second, the 
checks and the actual command afterwards need to go outside of the argument 
parsing loop.

I've attached a patch, created from subproject root, could someone review and if 
correct, commit this?

Thanks
Jeroen Hoffman


Re: JetspeedSerializerApplicationImpl patch

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Jeroen,

Thank you very much for the patch! Your patch was applied.
By the way, would you please use `svn diff > mypatch.diff' under the project root folder to save the patch and upload the file to JIRA issue next time? (Or you can do the same task with your other tools.)
If you do, it will be easier to apply the patch. ;-)

Regards,

Woonsan


--- On Thu, 11/20/08, Jeroen Hoffman <j....@onehippo.com> wrote:

> From: Jeroen Hoffman <j....@onehippo.com>
> Subject: JetspeedSerializerApplicationImpl patch
> To: "Jetspeed Developers List" <je...@portals.apache.org>
> Date: Thursday, November 20, 2008, 3:56 PM
> Hi,
> I've discovered some code in
> JetspeedSerializerApplicationImpl from the db-tools
> subproject that is not working, when command line arguments
> are parsed. First, at one point there is an "else
> if" needed instead of an "if" and second, the
> checks and the actual command afterwards need to go outside
> of the argument parsing loop.
> 
> I've attached a patch, created from subproject root,
> could someone review and if correct, commit this?
> 
> Thanks
> Jeroen Hoffman
> 
> Index:
> src/main/java/org/apache/jetspeed/tools/db/serializer/JetspeedSerializerApplicationImpl.java
> ===================================================================
> --- .	(revision 713358)
> +++ .	(working copy)
> @@ -68,7 +68,7 @@
>          {
>              if (args[n].equals("-c"))
>                  categories = args[++n];
> -            if (args[n].equals("-p"))
> +			else if (args[n].equals("-p"))
>                  propertyFileName = args[++n];
>              else if (args[n].equals("-a"))
>                  applicationRootPath = args[++n];
> @@ -90,34 +90,34 @@
>              {
>                  throw new
> IllegalArgumentException("Unknown argument: " +
> args[n]);
>              }
> +        }
> +
> +        if ((!doImport) && (!doExport))
> +        {
> +          throw new IllegalArgumentException("Either
> import or export have to be defined (-I or -E followed by
> the filename");
> +        }
> +
> +        if ((doImport) && (doExport))
> +        {
> +            throw new IllegalArgumentException("Only
> one - either import or export - can be requested");
> +        }
>          
> -            if ((!doImport) && (!doExport))
> -            {
> -              throw new
> IllegalArgumentException("Either import or export have
> to be defined (-I or -E followed by the filename");
> -            }
> -
> -            if ((doImport) && (doExport))
> -            {
> -                throw new
> IllegalArgumentException("Only one - either import or
> export - can be requested");
> -            }
> -            
> -            if (categories == null)
> -            {
> -                throw new
> IllegalArgumentException("Argument -c defining the
> assembly categories filters (or the propertyFile key to it)
> is required");
> -            }
> -            
> -            if (applicationRootPath == null)
> -            {
> -                throw new
> IllegalArgumentException("Argument -a specifying the
> path to (web)application root, is required");
> -            }
> -            if (doImport)
> -            {
> -                app.importFiles(logger,
> applicationRootPath, categories, propertyFileName, null,
> getTokens(fileName));
> -            }
> -            else if (doExport)
> -            {
> -                app.export(logger, applicationRootPath,
> categories, propertyFileName, null, fileName, exportName);
> -            }
> +        if (categories == null)
> +        {
> +            throw new
> IllegalArgumentException("Argument -c defining the
> assembly categories filters (or the propertyFile key to it)
> is required");
> +        }
> +        
> +        if (applicationRootPath == null)
> +        {
> +            throw new
> IllegalArgumentException("Argument -a specifying the
> path to (web)application root, is required");
> +        }
> +        if (doImport)
> +        {
> +            app.importFiles(logger, applicationRootPath,
> categories, propertyFileName, null, getTokens(fileName));
> +        }
> +        else if (doExport)
> +        {
> +            app.export(logger, applicationRootPath,
> categories, propertyFileName, null, fileName, exportName);
>          }
>      }
>          
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail:
> jetspeed-dev-help@portals.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org