You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Sam Solon <ss...@usa.net> on 2004/05/09 19:00:51 UTC

[PATCH] IntakeTool remove method

I found a problem with the "remove" method in IntakeTool that is
triggered by a "removeAll".

When there is more than one instance of a group and a "removeAll" is
done the "remove" method is called for each of the instances of the
group. If a mutiply instantiated group is the last one to be removed,
it's parameter entries will already have been removed and "getStrings"
returns null, which is not being handled in the code.

I made the following patch against anoncvs TURBINE_2_3_BRANCH

Index: IntakeTool.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/IntakeTool.java,v
retrieving revision 1.17.2.2
diff -u -r1.17.2.2 IntakeTool.java
--- IntakeTool.java     27 Feb 2004 05:48:51 -0000      1.17.2.2
+++ IntakeTool.java     27 Apr 2004 23:21:21 -0000
@@ -406,14 +406,17 @@
  
             pp.remove(INTAKE_GRP);
  
-            for (int i = 0; i < groupKeys.length; i++)
-            {
-                if (!groupKeys[i].equals(group.getGID()))
-                {
-                    pp.add(INTAKE_GRP, groupKeys[i]);
+           if (groupKeys != null)
+           {
+               for (int i = 0; i < groupKeys.length; i++)
+               {
+                           if (!groupKeys[i].equals(group.getGID()))
+                           {
+                       pp.add(INTAKE_GRP, groupKeys[i]);
+                    }
                 }
-            }
-
+            }
+
             try
             {
                 TurbineIntake.releaseGroup(group);




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


RE: [PATCH] IntakeTool remove method

Posted by Eric Pugh <ep...@upstate.com>.
Good call!  I just went and checked fulcrum, and actually the fix is Turbine
specific.  Since Fulcrum components don't have a dependency on Turbine, the
IntakeTool(being a turbine specific piece of code) only exists in Turbine's
codebase..  Thanks for the backstopping!

Eric

> -----Original Message-----
> From: Scott Eade [mailto:seade@backstagetech.com.au]
> Sent: Thursday, May 13, 2004 3:54 PM
> To: Turbine Developers List
> Subject: Re: [PATCH] IntakeTool remove method
>
>
> Eric Pugh wrote:
>
> >I have applied the patch against CVS HEAD.  I had to do it
> manually as the
> >patch for 2_3_branch is somewhat different.  Could you verify
> the patch?  It
> >would be nice to have a unit test demonstrating this problem
> exists and was
> >fixed!  I have added you to project.xml as well.
> >
> And fulcrum...
>
> Scott
>
> --
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


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


Re: [PATCH] IntakeTool remove method

Posted by Scott Eade <se...@backstagetech.com.au>.
Eric Pugh wrote:

>I have applied the patch against CVS HEAD.  I had to do it manually as the
>patch for 2_3_branch is somewhat different.  Could you verify the patch?  It
>would be nice to have a unit test demonstrating this problem exists and was
>fixed!  I have added you to project.xml as well.
>
And fulcrum...

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


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


RE: [PATCH] IntakeTool remove method

Posted by Eric Pugh <ep...@upstate.com>.
I have applied the patch against CVS HEAD.  I had to do it manually as the
patch for 2_3_branch is somewhat different.  Could you verify the patch?  It
would be nice to have a unit test demonstrating this problem exists and was
fixed!  I have added you to project.xml as well.

Eric

> -----Original Message-----
> From: Sam Solon [mailto:ssolon@usa.net]
> Sent: Sunday, May 09, 2004 7:01 PM
> To: turbine-dev@jakarta.apache.org
> Subject: [PATCH] IntakeTool remove method
>
>
> I found a problem with the "remove" method in IntakeTool that is
> triggered by a "removeAll".
>
> When there is more than one instance of a group and a "removeAll" is
> done the "remove" method is called for each of the instances of the
> group. If a mutiply instantiated group is the last one to be removed,
> it's parameter entries will already have been removed and "getStrings"
> returns null, which is not being handled in the code.
>
> I made the following patch against anoncvs TURBINE_2_3_BRANCH
>
> Index: IntakeTool.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/serv
> ices/intake/IntakeTool.java,v
> retrieving revision 1.17.2.2
> diff -u -r1.17.2.2 IntakeTool.java
> --- IntakeTool.java     27 Feb 2004 05:48:51 -0000      1.17.2.2
> +++ IntakeTool.java     27 Apr 2004 23:21:21 -0000
> @@ -406,14 +406,17 @@
>
>              pp.remove(INTAKE_GRP);
>
> -            for (int i = 0; i < groupKeys.length; i++)
> -            {
> -                if (!groupKeys[i].equals(group.getGID()))
> -                {
> -                    pp.add(INTAKE_GRP, groupKeys[i]);
> +           if (groupKeys != null)
> +           {
> +               for (int i = 0; i < groupKeys.length; i++)
> +               {
> +                           if (!groupKeys[i].equals(group.getGID()))
> +                           {
> +                       pp.add(INTAKE_GRP, groupKeys[i]);
> +                    }
>                  }
> -            }
> -
> +            }
> +
>              try
>              {
>                  TurbineIntake.releaseGroup(group);
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


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