You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/09/15 01:18:32 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/intake IntakeTool.java

henning     2003/09/14 16:18:32

  Modified:    src/java/org/apache/turbine/services/intake Tag:
                        TURBINE_2_3_BRANCH IntakeTool.java
  Log:
  Fix NPE in get()tting  groups from the Intake Tool. Make sure that get(group,key,create)
  behaves the same as get(group,key)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.17.2.1  +15 -3     jakarta-turbine-2/src/java/org/apache/turbine/services/intake/IntakeTool.java
  
  Index: IntakeTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/IntakeTool.java,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- IntakeTool.java	11 Apr 2003 13:15:09 -0000	1.17
  +++ IntakeTool.java	14 Sep 2003 23:18:32 -0000	1.17.2.1
  @@ -406,7 +406,9 @@
           {
               throw new IntakeException("Intake.get: key == null");
           }
  -        return ((PullHelper) get(groupName)).setKey(key);
  +
  +        PullHelper ph = get(groupName);
  +        return (ph == null) ? null : ph.setKey(key);
       }
   
       /**
  @@ -416,7 +418,17 @@
       public Group get(String groupName, String key, boolean create)
               throws IntakeException
       {
  -        return ((PullHelper) get(groupName)).setKey(key, create);
  +        if (groupName == null)
  +        {
  +            throw new IntakeException("Intake.get: groupName == null");
  +        }
  +        if (key == null)
  +        {
  +            throw new IntakeException("Intake.get: key == null");
  +        }
  +
  +        PullHelper ph = get(groupName);
  +        return (ph == null) ? null : ph.setKey(key, create);
       }
   
       /**