jon         01/08/13 11:05:15

  Modified:    src/java/org/apache/turbine/services/intake
                        IntakeService.java TurbineIntake.java
                        TurbineIntakeService.java
               src/java/org/apache/turbine/services/intake/xmlmodel
                        AppData.java
  Log:
  added a bit more error checking
  
  Revision  Changes    Path
  1.15      +3 -2      
jakarta-turbine/src/java/org/apache/turbine/services/intake/IntakeService.java
  
  Index: IntakeService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/IntakeService.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- IntakeService.java        2001/08/10 12:12:29     1.14
  +++ IntakeService.java        2001/08/13 18:05:15     1.15
  @@ -65,7 +65,7 @@
    * on an XML specification.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
  - * @version $Id: IntakeService.java,v 1.14 2001/08/10 12:12:29 knielsen Exp $
  + * @version $Id: IntakeService.java,v 1.15 2001/08/13 18:05:15 jon Exp $
    */
   public interface IntakeService
   {
  @@ -134,8 +134,9 @@
        * Gets the capacity of the pool for a named group.
        *
        * @param groupName the name of the group.
  +     * @throws Exception if groupName is null
        */
  -    public int getCapacity(String groupName);
  +    public int getCapacity(String groupName) throws Exception;
   
       /**
        * Sets the capacity of the pool for a named group.
  
  
  
  1.12      +8 -1      
jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntake.java
  
  Index: TurbineIntake.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntake.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TurbineIntake.java        2001/08/10 12:12:29     1.11
  +++ TurbineIntake.java        2001/08/13 18:05:15     1.12
  @@ -67,7 +67,7 @@
    * the settings in TurbineResources.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
  - * @version $Id: TurbineIntake.java,v 1.11 2001/08/10 12:12:29 knielsen Exp $
  + * @version $Id: TurbineIntake.java,v 1.12 2001/08/13 18:05:15 jon Exp $
    */
   public abstract class TurbineIntake
   {
  @@ -82,8 +82,14 @@
       public static Group getGroup(String groupName)
           throws ServiceException
       {
  +        if (groupName == null)
  +        {
  +            throw new ServiceException (
  +                "TurbineIntake.getGroup(groupName) is null");
  +        }
           return getService().getGroup(groupName);
       }
  +    
       /**
        * Gets an instance of a named group either from the pool
        * or by calling the Factory Service if the pool is empty and
  @@ -135,6 +141,7 @@
        * @param groupName the name of the group.
        */
       public static int getCapacity(String groupName)
  +        throws Exception
       {
           return getService().getCapacity(groupName);
       }
  
  
  
  1.24      +11 -5     
jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntakeService.java
  
  Index: TurbineIntakeService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntakeService.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- TurbineIntakeService.java 2001/08/12 23:38:52     1.23
  +++ TurbineIntakeService.java 2001/08/13 18:05:15     1.24
  @@ -87,7 +87,7 @@
    * on an XML specification.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
  - * @version $Id: TurbineIntakeService.java,v 1.23 2001/08/12 23:38:52 jon Exp $
  + * @version $Id: TurbineIntakeService.java,v 1.24 2001/08/13 18:05:15 jon Exp $
    */
   public class TurbineIntakeService
       extends BaseService
  @@ -375,6 +375,11 @@
       public Group getGroup(String groupName)
               throws ServiceException
       {
  +        if (groupName == null)
  +        {
  +            throw new ServiceException (
  +                "Intake TurbineIntakeService.getGroup(groupName) is null");
  +        }
           Group instance = (Group)pollInstance(groupName);
           if ( instance == null )
           {
  @@ -425,6 +430,7 @@
        * @param name the name of the class.
        */
       public int getCapacity(String name)
  +        throws Exception
       {
           int capacity = DEFAULT_POOL_CAPACITY;
           PoolBuffer pool = (PoolBuffer) poolRepository.get(name);
  @@ -434,14 +440,16 @@
               {
                   capacity = Integer
                       .parseInt(appData.getGroup(name).getPoolCapacity());
  +            }
  +            catch (NumberFormatException nfe)
  +            {
  +                // Ignored
               }
  -            catch (NumberFormatException nfe) {}
           }
           else
           {
               capacity = pool.capacity();
           }
  -
           return capacity;
       }
   
  @@ -576,7 +584,6 @@
                   }
               }
           }
  -
           return method;
       }
   
  @@ -606,7 +613,6 @@
                   }
               }
           }
  -
           return method;
       }
   
  
  
  
  1.7       +7 -1      
jakarta-turbine/src/java/org/apache/turbine/services/intake/xmlmodel/AppData.java
  
  Index: AppData.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/xmlmodel/AppData.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AppData.java      2001/08/10 12:12:30     1.6
  +++ AppData.java      2001/08/13 18:05:15     1.7
  @@ -63,7 +63,7 @@
    * A class for holding application data structures.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]>John McNally</a>
  - * @version $Id: AppData.java,v 1.6 2001/08/10 12:12:30 knielsen Exp $
  + * @version $Id: AppData.java,v 1.7 2001/08/13 18:05:15 jon Exp $
    */
   public class AppData
       implements java.io.Serializable
  @@ -118,7 +118,13 @@
        * @return a <code>XmlGroup</code> value
        */
       public XmlGroup getGroup(String groupName)
  +        throws Exception
       {
  +        if (groupName == null)
  +        {
  +            throw new Exception (
  +                "Intake AppData.getGroup(groupName) is null");
  +        }
           XmlGroup group = null;
           Iterator iter = inputs.iterator();
           do
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to