pbwest      2002/11/29 08:09:16

  Modified:    src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FONode.java
  Log:
  Wrapped attribute handling in exception catching and logging. Get event pool.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.19.2.29 +38 -21    xml-fop/src/org/apache/fop/fo/FONode.java
  
  Index: FONode.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FONode.java,v
  retrieving revision 1.19.2.28
  retrieving revision 1.19.2.29
  diff -u -r1.19.2.28 -r1.19.2.29
  --- FONode.java       22 Nov 2002 02:48:34 -0000      1.19.2.28
  +++ FONode.java       29 Nov 2002 16:09:16 -0000      1.19.2.29
  @@ -7,6 +7,7 @@
   import org.apache.fop.fo.properties.Property;
   import org.apache.fop.fo.expr.PropertyException;
   import org.apache.fop.fo.expr.PropertyParser;
  +import org.apache.fop.fo.expr.FunctionNotImplementedException;
   import org.apache.fop.datatypes.Ints;
   import org.apache.fop.datatypes.PropertyValue;
   import org.apache.fop.datatypes.PropertyValueList;
  @@ -19,6 +20,7 @@
   import org.apache.fop.datastructs.ROBitSet;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.xml.FoXMLEvent;
  +import org.apache.fop.xml.FoXMLEventPool;
   import org.apache.fop.xml.SyncedFoXmlEventsBuffer;
   import org.apache.fop.xml.XMLNamespaces;
   import org.apache.fop.messaging.MessageHandler;
  @@ -105,7 +107,10 @@
           PAGESEQ | FLOW | STATIC | TITLE | MC_MARKER;
   
       /** The buffer from which parser events are drawn. */
  -    protected SyncedFoXmlEventsBuffer xmlevents;
  +    protected final SyncedFoXmlEventsBuffer xmlevents;
  +
  +    /** The pool of <tt>FoXMLEvent</tt>s associated with <i>xmlevents</i>. */
  +    protected final FoXMLEventPool pool;
   
       /** The namespaces object associated with <i>xmlevents</i>. */
       protected XMLNamespaces namespaces;
  @@ -222,6 +227,7 @@
           this.numProps = sparseIndices.length;
           attrBitSet = FOPropertySets.getAttrROBitSet(stateFlags);
           xmlevents = foTree.xmlevents;
  +        pool = xmlevents.getPool();
           namespaces = xmlevents.getNamespaces();
           exprParser = foTree.exprParser;
           propertySet = new PropertyValue[PropNames.LAST_PROPERTY_INDEX + 1];
  @@ -248,7 +254,7 @@
               int property;
               int prop = foKeys[propx].intValue();
               if ( ! attrBitSet.get(prop)) {
  -                MessageHandler.log("Ignoring "
  +                MessageHandler.logln("Ignoring "
                                      + PropNames.getPropertyName(prop)
                                      + " on "
                                      + FObjectNames.getFOName(type)
  @@ -258,30 +264,41 @@
                   continue;
               }
               String attrValue = foAttributes.getFoAttrValue(prop);
  -            props = handleAttrValue(prop, attrValue);
  -            ptype = props.getType();
  -            if (ptype != PropertyValue.LIST) { 
  -                property = props.getProperty();
  -                // Update the propertySet
  -                propertySet[property] = props;
  -                specifiedProps.set(property);
  -                // Handle corresponding properties here
  -            } else { // a list
  -                PropertyValue value;
  -                Iterator propvals = ((PropertyValueList)props).iterator();
  -                while (propvals.hasNext()) {
  -                    value = (PropertyValue)(propvals.next());
  -                    property = value.getProperty();
  -                    propertySet[value.getProperty()] = value;
  +            try {
  +                props = handleAttrValue(prop, attrValue);
  +                ptype = props.getType();
  +                if (ptype != PropertyValue.LIST) { 
  +                    property = props.getProperty();
  +                    // Update the propertySet
  +                    propertySet[property] = props;
                       specifiedProps.set(property);
                       // Handle corresponding properties here
  +                } else { // a list
  +                    PropertyValue value;
  +                    Iterator propvals = ((PropertyValueList)props).iterator();
  +                    while (propvals.hasNext()) {
  +                        value = (PropertyValue)(propvals.next());
  +                        property = value.getProperty();
  +                        propertySet[value.getProperty()] = value;
  +                        specifiedProps.set(property);
  +                        // Handle corresponding properties here
  +                    }
                   }
  +            } catch (FunctionNotImplementedException e) {
  +                MessageHandler.logln
  +                        ("Function not implemented: " + e.getMessage()
  +                         + ". Ignoring property '"
  +                         + PropNames.getPropertyName(prop) + "'.");
  +            } catch (PropertyException e) {
  +                MessageHandler.logln
  +                        ("Problem with '" + PropNames.getPropertyName(prop)
  +                         + "':\n" + e.getMessage() + "\nIgnoring property.");
               }
           }
       }
   
       private PropertyValue handleAttrValue(int property, String attrValue)
  -        throws PropertyException
  +        throws FunctionNotImplementedException, PropertyException
       {
           // parse the expression
           exprParser.resetParser();
  
  
  

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

Reply via email to