pbwest      2002/11/26 18:43:59

  Modified:    src/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design
                        ActiveState.java AlignmentAdjust.java
                        AlignmentBaseline.java BorderCommonStyle.java
                        BreakCommon.java CaptionSide.java Clear.java
                        ColorNonTransparent.java ColorTransparent.java
                        DominantBaseline.java Float.java FontStretch.java
                        ForcePageCount.java PageBreakCommon.java
                        RegionName.java RenderingIntent.java RuleStyle.java
                        TextAlign.java TextAlignLast.java
                        VerticalAlign.java WhiteSpaceTreatment.java
                        WritingMode.java
  Log:
  Added error checking for getEnumIndex() and getEnumText().
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/ActiveState.java
  
  Index: ActiveState.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/ActiveState.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ActiveState.java  31 Oct 2002 01:52:07 -0000      1.1.2.3
  +++ ActiveState.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -38,10 +38,19 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/AlignmentAdjust.java
  
  Index: AlignmentAdjust.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/AlignmentAdjust.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- AlignmentAdjust.java      31 Oct 2002 01:52:07 -0000      1.1.2.3
  +++ AlignmentAdjust.java      27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -51,10 +51,19 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/AlignmentBaseline.java
  
  Index: AlignmentBaseline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/AlignmentBaseline.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- AlignmentBaseline.java    31 Oct 2002 01:52:07 -0000      1.1.2.3
  +++ AlignmentBaseline.java    27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -50,10 +50,19 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderCommonStyle.java
  
  Index: BorderCommonStyle.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderCommonStyle.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderCommonStyle.java    31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderCommonStyle.java    27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -43,10 +43,19 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/BreakCommon.java
  
  Index: BreakCommon.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BreakCommon.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BreakCommon.java  31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BreakCommon.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -29,10 +29,19 @@
           }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/CaptionSide.java
  
  Index: CaptionSide.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/CaptionSide.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- CaptionSide.java  31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ CaptionSide.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -53,10 +53,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/Clear.java
  
  Index: Clear.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/Clear.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Clear.java        31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ Clear.java        27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -38,10 +38,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/ColorNonTransparent.java
  
  Index: ColorNonTransparent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/ColorNonTransparent.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ColorNonTransparent.java  31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ ColorNonTransparent.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -25,10 +25,19 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +13 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/ColorTransparent.java
  
  Index: ColorTransparent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/ColorTransparent.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ColorTransparent.java     31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ ColorTransparent.java     27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -25,10 +25,20 @@
        }
       }
   
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/DominantBaseline.java
  
  Index: DominantBaseline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/DominantBaseline.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- DominantBaseline.java     31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ DominantBaseline.java     27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -47,10 +47,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/Float.java
  
  Index: Float.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/Float.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Float.java        31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ Float.java        27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -36,10 +36,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/FontStretch.java
  
  Index: FontStretch.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/FontStretch.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- FontStretch.java  31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ FontStretch.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -58,10 +58,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/ForcePageCount.java
  
  Index: ForcePageCount.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/ForcePageCount.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ForcePageCount.java       31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ ForcePageCount.java       27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -37,10 +37,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +15 -9     
xml-fop/src/org/apache/fop/fo/properties/Attic/PageBreakCommon.java
  
  Index: PageBreakCommon.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/PageBreakCommon.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- PageBreakCommon.java      31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ PageBreakCommon.java      27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -42,10 +42,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   
  @@ -73,8 +82,7 @@
            previousNext = PropNames.KEEP_WITH_NEXT;
            break;
        default:
  -         throw new PropertyException
  -             ("Unknown property in PageBreakCommon: "
  +         throw new PropertyException("Unknown property in PageBreakCommon: "
                    + PropNames.getPropertyName(property));
        }
           if (value instanceof Inherit |
  @@ -91,8 +99,7 @@
               try {
                   enum = new EnumType(value.getProperty(), ncname);
               } catch (PropertyException e) {
  -                throw new PropertyException
  -                ("Unrecognized NCName in page-break-after: " + ncname);
  +                throw new PropertyException                ("Unrecognized NCName in 
page-break-after: " + ncname);
               }
               PropertyValueList list = new PropertyValueList(property);
               switch (enum.getEnumValue()) {
  @@ -115,8 +122,7 @@
               }
           }
   
  -        throw new PropertyException
  -            ("Invalid value for '" + PropNames.getPropertyName(property)
  +        throw new PropertyException            ("Invalid value for '" + 
PropNames.getPropertyName(property)
                   + "': " + value.getClass().getName());
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/RegionName.java
  
  Index: RegionName.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/RegionName.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- RegionName.java   31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ RegionName.java   27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -40,10 +40,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/RenderingIntent.java
  
  Index: RenderingIntent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/RenderingIntent.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- RenderingIntent.java      31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ RenderingIntent.java      27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -34,10 +34,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/RuleStyle.java
  
  Index: RuleStyle.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/RuleStyle.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- RuleStyle.java    31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ RuleStyle.java    27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -46,10 +46,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/TextAlign.java
  
  Index: TextAlign.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/TextAlign.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- TextAlign.java    31 Oct 2002 01:52:09 -0000      1.1.2.3
  +++ TextAlign.java    27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -51,10 +51,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/TextAlignLast.java
  
  Index: TextAlignLast.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/TextAlignLast.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- TextAlignLast.java        31 Oct 2002 01:52:09 -0000      1.1.2.3
  +++ TextAlignLast.java        27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -53,10 +53,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/VerticalAlign.java
  
  Index: VerticalAlign.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/VerticalAlign.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- VerticalAlign.java        31 Oct 2002 01:52:09 -0000      1.1.2.3
  +++ VerticalAlign.java        27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -50,10 +50,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     
xml-fop/src/org/apache/fop/fo/properties/Attic/WhiteSpaceTreatment.java
  
  Index: WhiteSpaceTreatment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/WhiteSpaceTreatment.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- WhiteSpaceTreatment.java  31 Oct 2002 01:52:09 -0000      1.1.2.3
  +++ WhiteSpaceTreatment.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -43,10 +43,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  
  1.1.2.4   +12 -3     xml-fop/src/org/apache/fop/fo/properties/Attic/WritingMode.java
  
  Index: WritingMode.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/WritingMode.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- WritingMode.java  31 Oct 2002 01:52:09 -0000      1.1.2.3
  +++ WritingMode.java  27 Nov 2002 02:43:58 -0000      1.1.2.4
  @@ -45,10 +45,19 @@
                                   (Object) Ints.consts.get(i));
           }
       }
  -    public int getEnumIndex(String enum) {
  -        return ((Integer)(rwEnumHash.get(enum))).intValue();
  +    public int getEnumIndex(String enum)
  +        throws PropertyException
  +    {
  +        Integer ii = (Integer)(rwEnumHash.get(enum));
  +        if (ii == null)
  +            throw new PropertyException("Unknown enum value: " + enum);
  +        return ii.intValue();
       }
  -    public String getEnumText(int index) {
  +    public String getEnumText(int index)
  +        throws PropertyException
  +    {
  +        if (index < 1 || index >= rwEnums.length)
  +            throw new PropertyException("index out of range: " + index);
           return rwEnums[index];
       }
   }
  
  
  

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

Reply via email to