dmitri      2002/11/25 17:33:35

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/axes
                        PredicateContext.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/beans
                        BeanPointer.java CollectionPointer.java
                        DynamicPointer.java DynamicPropertyPointer.java
                        LangAttributePointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/dom
                        DOMAttributePointer.java DOMNodePointer.java
                        NamespacePointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/dynabeans
                        DynaBeanPropertyPointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom
                        JDOMAttributePointer.java JDOMNamespacePointer.java
                        JDOMNodePointer.java
               jxpath/src/java/org/apache/commons/jxpath/util
                        ValueUtils.java
               jxpath/src/test/org/apache/commons/jxpath/ri/compiler
                        ExtensionFunctionTest.java TestFunctions.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model
                        BeanModelTestCase.java
                        TestDynamicPropertyFactory.java
                        XMLModelTestCase.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/beans
                        TestBeanFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/dom
                        DOMModelTest.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans
                        TestDynaBeanFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom
                        JDOMModelTest.java
  Log:
  Replaced tabs with spaces
  
  Revision  Changes    Path
  1.16      +61 -61    
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/PredicateContext.java
  
  Index: PredicateContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/PredicateContext.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PredicateContext.java     26 Nov 2002 01:20:06 -0000      1.15
  +++ PredicateContext.java     26 Nov 2002 01:33:34 -0000      1.16
  @@ -93,47 +93,47 @@
       }
   
       public boolean nextNode(){
  -             if (done) {
  -                     return false;
  -             }
  -             while (parentContext.nextNode()) {
  -                     if (setupDynamicPropertyPointer()) {
  -                             Object pred = 
nameTestExpression.computeValue(parentContext);
  -                             if (pred instanceof NodePointer) {
  -                                     pred = ((NodePointer) pred).getValue();
  -                             }
  -                             dynamicPropertyPointer.setPropertyName(
  -                                     InfoSetUtil.stringValue(pred));
  -                             position = 1;
  -                             done = true;
  -                             return true;
  -                     }
  -                     else {
  -                             Object pred = expression.computeValue(parentContext);
  -                             if (pred instanceof Iterator) {
  -                                     if (!((Iterator) pred).hasNext()) {
  -                                             return false;
  -                                     }
  -                                     pred = ((Iterator) pred).next();
  -                             }
  +        if (done) {
  +            return false;
  +        }
  +        while (parentContext.nextNode()) {
  +            if (setupDynamicPropertyPointer()) {
  +                Object pred = nameTestExpression.computeValue(parentContext);
  +                if (pred instanceof NodePointer) {
  +                    pred = ((NodePointer) pred).getValue();
  +                }
  +                dynamicPropertyPointer.setPropertyName(
  +                    InfoSetUtil.stringValue(pred));
  +                position = 1;
  +                done = true;
  +                return true;
  +            }
  +            else {
  +                Object pred = expression.computeValue(parentContext);
  +                if (pred instanceof Iterator) {
  +                    if (!((Iterator) pred).hasNext()) {
  +                        return false;
  +                    }
  +                    pred = ((Iterator) pred).next();
  +                }
   
  -                             if (pred instanceof NodePointer) {
  -                                     pred = ((NodePointer) pred).getNode();
  -                             }
  +                if (pred instanceof NodePointer) {
  +                    pred = ((NodePointer) pred).getNode();
  +                }
   
  -                             if (pred instanceof Number) {
  -                                     int pos = (int) InfoSetUtil.doubleValue(pred);
  -                                     position++;
  -                                     done = true;
  -                                     return parentContext.setPosition(pos);
  -                             }
  -                             else if (InfoSetUtil.booleanValue(pred)) {
  -                                     position++;
  -                                     return true;
  -                             }
  -                     }
  -             }
  -             return false;
  +                if (pred instanceof Number) {
  +                    int pos = (int) InfoSetUtil.doubleValue(pred);
  +                    position++;
  +                    done = true;
  +                    return parentContext.setPosition(pos);
  +                }
  +                else if (InfoSetUtil.booleanValue(pred)) {
  +                    position++;
  +                    return true;
  +                }
  +            }
  +        }
  +        return false;
       }
   
       /**
  @@ -159,22 +159,22 @@
       }
   
       public boolean setPosition(int position){
  -             if (nameTestExpression == null) {
  -                     return setPositionStandard(position);
  -             }
  -             else {
  -                     if (dynamicPropertyPointer == null) {
  -                             if (!setupDynamicPropertyPointer()) {
  -                                     return setPositionStandard(position);
  -                             }
  -                     }
  -                     if (position < 1
  -                             || position > dynamicPropertyPointer.getLength()) {
  -                             return false;
  -                     }
  -                     dynamicPropertyPointer.setIndex(position - 1);
  -                     return true;
  -             }
  +        if (nameTestExpression == null) {
  +            return setPositionStandard(position);
  +        }
  +        else {
  +            if (dynamicPropertyPointer == null) {
  +                if (!setupDynamicPropertyPointer()) {
  +                    return setPositionStandard(position);
  +                }
  +            }
  +            if (position < 1
  +                || position > dynamicPropertyPointer.getLength()) {
  +                return false;
  +            }
  +            dynamicPropertyPointer.setIndex(position - 1);
  +            return true;
  +        }
       }
   
       public NodePointer getCurrentNodePointer(){
  
  
  
  1.9       +80 -80    
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
  
  Index: BeanPointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BeanPointer.java  26 Nov 2002 01:20:06 -0000      1.8
  +++ BeanPointer.java  26 Nov 2002 01:33:34 -0000      1.9
  @@ -82,32 +82,32 @@
       private Object bean;
       private JXPathBeanInfo beanInfo;
   
  -     public BeanPointer(
  -             QName name,
  -             Object bean,
  -             JXPathBeanInfo beanInfo,
  -             Locale locale) 
  +    public BeanPointer(
  +            QName name,
  +            Object bean,
  +            JXPathBeanInfo beanInfo,
  +            Locale locale) 
       {
  -             super(null, locale);
  -             this.name = name;
  -             this.bean = bean;
  -             this.beanInfo = beanInfo;
  -     }
  +        super(null, locale);
  +        this.name = name;
  +        this.bean = bean;
  +        this.beanInfo = beanInfo;
  +    }
   
       /**
        * @param name is the name given to the first node
        */
  -     public BeanPointer(
  -             NodePointer parent,
  -             QName name,
  -             Object bean,
  -             JXPathBeanInfo beanInfo) 
  +    public BeanPointer(
  +            NodePointer parent,
  +            QName name,
  +            Object bean,
  +            JXPathBeanInfo beanInfo) 
       {
  -             super(parent);
  -             this.name = name;
  -             this.bean = bean;
  -             this.beanInfo = beanInfo;
  -     }
  +        super(parent);
  +        this.name = name;
  +        this.bean = bean;
  +        this.beanInfo = beanInfo;
  +    }
   
       public PropertyPointer getPropertyPointer(){
           return new BeanPropertyPointer(this, beanInfo);
  @@ -148,40 +148,40 @@
           return name == null ? 0 : name.hashCode();
       }
   
  -     public boolean equals(Object object) {
  -             if (object == this) {
  -                     return true;
  -             }
  -
  -             if (!(object instanceof BeanPointer)) {
  -                     return false;
  -             }
  -
  -             BeanPointer other = (BeanPointer) object;
  -             if (parent != other.parent) {
  -                     if (parent == null || !parent.equals(other.parent)) {
  -                             return false;
  -                     }
  -             }
  -
  -             if ((name == null && other.name != null)
  -                     || (name != null && !name.equals(other.name))) {
  -                     return false;
  -             }
  -
  -             int i_this = (index == WHOLE_COLLECTION ? 0 : index);
  -             int i_other = (other.index == WHOLE_COLLECTION ? 0 : other.index);
  -             if (i_this != i_other) {
  -                     return false;
  -             }
  -
  -             if (bean instanceof Number
  -                     || bean instanceof String
  -                     || bean instanceof Boolean) {
  -                     return bean.equals(other.bean);
  -             }
  -             return bean == other.bean;
  -     }
  +    public boolean equals(Object object) {
  +        if (object == this) {
  +            return true;
  +        }
  +
  +        if (!(object instanceof BeanPointer)) {
  +            return false;
  +        }
  +
  +        BeanPointer other = (BeanPointer) object;
  +        if (parent != other.parent) {
  +            if (parent == null || !parent.equals(other.parent)) {
  +                return false;
  +            }
  +        }
  +
  +        if ((name == null && other.name != null)
  +            || (name != null && !name.equals(other.name))) {
  +            return false;
  +        }
  +
  +        int i_this = (index == WHOLE_COLLECTION ? 0 : index);
  +        int i_other = (other.index == WHOLE_COLLECTION ? 0 : other.index);
  +        if (i_this != i_other) {
  +            return false;
  +        }
  +
  +        if (bean instanceof Number
  +            || bean instanceof String
  +            || bean instanceof Boolean) {
  +            return bean.equals(other.bean);
  +        }
  +        return bean == other.bean;
  +    }
   
       /**
        * If the pointer has a parent, then parent's path.
  @@ -189,26 +189,26 @@
        * If the bean is a primitive value, the value itself.
        * Otherwise - an empty string.
        */
  -     public String asPath() {
  -             if (parent != null) {
  -                     return super.asPath();
  -             }
  -             else if (bean == null) {
  -                     return "null()";
  -             }
  -             else if (bean instanceof Number) {
  -                     String string = bean.toString();
  -                     if (string.endsWith(".0")) {
  -                             string = string.substring(0, string.length() - 2);
  -                     }
  -                     return string;
  -             }
  -             else if (bean instanceof Boolean) {
  -                     return ((Boolean) bean).booleanValue() ? "true()" : "false()";
  -             }
  -             else if (bean instanceof String) {
  -                     return "'" + bean + "'";
  -             }
  -             return "/";
  -     }
  +    public String asPath() {
  +        if (parent != null) {
  +            return super.asPath();
  +        }
  +        else if (bean == null) {
  +            return "null()";
  +        }
  +        else if (bean instanceof Number) {
  +            String string = bean.toString();
  +            if (string.endsWith(".0")) {
  +                string = string.substring(0, string.length() - 2);
  +            }
  +            return string;
  +        }
  +        else if (bean instanceof Boolean) {
  +            return ((Boolean) bean).booleanValue() ? "true()" : "false()";
  +        }
  +        else if (bean instanceof String) {
  +            return "'" + bean + "'";
  +        }
  +        return "/";
  +    }
   }
  
  
  
  1.9       +9 -9      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointer.java
  
  Index: CollectionPointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CollectionPointer.java    26 Nov 2002 01:20:06 -0000      1.8
  +++ CollectionPointer.java    26 Nov 2002 01:33:34 -0000      1.9
  @@ -100,7 +100,7 @@
       }
   
       public boolean isCollection(){
  -     return true;
  +        return true;
       }
   
       public int getLength(){
  @@ -153,7 +153,7 @@
       }
   
       public NodePointer createChild(JXPathContext context, 
  -                     QName name, int index, Object value)
  +                QName name, int index, Object value)
       {
           if (parent instanceof PropertyPointer){
               return parent.createChild(context, name, index, value);
  @@ -184,7 +184,7 @@
       }
   
       public NodePointer createChild(JXPathContext context, 
  -                     QName name, int index)
  +                QName name, int index)
       {
           if (parent instanceof PropertyPointer){
               return parent.createChild(context, name, index);
  @@ -217,7 +217,7 @@
       }
   
       public NodeIterator childIterator(NodeTest test, 
  -                     boolean reverse, NodePointer startWith)
  +                boolean reverse, NodePointer startWith)
       {
           if (index == WHOLE_COLLECTION){
               return null;
  @@ -253,7 +253,7 @@
       }
   
       public int compareChildNodePointers(
  -                     NodePointer pointer1, NodePointer pointer2)
  +                NodePointer pointer1, NodePointer pointer2)
       {
           return pointer1.getIndex() - pointer2.getIndex();
       }
  
  
  
  1.7       +6 -6      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPointer.java
  
  Index: DynamicPointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPointer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DynamicPointer.java       20 Oct 2002 03:47:17 -0000      1.6
  +++ DynamicPointer.java       26 Nov 2002 01:33:34 -0000      1.7
  @@ -121,14 +121,14 @@
       }    
       
       public boolean isCollection(){
  -     return false;
  +        return false;
       }
   
       /**
        * Returns 1.
        */
       public int getLength(){
  -     return 1;
  +        return 1;
       }
   
       public String asPath(){
  
  
  
  1.11      +130 -130  
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPropertyPointer.java
  
  Index: DynamicPropertyPointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPropertyPointer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DynamicPropertyPointer.java       26 Nov 2002 01:20:06 -0000      1.10
  +++ DynamicPropertyPointer.java       26 Nov 2002 01:33:34 -0000      1.11
  @@ -80,13 +80,13 @@
       private String[] names;
       private String requiredPropertyName;
   
  -     public DynamicPropertyPointer(
  -             NodePointer parent,
  -             DynamicPropertyHandler handler) 
  +    public DynamicPropertyPointer(
  +            NodePointer parent,
  +            DynamicPropertyHandler handler) 
       {
  -             super(parent);
  -             this.handler = handler;
  -     }
  +        super(parent);
  +        this.handler = handler;
  +    }
       /**
        * This type of node is auxiliary.
        */
  @@ -202,17 +202,17 @@
        * and the value will be the property itself.
        */
       public Object getImmediateNode(){
  -             Object value;
  -             if (index == WHOLE_COLLECTION) {
  -                     value = handler.getProperty(getBean(), getPropertyName());
  -             }
  -             else {
  -                     value =
  -                             ValueUtils.getValue(
  -                                     handler.getProperty(getBean(), 
getPropertyName()),
  -                                     index);
  -             }
  -             return value;
  +        Object value;
  +        if (index == WHOLE_COLLECTION) {
  +            value = handler.getProperty(getBean(), getPropertyName());
  +        }
  +        else {
  +            value =
  +                ValueUtils.getValue(
  +                    handler.getProperty(getBean(), getPropertyName()),
  +                    index);
  +        }
  +        return value;
       }
   
       /**
  @@ -229,15 +229,15 @@
        * represented by the property.
        */
       public void setValue(Object value){
  -             if (index == WHOLE_COLLECTION) {
  -                     handler.setProperty(getBean(), getPropertyName(), value);
  -             }
  -             else {
  -                     ValueUtils.setValue(
  -                             handler.getProperty(getBean(), getPropertyName()),
  -                             index,
  -                             value);
  -             }
  +        if (index == WHOLE_COLLECTION) {
  +            handler.setProperty(getBean(), getPropertyName(), value);
  +        }
  +        else {
  +            ValueUtils.setValue(
  +                handler.getProperty(getBean(), getPropertyName()),
  +                index,
  +                value);
  +        }
       }
   
       public NodePointer createPath(JXPathContext context, Object value){
  @@ -245,118 +245,118 @@
       }
   
       public NodePointer createChild(JXPathContext context, QName name, int index, 
Object value){
  -             // Ignore the name passed to us, use our own data
  -             if (index == WHOLE_COLLECTION) {
  -                     handler.setProperty(getBean(), getPropertyName(), value);
  -             }
  -             else {
  -                     Object collection = getBaseValue();
  -                     if (collection == null) {
  -                             AbstractFactory factory = getAbstractFactory(context);
  -                             if (!factory
  -                                     .createObject(
  -                                             context,
  -                                             this,
  -                                             getBean(),
  -                                             getPropertyName(),
  -                                             0)) {
  -                                     throw new JXPathException(
  -                                             "Factory could not create an object 
for path: "
  -                                                     + asPath());
  -                             }
  -                             collection = getBaseValue();
  -                     }
  -
  -                     if (index < 0) {
  -                             throw new JXPathException("Index is less than 1: " + 
asPath());
  -                     }
  -
  -                     if (index >= getLength()) {
  -                             collection = ValueUtils.expandCollection(collection, 
index + 1);
  -                             handler.setProperty(getBean(), getPropertyName(), 
collection);
  -                     }
  -
  -                     ValueUtils.setValue(collection, index, value);
  -             }
  -             NodePointer ptr = (NodePointer) clone();
  -             ptr.setIndex(index);
  -             return ptr;
  +        // Ignore the name passed to us, use our own data
  +        if (index == WHOLE_COLLECTION) {
  +            handler.setProperty(getBean(), getPropertyName(), value);
  +        }
  +        else {
  +            Object collection = getBaseValue();
  +            if (collection == null) {
  +                AbstractFactory factory = getAbstractFactory(context);
  +                if (!factory
  +                    .createObject(
  +                        context,
  +                        this,
  +                        getBean(),
  +                        getPropertyName(),
  +                        0)) {
  +                    throw new JXPathException(
  +                        "Factory could not create an object for path: "
  +                            + asPath());
  +                }
  +                collection = getBaseValue();
  +            }
  +
  +            if (index < 0) {
  +                throw new JXPathException("Index is less than 1: " + asPath());
  +            }
  +
  +            if (index >= getLength()) {
  +                collection = ValueUtils.expandCollection(collection, index + 1);
  +                handler.setProperty(getBean(), getPropertyName(), collection);
  +            }
  +
  +            ValueUtils.setValue(collection, index, value);
  +        }
  +        NodePointer ptr = (NodePointer) clone();
  +        ptr.setIndex(index);
  +        return ptr;
       }
   
       public NodePointer createChild(JXPathContext context, QName name, int index){
  -             // Ignore the name passed to us, use our own data
  -             Object collection = getBaseValue();
  -             if (collection == null) {
  -                     AbstractFactory factory = getAbstractFactory(context);
  -                     if (!factory
  -                             .createObject(context, this, getBean(), 
getPropertyName(), 0)) {
  -                             throw new JXPathException(
  -                                     "Factory could not create an object for path: 
" + asPath());
  -                     }
  -                     collection = getBaseValue();
  -             }
  -
  -             if (index < 0) {
  -                     throw new JXPathException("Index is less than 1: " + asPath());
  -             }
  -
  -             if (index >= getLength()) {
  -                     collection = ValueUtils.expandCollection(collection, index + 
1);
  -                     handler.setProperty(getBean(), getPropertyName(), collection);
  -             }
  -
  -             DynamicPropertyPointer pointer = (DynamicPropertyPointer) this.clone();
  -             pointer.setIndex(index);
  -             return pointer;
  +        // Ignore the name passed to us, use our own data
  +        Object collection = getBaseValue();
  +        if (collection == null) {
  +            AbstractFactory factory = getAbstractFactory(context);
  +            if (!factory
  +                .createObject(context, this, getBean(), getPropertyName(), 0)) {
  +                throw new JXPathException(
  +                    "Factory could not create an object for path: " + asPath());
  +            }
  +            collection = getBaseValue();
  +        }
  +
  +        if (index < 0) {
  +            throw new JXPathException("Index is less than 1: " + asPath());
  +        }
  +
  +        if (index >= getLength()) {
  +            collection = ValueUtils.expandCollection(collection, index + 1);
  +            handler.setProperty(getBean(), getPropertyName(), collection);
  +        }
  +
  +        DynamicPropertyPointer pointer = (DynamicPropertyPointer) this.clone();
  +        pointer.setIndex(index);
  +        return pointer;
       }
   
       public NodePointer createPath(JXPathContext context){
  -             if (getNode() == null) {
  -                     AbstractFactory factory = getAbstractFactory(context);
  -                     int inx = (index == WHOLE_COLLECTION ? 0 : index);
  -                     if (!factory
  -                             .createObject(
  -                                     context,
  -                                     this,
  -                                     getBean(),
  -                                     getPropertyName(),
  -                                     inx)) {
  -                             throw new JXPathException(
  -                                     "Factory could not create an object for path: 
" + asPath());
  -                     }
  -             }
  -             return this;
  +        if (getNode() == null) {
  +            AbstractFactory factory = getAbstractFactory(context);
  +            int inx = (index == WHOLE_COLLECTION ? 0 : index);
  +            if (!factory
  +                .createObject(
  +                    context,
  +                    this,
  +                    getBean(),
  +                    getPropertyName(),
  +                    inx)) {
  +                throw new JXPathException(
  +                    "Factory could not create an object for path: " + asPath());
  +            }
  +        }
  +        return this;
       }
   
       public void remove(){
  -             if (index == WHOLE_COLLECTION) {
  -                     handler.setProperty(getBean(), getPropertyName(), null);
  -             }
  -             else if (isCollection()) {
  -                     Object collection = ValueUtils.remove(getBaseValue(), index);
  -                     handler.setProperty(getBean(), getPropertyName(), collection);
  -             }
  -             else if (index == 0) {
  -                     handler.setProperty(getBean(), getPropertyName(), null);
  -             }
  +        if (index == WHOLE_COLLECTION) {
  +            handler.setProperty(getBean(), getPropertyName(), null);
  +        }
  +        else if (isCollection()) {
  +            Object collection = ValueUtils.remove(getBaseValue(), index);
  +            handler.setProperty(getBean(), getPropertyName(), collection);
  +        }
  +        else if (index == 0) {
  +            handler.setProperty(getBean(), getPropertyName(), null);
  +        }
       }
   
       public String asPath(){
  -             StringBuffer buffer = new StringBuffer();
  -             buffer.append(getParent().asPath());
  -             if (buffer.length() == 0) {
  -                     buffer.append("/.");
  -             }
  -             else if (buffer.charAt(buffer.length() - 1) == '/') {
  -                     buffer.append('.');
  -             }
  -             buffer.append("[@name='");
  -             buffer.append(escape(getPropertyName()));
  -             buffer.append("']");
  -             if (index != WHOLE_COLLECTION && isCollection()) {
  -                     buffer.append('[').append(index + 1).append(']');
  -             }
  -             return buffer.toString();
  +        StringBuffer buffer = new StringBuffer();
  +        buffer.append(getParent().asPath());
  +        if (buffer.length() == 0) {
  +            buffer.append("/.");
  +        }
  +        else if (buffer.charAt(buffer.length() - 1) == '/') {
  +            buffer.append('.');
  +        }
  +        buffer.append("[@name='");
  +        buffer.append(escape(getPropertyName()));
  +        buffer.append("']");
  +        if (index != WHOLE_COLLECTION && isCollection()) {
  +            buffer.append('[').append(index + 1).append(']');
  +        }
  +        return buffer.toString();
       }
   
       private String escape(String string){
  
  
  
  1.7       +5 -5      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/LangAttributePointer.java
  
  Index: LangAttributePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/LangAttributePointer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LangAttributePointer.java 26 Nov 2002 01:20:06 -0000      1.6
  +++ LangAttributePointer.java 26 Nov 2002 01:33:34 -0000      1.7
  @@ -124,7 +124,7 @@
               buffer.append(parent.asPath());
               if (buffer.length() == 0 ||
                       buffer.charAt(buffer.length()-1) != '/'){
  -             buffer.append('/');
  +                buffer.append('/');
               }
           }
           buffer.append("@xml:lang");
  
  
  
  1.9       +5 -5      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
  
  Index: DOMAttributePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DOMAttributePointer.java  26 Nov 2002 01:20:07 -0000      1.8
  +++ DOMAttributePointer.java  26 Nov 2002 01:33:34 -0000      1.9
  @@ -155,7 +155,7 @@
               buffer.append(parent.asPath());
               if (buffer.length() == 0 ||
                       buffer.charAt(buffer.length()-1) != '/'){
  -             buffer.append('/');
  +                buffer.append('/');
               }
           }
           buffer.append('@');
  
  
  
  1.13      +44 -44    
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
  
  Index: DOMNodePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DOMNodePointer.java       26 Nov 2002 01:20:07 -0000      1.12
  +++ DOMNodePointer.java       26 Nov 2002 01:33:34 -0000      1.13
  @@ -101,9 +101,9 @@
       private String id;
   
       public static final String XML_NAMESPACE_URI = 
  -             "http://www.w3.org/XML/1998/namespace";;
  +            "http://www.w3.org/XML/1998/namespace";;
       public static final String XMLNS_NAMESPACE_URI = 
  -             "http://www.w3.org/2000/xmlns/";;
  +            "http://www.w3.org/2000/xmlns/";;
   
       public DOMNodePointer(Node node, Locale locale){
           super(null, locale);
  @@ -126,7 +126,7 @@
       }
   
       public static boolean testNode(
  -             NodePointer pointer, Node node, NodeTest test)
  +            NodePointer pointer, Node node, NodeTest test)
       {
           if (test == null){
               return true;
  @@ -139,7 +139,7 @@
               QName testName = ((NodeNameTest)test).getNodeName();
               String testLocalName = testName.getName();
               if (testLocalName.equals("*") || 
  -                     testLocalName.equals(DOMNodePointer.getLocalName(node))){
  +                    testLocalName.equals(DOMNodePointer.getLocalName(node))){
                   String testPrefix = testName.getPrefix();
                   String nodePrefix = DOMNodePointer.getPrefix(node);
                   if (equalStrings(testPrefix, nodePrefix)){
  @@ -357,7 +357,7 @@
        */
       public void setValue(Object value){
           if (node.getNodeType() == Node.TEXT_NODE ||
  -                     node.getNodeType() == Node.CDATA_SECTION_NODE){
  +                node.getNodeType() == Node.CDATA_SECTION_NODE){
               String string = (String)TypeUtils.convert(value, String.class);
               if (string != null && !string.equals("")){
                   node.setNodeValue(string);
  @@ -369,38 +369,38 @@
           else {
               NodeList children = node.getChildNodes();
               int count = children.getLength();
  -             for (int i = count; --i >= 0;){
  -                 Node child = children.item(i);
  -                 node.removeChild(child);
  -             }
  +            for (int i = count; --i >= 0;){
  +                Node child = children.item(i);
  +                node.removeChild(child);
  +            }
               
  -             if (value instanceof Node){
  -                     Node valueNode = (Node)value;
  -                     if (valueNode instanceof Element ||
  -                                     valueNode instanceof Document){
  -                             children = valueNode.getChildNodes();
  -                             for (int i = 0; i < children.getLength(); i++){
  -                                     Node child = children.item(i);
  -                                     node.appendChild(child.cloneNode(true));
  -                             }
  -                             }
  -                             else {
  -                                     node.appendChild(valueNode.cloneNode(true));
  -                             }               
  -             }
  -             else {
  -                 String string = (String)TypeUtils.convert(value, String.class);
  -                 if (string != null && !string.equals("")){
  -                     Node textNode = 
  -                                     node.getOwnerDocument().createTextNode(string);
  -                     node.appendChild(textNode);
  -                 }
  -             }
  +            if (value instanceof Node){
  +                Node valueNode = (Node)value;
  +                if (valueNode instanceof Element ||
  +                        valueNode instanceof Document){
  +                    children = valueNode.getChildNodes();
  +                    for (int i = 0; i < children.getLength(); i++){
  +                        Node child = children.item(i);
  +                        node.appendChild(child.cloneNode(true));
  +                    }
  +                }
  +                else {
  +                    node.appendChild(valueNode.cloneNode(true));
  +                }            
  +            }
  +            else {
  +                String string = (String)TypeUtils.convert(value, String.class);
  +                if (string != null && !string.equals("")){
  +                    Node textNode = 
  +                            node.getOwnerDocument().createTextNode(string);
  +                    node.appendChild(textNode);
  +                }
  +            }
           }
       }
       
       public NodePointer createChild(JXPathContext context, 
  -                     QName name, int index)
  +                QName name, int index)
       {
           if (index == WHOLE_COLLECTION){
               index = 0;
  @@ -438,7 +438,7 @@
               String ns = getNamespaceURI(prefix);
               if (ns == null){
                   throw new JXPathException(
  -                     "Unknown namespace prefix: " + prefix);
  +                    "Unknown namespace prefix: " + prefix);
               }
               element.setAttributeNS(ns, name.toString(), "");
           }
  @@ -477,7 +477,7 @@
                   if (parent instanceof DOMNodePointer){
                       if (buffer.length() == 0 ||
                               buffer.charAt(buffer.length()-1) != '/'){
  -                     buffer.append('/');
  +                        buffer.append('/');
                       }
                       buffer.append(getName());
                       buffer.append('[');
  @@ -507,13 +507,13 @@
           int index = string.indexOf('\'');
           while (index != -1){
               string = string.substring(0, index) + 
  -             "&apos;" + string.substring(index + 1);
  +                "&apos;" + string.substring(index + 1);
               index = string.indexOf('\'');
           }
           index = string.indexOf('\"');
           while (index != -1){
               string = string.substring(0, index) + 
  -             "&quot;" + string.substring(index + 1);
  +                "&quot;" + string.substring(index + 1);
               index = string.indexOf('\"');
           }
           return string;
  @@ -539,7 +539,7 @@
           Node n = node.getPreviousSibling();
           while (n != null){
               if (n.getNodeType() == Node.TEXT_NODE || 
  -                             n.getNodeType() == Node.CDATA_SECTION_NODE){
  +                        n.getNodeType() == Node.CDATA_SECTION_NODE){
                   count ++;
               }
               n = n.getPreviousSibling();
  @@ -666,14 +666,14 @@
           AbstractFactory factory = context.getFactory();
           if (factory == null){
               throw new JXPathException(
  -             "Factory is not set on the JXPathContext - " +
  -             "cannot create path: " + asPath());
  +                "Factory is not set on the JXPathContext - " +
  +                "cannot create path: " + asPath());
           }
           return factory;
       }
   
       public int compareChildNodePointers(
  -             NodePointer pointer1, NodePointer pointer2)
  +            NodePointer pointer1, NodePointer pointer2)
       {
           Node node1 = (Node)pointer1.getBaseValue();
           Node node2 = (Node)pointer2.getBaseValue();
  
  
  
  1.8       +5 -5      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/NamespacePointer.java
  
  Index: NamespacePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/NamespacePointer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NamespacePointer.java     26 Nov 2002 01:20:07 -0000      1.7
  +++ NamespacePointer.java     26 Nov 2002 01:33:34 -0000      1.8
  @@ -138,7 +138,7 @@
               buffer.append(parent.asPath());
               if (buffer.length() == 0 ||
                       buffer.charAt(buffer.length()-1) != '/'){
  -             buffer.append('/');
  +                buffer.append('/');
               }
           }
           buffer.append("namespace::");
  
  
  
  1.4       +147 -147  
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dynabeans/DynaBeanPropertyPointer.java
  
  Index: DynaBeanPropertyPointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dynabeans/DynaBeanPropertyPointer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DynaBeanPropertyPointer.java      26 Nov 2002 01:20:07 -0000      1.3
  +++ DynaBeanPropertyPointer.java      26 Nov 2002 01:33:34 -0000      1.4
  @@ -262,140 +262,140 @@
       public NodePointer createChild(JXPathContext context,
               QName name, int index, Object value)
       {
  -             // Ignore the name passed to us, use our own data
  -             if (index == WHOLE_COLLECTION) {
  -                     setValue(index, value);
  -             }
  -             else if (isIndexedProperty()) {
  -                     dynaBean.set(getPropertyName(), index, convert(value, true));
  -             }
  -             else {
  -                     Object collection = getBaseValue();
  -                     if (collection == null) {
  -                             AbstractFactory factory = getAbstractFactory(context);
  -                             if (!factory
  -                                     .createObject(
  -                                             context,
  -                                             this,
  -                                             getBean(),
  -                                             getPropertyName(),
  -                                             0)) {
  -                                     throw new JXPathException(
  -                                             "Factory could not create an object 
for path: "
  -                                                     + asPath());
  -                             }
  -                             collection = getBaseValue();
  -                     }
  -
  -                     if (index < 0) {
  -                             throw new JXPathException("Index is less than 1: " + 
asPath());
  -                     }
  -
  -                     if (index >= getLength()) {
  -                             collection = ValueUtils.expandCollection(collection, 
index + 1);
  -                             dynaBean.set(getPropertyName(), collection);
  -                     }
  -
  -                     ValueUtils.setValue(collection, index, value);
  -             }
  -             NodePointer ptr = (NodePointer) clone();
  -             ptr.setIndex(index);
  -             return ptr;
  +        // Ignore the name passed to us, use our own data
  +        if (index == WHOLE_COLLECTION) {
  +            setValue(index, value);
  +        }
  +        else if (isIndexedProperty()) {
  +            dynaBean.set(getPropertyName(), index, convert(value, true));
  +        }
  +        else {
  +            Object collection = getBaseValue();
  +            if (collection == null) {
  +                AbstractFactory factory = getAbstractFactory(context);
  +                if (!factory
  +                    .createObject(
  +                        context,
  +                        this,
  +                        getBean(),
  +                        getPropertyName(),
  +                        0)) {
  +                    throw new JXPathException(
  +                        "Factory could not create an object for path: "
  +                            + asPath());
  +                }
  +                collection = getBaseValue();
  +            }
  +
  +            if (index < 0) {
  +                throw new JXPathException("Index is less than 1: " + asPath());
  +            }
  +
  +            if (index >= getLength()) {
  +                collection = ValueUtils.expandCollection(collection, index + 1);
  +                dynaBean.set(getPropertyName(), collection);
  +            }
  +
  +            ValueUtils.setValue(collection, index, value);
  +        }
  +        NodePointer ptr = (NodePointer) clone();
  +        ptr.setIndex(index);
  +        return ptr;
       }
   
       public NodePointer createChild(JXPathContext context,
               QName name, int index)
       {
  -             if (isIndexedProperty()) {
  -                     AbstractFactory factory = getAbstractFactory(context);
  -                     if (!factory
  -                             .createObject(
  -                                     context,
  -                                     this,
  -                                     dynaBean,
  -                                     getPropertyName(),
  -                                     index)) {
  -                             throw new JXPathException(
  -                                     "Factory could not create an object for path: 
" + asPath());
  -                     }
  -             }
  -             else {
  -                     // Ignore the name passed to us, use our own data
  -                     Object collection = getBaseValue();
  -                     if (collection == null) {
  -                             AbstractFactory factory = getAbstractFactory(context);
  -                             if (!factory
  -                                     .createObject(
  -                                             context,
  -                                             this,
  -                                             dynaBean,
  -                                             getPropertyName(),
  -                                             index)) {
  -                                     throw new JXPathException(
  -                                             "Factory could not create an object 
for path: "
  -                                                     + asPath());
  -                             }
  -                             collection = getBaseValue();
  -                     }
  -
  -                     if (index < 0) {
  -                             throw new JXPathException("Index is less than 1: " + 
asPath());
  -                     }
  -
  -                     if (index >= getLength()) {
  -                             collection = ValueUtils.expandCollection(collection, 
index + 1);
  -                             dynaBean.set(getPropertyName(), collection);
  -                     }
  -             }
  -
  -             DynaBeanPropertyPointer pointer =
  -                     (DynaBeanPropertyPointer) this.clone();
  -             pointer.setIndex(index);
  -             return pointer;
  +        if (isIndexedProperty()) {
  +            AbstractFactory factory = getAbstractFactory(context);
  +            if (!factory
  +                .createObject(
  +                    context,
  +                    this,
  +                    dynaBean,
  +                    getPropertyName(),
  +                    index)) {
  +                throw new JXPathException(
  +                    "Factory could not create an object for path: " + asPath());
  +            }
  +        }
  +        else {
  +            // Ignore the name passed to us, use our own data
  +            Object collection = getBaseValue();
  +            if (collection == null) {
  +                AbstractFactory factory = getAbstractFactory(context);
  +                if (!factory
  +                    .createObject(
  +                        context,
  +                        this,
  +                        dynaBean,
  +                        getPropertyName(),
  +                        index)) {
  +                    throw new JXPathException(
  +                        "Factory could not create an object for path: "
  +                            + asPath());
  +                }
  +                collection = getBaseValue();
  +            }
  +
  +            if (index < 0) {
  +                throw new JXPathException("Index is less than 1: " + asPath());
  +            }
  +
  +            if (index >= getLength()) {
  +                collection = ValueUtils.expandCollection(collection, index + 1);
  +                dynaBean.set(getPropertyName(), collection);
  +            }
  +        }
  +
  +        DynaBeanPropertyPointer pointer =
  +            (DynaBeanPropertyPointer) this.clone();
  +        pointer.setIndex(index);
  +        return pointer;
       }
   
       public NodePointer createPath(JXPathContext context){
  -             if (getNode() == null) {
  -                     AbstractFactory factory = getAbstractFactory(context);
  -                     int inx = (index == WHOLE_COLLECTION ? 0 : index);
  -                     if (!factory
  -                             .createObject(
  -                                     context,
  -                                     this,
  -                                     dynaBean,
  -                                     getPropertyName(),
  -                                     inx)) {
  -                             throw new JXPathException(
  -                                     "Factory could not create an object for path: 
" + asPath());
  -                     }
  -             }
  +        if (getNode() == null) {
  +            AbstractFactory factory = getAbstractFactory(context);
  +            int inx = (index == WHOLE_COLLECTION ? 0 : index);
  +            if (!factory
  +                .createObject(
  +                    context,
  +                    this,
  +                    dynaBean,
  +                    getPropertyName(),
  +                    inx)) {
  +                throw new JXPathException(
  +                    "Factory could not create an object for path: " + asPath());
  +            }
  +        }
           return this;
       }
   
       public void remove(){
  -             if (index == WHOLE_COLLECTION) {
  -                     dynaBean.set(getPropertyName(), null);
  -             }
  -             else if (isIndexedProperty()) {
  -                     dynaBean.set(getPropertyName(), index, null);
  -             }
  -             else if (isCollection()) {
  -                     Object collection = ValueUtils.remove(getBaseValue(), index);
  -                     dynaBean.set(getPropertyName(), collection);
  -             }
  -             else if (index == 0) {
  -                     dynaBean.set(getPropertyName(), null);
  -             }
  +        if (index == WHOLE_COLLECTION) {
  +            dynaBean.set(getPropertyName(), null);
  +        }
  +        else if (isIndexedProperty()) {
  +            dynaBean.set(getPropertyName(), index, null);
  +        }
  +        else if (isCollection()) {
  +            Object collection = ValueUtils.remove(getBaseValue(), index);
  +            dynaBean.set(getPropertyName(), collection);
  +        }
  +        else if (index == 0) {
  +            dynaBean.set(getPropertyName(), null);
  +        }
       }
   
       private AbstractFactory getAbstractFactory(JXPathContext context){
  -             AbstractFactory factory = context.getFactory();
  -             if (factory == null) {
  -                     throw new JXPathException(
  -                             "Factory is not set on the JXPathContext - cannot 
create path: "
  -                                     + asPath());
  -             }
  -             return factory;
  +        AbstractFactory factory = context.getFactory();
  +        if (factory == null) {
  +            throw new JXPathException(
  +                "Factory is not set on the JXPathContext - cannot create path: "
  +                    + asPath());
  +        }
  +        return factory;
       }
   
       private void setValue(int index, Object value){
  @@ -413,29 +413,29 @@
   
   
       private Object convert(Object value, boolean element){
  -             DynaClass dynaClass = (DynaClass) dynaBean.getDynaClass();
  -             DynaProperty property = dynaClass.getDynaProperty(getPropertyName());
  -             Class type = property.getType();
  -             if (element) {
  -                     if (type.isArray()) {
  -                             type = type.getComponentType();
  -                     }
  -                     else {
  -                             return value; // No need to convert
  -                     }
  -             }
  -
  -             try {
  -                     return TypeUtils.convert(value, type);
  -             }
  -             catch (Exception ex) {
  -                     ex.printStackTrace();
  -                     throw new JXPathException(
  -                             "Cannot convert value of class "
  -                                     + (value == null ? "null" : 
value.getClass().getName())
  -                                     + " to type "
  -                                     + type,
  -                             ex);
  -             }
  +        DynaClass dynaClass = (DynaClass) dynaBean.getDynaClass();
  +        DynaProperty property = dynaClass.getDynaProperty(getPropertyName());
  +        Class type = property.getType();
  +        if (element) {
  +            if (type.isArray()) {
  +                type = type.getComponentType();
  +            }
  +            else {
  +                return value; // No need to convert
  +            }
  +        }
  +
  +        try {
  +            return TypeUtils.convert(value, type);
  +        }
  +        catch (Exception ex) {
  +            ex.printStackTrace();
  +            throw new JXPathException(
  +                "Cannot convert value of class "
  +                    + (value == null ? "null" : value.getClass().getName())
  +                    + " to type "
  +                    + type,
  +                ex);
  +        }
       }
   }
  
  
  
  1.4       +16 -16    
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMAttributePointer.java
  
  Index: JDOMAttributePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMAttributePointer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDOMAttributePointer.java 26 Nov 2002 01:20:07 -0000      1.3
  +++ JDOMAttributePointer.java 26 Nov 2002 01:33:34 -0000      1.4
  @@ -80,11 +80,11 @@
           this.attr = attr;
       }
   
  -     public QName getName() {
  -             return new QName(
  -                     JDOMNodePointer.getPrefix(attr),
  -                     JDOMNodePointer.getLocalName(attr));
  -     }
  +    public QName getName() {
  +        return new QName(
  +            JDOMNodePointer.getPrefix(attr),
  +            JDOMNodePointer.getLocalName(attr));
  +    }
   
       public QName getExpandedName(){
           return new QName(getNamespaceURI(),  attr.getName());
  @@ -145,7 +145,7 @@
               buffer.append(parent.asPath());
               if (buffer.length() == 0 ||
                       buffer.charAt(buffer.length()-1) != '/'){
  -             buffer.append('/');
  +                buffer.append('/');
               }
           }
           buffer.append('@');
  @@ -170,11 +170,11 @@
           return attr == other.attr;
       }
   
  -     public int compareChildNodePointers(
  -             NodePointer pointer1,
  -             NodePointer pointer2) 
  +    public int compareChildNodePointers(
  +            NodePointer pointer1,
  +            NodePointer pointer2) 
       {
  -             // Won't happen - attributes don't have children
  -             return 0;
  -     }
  +        // Won't happen - attributes don't have children
  +        return 0;
  +    }
   }
  
  
  
  1.4       +19 -19    
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java
  
  Index: JDOMNamespacePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDOMNamespacePointer.java 26 Nov 2002 01:20:07 -0000      1.3
  +++ JDOMNamespacePointer.java 26 Nov 2002 01:33:34 -0000      1.4
  @@ -79,15 +79,15 @@
           this.prefix = prefix;
       }
   
  -     public JDOMNamespacePointer(
  -             NodePointer parent,
  -             String prefix,
  -             String namespaceURI) 
  +    public JDOMNamespacePointer(
  +            NodePointer parent,
  +            String prefix,
  +            String namespaceURI) 
       {
  -             super(parent);
  -             this.prefix = prefix;
  -             this.namespaceURI = namespaceURI;
  -     }
  +        super(parent);
  +        this.prefix = prefix;
  +        this.namespaceURI = namespaceURI;
  +    }
   
       public QName getName(){
           return new QName(getNamespaceURI(), prefix);
  @@ -133,7 +133,7 @@
               buffer.append(parent.asPath());
               if (buffer.length() == 0 ||
                       buffer.charAt(buffer.length()-1) != '/'){
  -             buffer.append('/');
  +                buffer.append('/');
               }
           }
           buffer.append("namespace::");
  @@ -158,11 +158,11 @@
           return prefix.equals(other.prefix);
       }
   
  -     public int compareChildNodePointers(
  -             NodePointer pointer1,
  -             NodePointer pointer2) 
  +    public int compareChildNodePointers(
  +        NodePointer pointer1,
  +        NodePointer pointer2) 
       {
  -             // Won't happen - namespaces don't have children
  -             return 0;
  -     }
  +        // Won't happen - namespaces don't have children
  +        return 0;
  +    }
    }
  
  
  
  1.5       +116 -116  
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
  
  Index: JDOMNodePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOMNodePointer.java      26 Nov 2002 01:20:07 -0000      1.4
  +++ JDOMNodePointer.java      26 Nov 2002 01:33:34 -0000      1.5
  @@ -332,67 +332,67 @@
               }
           }
           else {
  -             Element element = (Element)node;
  -             element.getContent().clear();
  -                         
  -             if (value instanceof Element){
  -                     Element valueElement = (Element)value;
  -                     addContent(valueElement.getContent());
  -             }
  -             else if (value instanceof Document){
  -                     Document valueDocument = (Document)value;                      
 
  -                     addContent(valueDocument.getContent());
  -             }
  -             else if (value instanceof Text ||
  -                              value instanceof CDATA){
  -                     String string = ((Text)value).getText();
  -                     element.addContent(new Text(string));
  -                     }
  -                     else if (value instanceof ProcessingInstruction){
  -                             ProcessingInstruction pi = (ProcessingInstruction)
  -                                             ((ProcessingInstruction)value).clone();
  -                             element.addContent(pi);
  -                     }
  -                     else if (value instanceof Comment){
  -                             Comment comment = (Comment)((Comment)value).clone();
  -                             element.addContent(comment);
  -                     }
  -             else {
  -                 String string = (String)TypeUtils.convert(value, String.class);
  -                 if (string != null && !string.equals("")){
  -                     element.addContent(new Text(string));
  -                 }
  -             }
  +            Element element = (Element)node;
  +            element.getContent().clear();
  +                        
  +            if (value instanceof Element){
  +                Element valueElement = (Element)value;
  +                addContent(valueElement.getContent());
  +            }
  +            else if (value instanceof Document){
  +                Document valueDocument = (Document)value;                
  +                addContent(valueDocument.getContent());
  +            }
  +            else if (value instanceof Text ||
  +                     value instanceof CDATA){
  +                String string = ((Text)value).getText();
  +                element.addContent(new Text(string));
  +            }
  +            else if (value instanceof ProcessingInstruction){
  +                ProcessingInstruction pi = (ProcessingInstruction)
  +                        ((ProcessingInstruction)value).clone();
  +                element.addContent(pi);
  +            }
  +            else if (value instanceof Comment){
  +                Comment comment = (Comment)((Comment)value).clone();
  +                element.addContent(comment);
  +            }
  +            else {
  +                String string = (String)TypeUtils.convert(value, String.class);
  +                if (string != null && !string.equals("")){
  +                    element.addContent(new Text(string));
  +                }
  +            }
           }
       }
       
       private void addContent(List content){
  -     Element element = (Element)node;
  -     int count = content.size();
  -     
  -     for (int i = 0; i < count; i++){
  -             Object child = content.get(i);
  -             if (child instanceof Element){
  -                     child = ((Element)child).clone();
  -                     element.addContent((Element)child);
  -             }
  -             else if (child instanceof Text){
  -                     child = ((Text)child).clone();
  -                     element.addContent((Text)child);
  -             }
  -             else if (node instanceof CDATA){
  -                     child = ((CDATA)child).clone();
  -                     element.addContent((CDATA)child);
  -             }
  -             else if (node instanceof ProcessingInstruction){
  -                     child = ((ProcessingInstruction)child).clone();
  -                     element.addContent((ProcessingInstruction)child);
  -             }
  -             else if (node instanceof Comment){
  -                     child = ((Comment)child).clone();
  -                     element.addContent((Comment)child);
  -             }
  -     }
  +        Element element = (Element)node;
  +        int count = content.size();
  +        
  +        for (int i = 0; i < count; i++){
  +            Object child = content.get(i);
  +            if (child instanceof Element){
  +                child = ((Element)child).clone();
  +                element.addContent((Element)child);
  +            }
  +            else if (child instanceof Text){
  +                child = ((Text)child).clone();
  +                element.addContent((Text)child);
  +            }
  +            else if (node instanceof CDATA){
  +                child = ((CDATA)child).clone();
  +                element.addContent((CDATA)child);
  +            }
  +            else if (node instanceof ProcessingInstruction){
  +                child = ((ProcessingInstruction)child).clone();
  +                element.addContent((ProcessingInstruction)child);
  +            }
  +            else if (node instanceof Comment){
  +                child = ((Comment)child).clone();
  +                element.addContent((Comment)child);
  +            }
  +        }
       }
       
       public boolean testNode(NodeTest test){
  @@ -569,32 +569,32 @@
       }
   
       public NodePointer createAttribute(JXPathContext context, QName name){
  -             if (!(node instanceof Element)) {
  -                     return super.createAttribute(context, name);
  -             }
  -
  -             Element element = (Element) node;
  -             String prefix = name.getPrefix();
  -             if (prefix != null) {
  -                     Namespace ns = element.getNamespace(prefix);
  -                     if (ns == null) {
  -                             throw new JXPathException(
  -                                     "Unknown namespace prefix: " + prefix);
  -                     }
  -                     Attribute attr = element.getAttribute(name.getName(), ns);
  -                     if (attr == null) {
  -                             element.setAttribute(name.getName(), "", ns);
  -                     }
  -             }
  -             else {
  -                     Attribute attr = element.getAttribute(name.getName());
  -                     if (attr == null) {
  -                             element.setAttribute(name.getName(), "");
  -                     }
  -             }
  -             NodeIterator it = attributeIterator(name);
  -             it.setPosition(1);
  -             return it.getNodePointer();
  +        if (!(node instanceof Element)) {
  +            return super.createAttribute(context, name);
  +        }
  +
  +        Element element = (Element) node;
  +        String prefix = name.getPrefix();
  +        if (prefix != null) {
  +            Namespace ns = element.getNamespace(prefix);
  +            if (ns == null) {
  +                throw new JXPathException(
  +                    "Unknown namespace prefix: " + prefix);
  +            }
  +            Attribute attr = element.getAttribute(name.getName(), ns);
  +            if (attr == null) {
  +                element.setAttribute(name.getName(), "", ns);
  +            }
  +        }
  +        else {
  +            Attribute attr = element.getAttribute(name.getName());
  +            if (attr == null) {
  +                element.setAttribute(name.getName(), "");
  +            }
  +        }
  +        NodeIterator it = attributeIterator(name);
  +        it.setPosition(1);
  +        return it.getNodePointer();
       }
   
       public void remove(){
  @@ -621,7 +621,7 @@
               if (parent instanceof JDOMNodePointer){
                   if (buffer.length() == 0 ||
                           buffer.charAt(buffer.length()-1) != '/'){
  -                     buffer.append('/');
  +                    buffer.append('/');
                   }
                   buffer.append(getName());
                   buffer.append('[');
  @@ -713,25 +713,25 @@
       }
   
       private int getRelativePositionOfPI(String target){
  -             Element parent = ((ProcessingInstruction) node).getParent();
  -             if (parent == null) {
  -                     return 1;
  -             }
  -             List children = parent.getContent();
  -             int count = 0;
  -             for (int i = 0; i < children.size(); i++) {
  -                     Object child = children.get(i);
  -                     if (child instanceof ProcessingInstruction
  -                             && (target == null
  -                                     || target.equals(
  -                                             ((ProcessingInstruction) 
child).getTarget()))) {
  -                             count++;
  -                     }
  -                     if (child == node) {
  -                             break;
  -                     }
  -             }
  -             return count;
  +        Element parent = ((ProcessingInstruction) node).getParent();
  +        if (parent == null) {
  +            return 1;
  +        }
  +        List children = parent.getContent();
  +        int count = 0;
  +        for (int i = 0; i < children.size(); i++) {
  +            Object child = children.get(i);
  +            if (child instanceof ProcessingInstruction
  +                && (target == null
  +                    || target.equals(
  +                        ((ProcessingInstruction) child).getTarget()))) {
  +                count++;
  +            }
  +            if (child == node) {
  +                break;
  +            }
  +        }
  +        return count;
       }
   
       public int hashCode(){
  @@ -751,13 +751,13 @@
           return node == other.node;
       }
   
  -     private AbstractFactory getAbstractFactory(JXPathContext context) {
  -             AbstractFactory factory = context.getFactory();
  -             if (factory == null) {
  -                     throw new JXPathException(
  -                             "Factory is not set on the JXPathContext - cannot 
create path: "
  -                                     + asPath());
  -             }
  -             return factory;
  -     }
  +    private AbstractFactory getAbstractFactory(JXPathContext context) {
  +        AbstractFactory factory = context.getFactory();
  +        if (factory == null) {
  +            throw new JXPathException(
  +                "Factory is not set on the JXPathContext - cannot create path: "
  +                    + asPath());
  +        }
  +        return factory;
  +    }
   }
  
  
  
  1.11      +9 -9      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/ValueUtils.java
  
  Index: ValueUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/ValueUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ValueUtils.java   26 Nov 2002 01:20:07 -0000      1.10
  +++ ValueUtils.java   26 Nov 2002 01:33:34 -0000      1.11
  @@ -478,11 +478,11 @@
           }
   
           // Check the implemented interfaces and subinterfaces
  -             method =
  -                     getAccessibleMethodFromInterfaceNest(
  -                             clazz,
  -                             method.getName(),
  -                             method.getParameterTypes());
  +        method =
  +            getAccessibleMethodFromInterfaceNest(
  +                clazz,
  +                method.getName(),
  +                method.getParameterTypes());
           return (method);
       }
   
  
  
  
  1.3       +5 -5      
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java
  
  Index: ExtensionFunctionTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExtensionFunctionTest.java        20 Oct 2002 04:00:21 -0000      1.2
  +++ ExtensionFunctionTest.java        26 Nov 2002 01:33:34 -0000      1.3
  @@ -111,7 +111,7 @@
               lib.addFunctions(new PackageFunctions("", "call"));
               lib.addFunctions(
                       new PackageFunctions(
  -                             "org.apache.commons.jxpath.ri.compiler.", 
  +                            "org.apache.commons.jxpath.ri.compiler.", 
                               "jxpathtest"));
               context.setFunctions(lib);
           }
  
  
  
  1.2       +5 -5      
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions.java
  
  Index: TestFunctions.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestFunctions.java        20 Oct 2002 03:48:22 -0000      1.1
  +++ TestFunctions.java        26 Nov 2002 01:33:34 -0000      1.2
  @@ -86,7 +86,7 @@
   
       public TestFunctions(ExpressionContext context, String bar){
           this.foo = ((Number)context.getContextNodePointer().getValue()).
  -                     intValue();
  +                intValue();
           this.bar = bar;
       }
   
  
  
  
  1.3       +125 -125  
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/BeanModelTestCase.java
  
  Index: BeanModelTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/BeanModelTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BeanModelTestCase.java    26 Nov 2002 01:20:08 -0000      1.2
  +++ BeanModelTestCase.java    26 Nov 2002 01:33:35 -0000      1.3
  @@ -122,43 +122,43 @@
       private void testIndividual(int relativePropertyIndex, int offset,
                   boolean useStartLocation, boolean reverse, int expected)
       {
  -             PropertyOwnerPointer root =
  -                     (PropertyOwnerPointer) NodePointer.newNodePointer(
  -                             new QName(null, "root"),
  -                             createContextBean(),
  -                             Locale.getDefault());
  -
  -             NodeIterator it;
  -
  -             PropertyPointer start = null;
  -
  -             if (useStartLocation) {
  -                     start = root.getPropertyPointer();
  -                     start.setPropertyIndex(
  -                             relativeProperty(start, relativePropertyIndex));
  -                     start.setIndex(offset);
  -             }
  -             it =
  -                     root.childIterator(
  -                             new NodeNameTest(new QName(null, "integers")),
  -                             reverse,
  -                             start);
  -
  -             int size = 0;
  -             while (it.setPosition(it.getPosition() + 1)) {
  -                     size++;
  -             }
  -             assertEquals(
  -                     "ITERATIONS: Individual, relativePropertyIndex="
  -                             + relativePropertyIndex
  -                             + ", offset="
  -                             + offset
  -                             + ", useStartLocation="
  -                             + useStartLocation
  -                             + ", reverse="
  -                             + reverse,
  -                     expected,
  -                     size);
  +        PropertyOwnerPointer root =
  +            (PropertyOwnerPointer) NodePointer.newNodePointer(
  +                new QName(null, "root"),
  +                createContextBean(),
  +                Locale.getDefault());
  +
  +        NodeIterator it;
  +
  +        PropertyPointer start = null;
  +
  +        if (useStartLocation) {
  +            start = root.getPropertyPointer();
  +            start.setPropertyIndex(
  +                relativeProperty(start, relativePropertyIndex));
  +            start.setIndex(offset);
  +        }
  +        it =
  +            root.childIterator(
  +                new NodeNameTest(new QName(null, "integers")),
  +                reverse,
  +                start);
  +
  +        int size = 0;
  +        while (it.setPosition(it.getPosition() + 1)) {
  +            size++;
  +        }
  +        assertEquals(
  +            "ITERATIONS: Individual, relativePropertyIndex="
  +                + relativePropertyIndex
  +                + ", offset="
  +                + offset
  +                + ", useStartLocation="
  +                + useStartLocation
  +                + ", reverse="
  +                + reverse,
  +            expected,
  +            size);
       }
   
       /**
  @@ -216,38 +216,38 @@
       }
   
       public void testIteratePropertyArrayWithHasNext(){
  -             JXPathContext context = JXPathContext.newContext(createContextBean());
  -             Iterator it = context.iteratePointers("/integers");
  -             List actual = new ArrayList();
  -             while (it.hasNext()) {
  -                     actual.add(((Pointer) it.next()).asPath());
  -             }
  -             assertEquals(
  -                     "Iterating 'hasNext'/'next'<" + "/integers" + ">",
  -                     list(
  -                             "/integers[1]",
  -                             "/integers[2]",
  -                             "/integers[3]",
  -                             "/integers[4]"),
  -                     actual);
  -    }
  -
  -     public void testIteratePropertyArrayWithoutHasNext() {
  -             JXPathContext context = JXPathContext.newContext(createContextBean());
  -             Iterator it = context.iteratePointers("/integers");
  -             List actual = new ArrayList();
  -             for (int i = 0; i < 4; i++) {
  -                     actual.add(it.next().toString());
  -             }
  -             assertEquals(
  -                     "Iterating 'next'<" + "/integers" + ">",
  -                     list(
  -                             "/integers[1]",
  -                             "/integers[2]",
  -                             "/integers[3]",
  -                             "/integers[4]"),
  -                     actual);
  -     }
  +        JXPathContext context = JXPathContext.newContext(createContextBean());
  +        Iterator it = context.iteratePointers("/integers");
  +        List actual = new ArrayList();
  +        while (it.hasNext()) {
  +            actual.add(((Pointer) it.next()).asPath());
  +        }
  +        assertEquals(
  +            "Iterating 'hasNext'/'next'<" + "/integers" + ">",
  +            list(
  +                "/integers[1]",
  +                "/integers[2]",
  +                "/integers[3]",
  +                "/integers[4]"),
  +            actual);
  +    }
  +
  +    public void testIteratePropertyArrayWithoutHasNext() {
  +        JXPathContext context = JXPathContext.newContext(createContextBean());
  +        Iterator it = context.iteratePointers("/integers");
  +        List actual = new ArrayList();
  +        for (int i = 0; i < 4; i++) {
  +            actual.add(it.next().toString());
  +        }
  +        assertEquals(
  +            "Iterating 'next'<" + "/integers" + ">",
  +            list(
  +                "/integers[1]",
  +                "/integers[2]",
  +                "/integers[3]",
  +                "/integers[4]"),
  +            actual);
  +    }
   
       public void testIterateAndSet(){
           JXPathContext context = JXPathContext.newContext(createContextBean());
  @@ -271,40 +271,40 @@
       /**
        * Test contributed by Kate Dvortsova
        */
  -     public void testIteratePointerSetValue() {
  -             JXPathContext context = JXPathContext.newContext(createContextBean());
  +    public void testIteratePointerSetValue() {
  +        JXPathContext context = JXPathContext.newContext(createContextBean());
  +
  +        assertXPathValue(context, "/beans[1]/name", "Name 1");
  +        assertXPathValue(context, "/beans[2]/name", "Name 2");
   
  -             assertXPathValue(context, "/beans[1]/name", "Name 1");
  -             assertXPathValue(context, "/beans[2]/name", "Name 2");
  +        // Test setting via context
  +        context.setValue("/beans[2]/name", "Name 2 set");
  +        assertXPathValue(context, "/beans[2]/name", "Name 2 set");
  +
  +        // Restore original value
  +        context.setValue("/beans[2]/name", "Name 2");
  +        assertXPathValue(context, "/beans[2]/name", "Name 2");
  +
  +        int iter_count = 0;
  +        Iterator iter = context.iteratePointers("/beans/name");
  +        while (iter.hasNext()) {
  +            iter_count++;
  +            Pointer pointer = (Pointer) iter.next();
  +            String s = (String) pointer.getValue();
  +            s = s + "suffix";
  +            pointer.setValue(s);
  +            assertEquals("pointer.getValue", s, pointer.getValue());
  +            // fails right here, the value isn't getting set in the bean.
  +            assertEquals(
  +                "context.getValue",
  +                s,
  +                context.getValue(pointer.asPath()));
  +        }
  +        assertEquals("Iteration count", 2, iter_count);
   
  -             // Test setting via context
  -             context.setValue("/beans[2]/name", "Name 2 set");
  -             assertXPathValue(context, "/beans[2]/name", "Name 2 set");
  -
  -             // Restore original value
  -             context.setValue("/beans[2]/name", "Name 2");
  -             assertXPathValue(context, "/beans[2]/name", "Name 2");
  -
  -             int iter_count = 0;
  -             Iterator iter = context.iteratePointers("/beans/name");
  -             while (iter.hasNext()) {
  -                     iter_count++;
  -                     Pointer pointer = (Pointer) iter.next();
  -                     String s = (String) pointer.getValue();
  -                     s = s + "suffix";
  -                     pointer.setValue(s);
  -                     assertEquals("pointer.getValue", s, pointer.getValue());
  -                     // fails right here, the value isn't getting set in the bean.
  -                     assertEquals(
  -                             "context.getValue",
  -                             s,
  -                             context.getValue(pointer.asPath()));
  -             }
  -             assertEquals("Iteration count", 2, iter_count);
  -
  -             assertXPathValue(context, "/beans[1]/name", "Name 1suffix");
  -             assertXPathValue(context, "/beans[2]/name", "Name 2suffix");
  -     }
  +        assertXPathValue(context, "/beans[1]/name", "Name 1suffix");
  +        assertXPathValue(context, "/beans[2]/name", "Name 2suffix");
  +    }
   
       public void testRoot(){
           assertXPathValueAndPointer(context,
  @@ -631,47 +631,47 @@
                   "/nestedBean/int");
       }
   
  -     public void testAttributeLang() {
  +    public void testAttributeLang() {
   
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "@xml:lang", 
               "en-US");
   
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "count(@xml:*)", 
               new Double(1));
   
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "lang('en')", 
               Boolean.TRUE);
               
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "lang('fr')", 
               Boolean.FALSE);
               
  -             assertXPathValueIterator(
  -                     context,
  -                     "beans[1]/strings[string-length() = 8]",
  -                     list("String 1", "String 2", "String 3"));
  +        assertXPathValueIterator(
  +            context,
  +            "beans[1]/strings[string-length() = 8]",
  +            list("String 1", "String 2", "String 3"));
               
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "boolean(boolean)", 
               Boolean.FALSE);
               
  -             assertXPathValue(
  -                     context,
  -                     "boolean(integers[position() < 3])",
  -                     Boolean.TRUE);
  +        assertXPathValue(
  +            context,
  +            "boolean(integers[position() < 3])",
  +            Boolean.TRUE);
               
  -             assertXPathValue(
  -                     context,
  -                     "boolean(integers[position() > 4])",
  -                     Boolean.FALSE);
  +        assertXPathValue(
  +            context,
  +            "boolean(integers[position() > 4])",
  +            Boolean.FALSE);
               
  -             assertXPathValue(context, 
  +        assertXPathValue(context, 
               "sum(integers)", 
               new Double(10));
  -     }
  +    }
   
       public void testBooleanPredicate(){
           // use child axis
  
  
  
  1.3       +32 -32    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/TestDynamicPropertyFactory.java
  
  Index: TestDynamicPropertyFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/TestDynamicPropertyFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestDynamicPropertyFactory.java   26 Nov 2002 01:20:08 -0000      1.2
  +++ TestDynamicPropertyFactory.java   26 Nov 2002 01:33:35 -0000      1.3
  @@ -80,35 +80,35 @@
        * Create a new instance and put it in the collection on the parent object.
        * Return <b>false</b> if this factory cannot create the requested object.
        */
  -     public boolean createObject(
  -             JXPathContext context,
  -             Pointer pointer,
  -             Object parent,
  -             String name,
  -             int index) 
  +    public boolean createObject(
  +            JXPathContext context,
  +            Pointer pointer,
  +            Object parent,
  +            String name,
  +            int index) 
       {
  -             if (name.equals("map")) {
  -                     ((TestBean) parent).setMap(new HashMap());
  -                     return true;
  -             } else if (name.equals("TestKey1")) {
  -                     ((Map) parent).put(name, "");
  -                     return true;
  -             } else if (name.equals("TestKey2")) {
  -                     ((Map) parent).put(name, new NestedTestBean("newName"));
  -                     return true;
  -             } else if (name.equals("TestKey3")) {
  -                     Vector v = new Vector();
  -                     for (int i = 0; i <= index; i++) {
  -                             v.add(null);
  -                     }
  -                     ((Map) parent).put(name, v);
  -                     return true;
  -             } else if (name.equals("TestKey4")) {
  -                     ((Map) parent).put(name, new Object[] { new TestBean()});
  -                     return true;
  -             }
  -             return false;
  -     }
  +        if (name.equals("map")) {
  +            ((TestBean) parent).setMap(new HashMap());
  +            return true;
  +        } else if (name.equals("TestKey1")) {
  +            ((Map) parent).put(name, "");
  +            return true;
  +        } else if (name.equals("TestKey2")) {
  +            ((Map) parent).put(name, new NestedTestBean("newName"));
  +            return true;
  +        } else if (name.equals("TestKey3")) {
  +            Vector v = new Vector();
  +            for (int i = 0; i <= index; i++) {
  +                v.add(null);
  +            }
  +            ((Map) parent).put(name, v);
  +            return true;
  +        } else if (name.equals("TestKey4")) {
  +            ((Map) parent).put(name, new Object[] { new TestBean()});
  +            return true;
  +        }
  +        return false;
  +    }
   
       public boolean declareVariable(JXPathContext context, String name){
           return false;
  
  
  
  1.4       +39 -39    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
  
  Index: XMLModelTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLModelTestCase.java     26 Nov 2002 01:20:08 -0000      1.3
  +++ XMLModelTestCase.java     26 Nov 2002 01:33:35 -0000      1.4
  @@ -121,23 +121,23 @@
           return context;
       }
   
  -     /**
  -      * An XML signature is used to determine if we have the right result
  -      * after a modification of XML by JXPath.  It is basically a piece
  -      * of simplified XML.
  -      */    
  +    /**
  +     * An XML signature is used to determine if we have the right result
  +     * after a modification of XML by JXPath.  It is basically a piece
  +     * of simplified XML.
  +     */    
       protected abstract String getXMLSignature(Object node, 
  -             boolean elements, boolean attributes, boolean text, boolean pi);
  +            boolean elements, boolean attributes, boolean text, boolean pi);
   
  -     protected void assertXMLSignature(JXPathContext context,
  -                     String path, String signature,
  -             boolean elements, boolean attributes, boolean text, boolean pi)
  -     {
  -             Object node = context.getPointer(path).getNode();
  -             String sig = getXMLSignature(node, elements, attributes, text, pi);
  -             assertEquals("XML Signature mismatch: ", signature, sig);
  -     }
  -     
  +    protected void assertXMLSignature(JXPathContext context,
  +            String path, String signature,
  +            boolean elements, boolean attributes, boolean text, boolean pi)
  +    {
  +        Object node = context.getPointer(path).getNode();
  +        String sig = getXMLSignature(node, elements, attributes, text, pi);
  +        assertEquals("XML Signature mismatch: ", signature, sig);
  +    }
  +    
       // ------------------------------------------------ Individual Test Methods
   
       public void testDocumentOrder(){
  @@ -157,26 +157,26 @@
                   1);
       }
   
  -     public void testSetValue(){
  -             assertXPathSetValue(context,
  -                             "vendor/location[@id = '100']",
  -                             "New Text");
  -             
  -             assertXMLSignature(context,
  -                             "vendor/location[@id = '100']",
  -                             "<E>New Text</E>",
  -                             false, false, true, false);
  -                             
  -             assertXPathSetValue(context,
  -                             "vendor/location[@id = '101']",
  -                             "Replacement Text");
  +    public void testSetValue(){
  +        assertXPathSetValue(context,
  +                "vendor/location[@id = '100']",
  +                "New Text");
  +        
  +        assertXMLSignature(context,
  +                "vendor/location[@id = '100']",
  +                "<E>New Text</E>",
  +                false, false, true, false);
  +                
  +        assertXPathSetValue(context,
  +                "vendor/location[@id = '101']",
  +                "Replacement Text");
   
  -             assertXMLSignature(context,
  -                             "vendor/location[@id = '101']",
  -                             "<E>Replacement Text</E>",
  -                             false, false, true, false);                            
 
  -     }
  -     
  +        assertXMLSignature(context,
  +                "vendor/location[@id = '101']",
  +                "<E>Replacement Text</E>",
  +                false, false, true, false);                
  +    }
  +    
       /**
        * Test JXPathContext.createPath() with various arguments
        */
  
  
  
  1.3       +17 -17    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/TestBeanFactory.java
  
  Index: TestBeanFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/TestBeanFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestBeanFactory.java      26 Nov 2002 01:20:08 -0000      1.2
  +++ TestBeanFactory.java      26 Nov 2002 01:33:35 -0000      1.3
  @@ -78,19 +78,19 @@
       public boolean createObject(JXPathContext context, 
                   Pointer pointer, Object parent, String name, int index)
       {
  -             if (name.equals("nestedBean")) {
  -                     ((TestBean) parent).setNestedBean(new 
NestedTestBean("newName"));
  -                     return true;
  -             } else if (name.equals("beans")) {
  -                     TestBean bean = (TestBean) parent;
  -                     if (bean.getBeans() == null || index >= 
bean.getBeans().length) {
  -                             bean.setBeans(new NestedTestBean[index + 1]);
  -                     }
  -                     ((TestBean) parent).getBeans()[index] =
  -                             new NestedTestBean("newName");
  -                     return true;
  -             }
  -             return false;   }
  +        if (name.equals("nestedBean")) {
  +            ((TestBean) parent).setNestedBean(new NestedTestBean("newName"));
  +            return true;
  +        } else if (name.equals("beans")) {
  +            TestBean bean = (TestBean) parent;
  +            if (bean.getBeans() == null || index >= bean.getBeans().length) {
  +                bean.setBeans(new NestedTestBean[index + 1]);
  +            }
  +            ((TestBean) parent).getBeans()[index] =
  +                new NestedTestBean("newName");
  +            return true;
  +        }
  +        return false;   }
   
       /**
        * Create a new object and set it on the specified variable
  
  
  
  1.5       +48 -48    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java
  
  Index: DOMModelTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOMModelTest.java 26 Nov 2002 01:20:08 -0000      1.4
  +++ DOMModelTest.java 26 Nov 2002 01:33:35 -0000      1.5
  @@ -106,53 +106,53 @@
       }
       
       protected String getXMLSignature(Object node, 
  -             boolean elements, boolean attributes, boolean text, boolean pi){
  -     StringBuffer buffer = new StringBuffer();
  -     appendXMLSignature(buffer, node, elements, attributes, text, pi);
  -     return buffer.toString();
  +            boolean elements, boolean attributes, boolean text, boolean pi){
  +        StringBuffer buffer = new StringBuffer();
  +        appendXMLSignature(buffer, node, elements, attributes, text, pi);
  +        return buffer.toString();
       }
       
       private void appendXMLSignature(StringBuffer buffer, Object object, 
  -             boolean elements, boolean attributes, boolean text, boolean pi){
  -     Node node = (Node)object;
  -     int type = node.getNodeType();
  -     switch (type){
  -             case Node.DOCUMENT_NODE:
  -                     buffer.append("<D>");
  -                     appendXMLSignature(buffer, node.getChildNodes(), 
  -                                     elements, attributes, text, pi);
  -                     buffer.append("</D");
  -                     break;
  -                     
  -             case Node.ELEMENT_NODE:
  -                     String tag = elements ? ((Element)node).getTagName() : "E";
  -                             buffer.append("<");
  -                             buffer.append(tag);
  -                             buffer.append(">");
  -                     appendXMLSignature(buffer, node.getChildNodes(), 
  -                                     elements, attributes, text, pi);
  -                             buffer.append("</");
  -                             buffer.append(tag);
  -                             buffer.append(">");                             
  -                             break;
  -                             
  -             case Node.TEXT_NODE:
  -             case Node.CDATA_SECTION_NODE:
  -                     if (text){
  -                             String string = node.getNodeValue();
  -                             string = string.replace('\n', '=');
  -                             buffer.append(string);
  -                     }
  -                             break;
  -     }
  -     }
  -     
  +            boolean elements, boolean attributes, boolean text, boolean pi){
  +        Node node = (Node)object;
  +        int type = node.getNodeType();
  +        switch (type){
  +            case Node.DOCUMENT_NODE:
  +                buffer.append("<D>");
  +                appendXMLSignature(buffer, node.getChildNodes(), 
  +                        elements, attributes, text, pi);
  +                buffer.append("</D");
  +                break;
  +                
  +            case Node.ELEMENT_NODE:
  +                String tag = elements ? ((Element)node).getTagName() : "E";
  +                buffer.append("<");
  +                buffer.append(tag);
  +                buffer.append(">");
  +                appendXMLSignature(buffer, node.getChildNodes(), 
  +                        elements, attributes, text, pi);
  +                buffer.append("</");
  +                buffer.append(tag);
  +                buffer.append(">");                    
  +                break;
  +                
  +            case Node.TEXT_NODE:
  +            case Node.CDATA_SECTION_NODE:
  +                if (text){
  +                    String string = node.getNodeValue();
  +                    string = string.replace('\n', '=');
  +                    buffer.append(string);
  +                }
  +                break;
  +        }
  +    }
  +    
       private void appendXMLSignature(StringBuffer buffer, NodeList children, 
  -             boolean elements, boolean attributes, boolean text, boolean pi)
  +            boolean elements, boolean attributes, boolean text, boolean pi)
       {
  -     for (int i = 0; i < children.getLength(); i++){
  -                     appendXMLSignature(buffer, children.item(i), 
  -                                     elements, attributes, text, pi);
  -     }
  -     }
  +        for (int i = 0; i < children.getLength(); i++){
  +            appendXMLSignature(buffer, children.item(i), 
  +                    elements, attributes, text, pi);
  +        }
  +    }
   }
  
  
  
  1.3       +27 -27    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/TestDynaBeanFactory.java
  
  Index: TestDynaBeanFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/TestDynaBeanFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestDynaBeanFactory.java  26 Nov 2002 01:20:08 -0000      1.2
  +++ TestDynaBeanFactory.java  26 Nov 2002 01:33:35 -0000      1.3
  @@ -75,30 +75,30 @@
   
       /**
        */
  -     public boolean createObject(
  -             JXPathContext context,
  -             Pointer pointer,
  -             Object parent,
  -             String name,
  -             int index) 
  +    public boolean createObject(
  +            JXPathContext context,
  +            Pointer pointer,
  +            Object parent,
  +            String name,
  +            int index) 
       {
  -             if (name.equals("nestedBean")) {
  -                     ((DynaBean) parent).set(
  -                             "nestedBean",
  -                             new NestedTestBean("newName"));
  -                     return true;
  -             } else if (name.equals("beans")) {
  -                     DynaBean bean = (DynaBean) parent;
  -                     Object beans[] = (Object[]) bean.get("beans");
  -                     if (beans == null || index >= beans.length) {
  -                             beans = new NestedTestBean[index + 1];
  -                             bean.set("beans", beans);
  -                     }
  -                     beans[index] = new NestedTestBean("newName");
  -                     return true;
  -             }
  -             return false;
  -     }
  +        if (name.equals("nestedBean")) {
  +            ((DynaBean) parent).set(
  +                "nestedBean",
  +                new NestedTestBean("newName"));
  +            return true;
  +        } else if (name.equals("beans")) {
  +            DynaBean bean = (DynaBean) parent;
  +            Object beans[] = (Object[]) bean.get("beans");
  +            if (beans == null || index >= beans.length) {
  +                beans = new NestedTestBean[index + 1];
  +                bean.set("beans", beans);
  +            }
  +            beans[index] = new NestedTestBean("newName");
  +            return true;
  +        }
  +        return false;
  +    }
   
   
       /**
  
  
  
  1.5       +41 -41    
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java
  
  Index: JDOMModelTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOMModelTest.java        26 Nov 2002 01:20:08 -0000      1.4
  +++ JDOMModelTest.java        26 Nov 2002 01:33:35 -0000      1.5
  @@ -110,46 +110,46 @@
       }
       
       protected String getXMLSignature(Object node, 
  -             boolean elements, boolean attributes, boolean text, boolean pi){
  -     StringBuffer buffer = new StringBuffer();
  -     appendXMLSignature(buffer, node, elements, attributes, text, pi);
  -     return buffer.toString();
  +            boolean elements, boolean attributes, boolean text, boolean pi){
  +        StringBuffer buffer = new StringBuffer();
  +        appendXMLSignature(buffer, node, elements, attributes, text, pi);
  +        return buffer.toString();
       }
       
       private void appendXMLSignature(StringBuffer buffer, Object object, 
  -             boolean elements, boolean attributes, boolean text, boolean pi){
  -     if (object instanceof Document){
  -                     buffer.append("<D>");
  -                     appendXMLSignature(buffer, ((Document)object).getContent(), 
  -                                     elements, attributes, text, pi);
  -                     buffer.append("</D");
  -     }
  -     else if (object instanceof Element){
  -                     String tag = elements ? ((Element)object).getName() : "E";
  -                     buffer.append("<");
  -                     buffer.append(tag);
  -                     buffer.append(">");
  -                     appendXMLSignature(buffer, ((Element)object).getContent(), 
  -                                     elements, attributes, text, pi);
  -                     buffer.append("</");
  -                     buffer.append(tag);
  -                     buffer.append(">");                             
  -     }
  -     else if (object instanceof Text || object instanceof CDATA){
  -                     if (text){
  -                             String string = ((Text)object).getText();
  -                             string = string.replace('\n', '=');
  -                             buffer.append(string);
  -                     }
  -     }
  -     }
  -     
  +            boolean elements, boolean attributes, boolean text, boolean pi){
  +        if (object instanceof Document){
  +            buffer.append("<D>");
  +            appendXMLSignature(buffer, ((Document)object).getContent(), 
  +                    elements, attributes, text, pi);
  +            buffer.append("</D");
  +        }
  +        else if (object instanceof Element){
  +            String tag = elements ? ((Element)object).getName() : "E";
  +            buffer.append("<");
  +            buffer.append(tag);
  +            buffer.append(">");
  +            appendXMLSignature(buffer, ((Element)object).getContent(), 
  +                    elements, attributes, text, pi);
  +            buffer.append("</");
  +            buffer.append(tag);
  +            buffer.append(">");                 
  +        }
  +        else if (object instanceof Text || object instanceof CDATA){
  +            if (text){
  +                String string = ((Text)object).getText();
  +                string = string.replace('\n', '=');
  +                buffer.append(string);
  +            }
  +        }
  +    }
  +    
       private void appendXMLSignature(StringBuffer buffer, List children, 
  -             boolean elements, boolean attributes, boolean text, boolean pi)
  +            boolean elements, boolean attributes, boolean text, boolean pi)
       {
  -     for (int i = 0; i < children.size(); i++){
  -                     appendXMLSignature(buffer, children.get(i), 
  -                                     elements, attributes, text, pi);
  -     }
  -     }  
  +        for (int i = 0; i < children.size(); i++){
  +            appendXMLSignature(buffer, children.get(i), 
  +                    elements, attributes, text, pi);
  +        }
  +    }  
   }
  
  
  

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

Reply via email to