sandygao    2002/08/08 13:47:13

  Modified:    java/src/org/apache/xerces/util IntStack.java
  Log:
  One more occurrence where exceptions are used as array-resizing conditions.
  Changed them to straight array null/size checking.
  
  Revision  Changes    Path
  1.3       +4 -8      xml-xerces/java/src/org/apache/xerces/util/IntStack.java
  
  Index: IntStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/IntStack.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntStack.java     29 Jan 2002 01:15:18 -0000      1.2
  +++ IntStack.java     8 Aug 2002 20:47:13 -0000       1.3
  @@ -135,19 +135,15 @@
       //
   
       /** Ensures capacity. */
  -    private boolean ensureCapacity(int size) {
  -        try {
  -            return fData[size] != 0;
  -        }
  -        catch (NullPointerException e) {
  +    private void ensureCapacity(int size) {
  +        if (fData == null) {
               fData = new int[32];
           }
  -        catch (ArrayIndexOutOfBoundsException e) {
  +        else if (fData.length <= size) {
               int[] newdata = new int[fData.length * 2];
               System.arraycopy(fData, 0, newdata, 0, fData.length);
               fData = newdata;
           }
  -        return true;
       }
   
   } // class IntStack
  
  
  

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

Reply via email to