vladimir    2003/08/09 12:47:33

  Modified:    java/src/org/apache/xindice/xml/dom NodeImpl.java
                        ContainerNodeImpl.java DOMParser.java
                        EntityReferenceImpl.java DOMCompressor.java
               java/src/org/apache/xindice/core MetaSystemCollection.java
                        DocumentCache.java
               java/src/org/apache/xindice/xml/sax SAXEventGenerator.java
               java/src/org/apache/xindice/core/request URIMapper.java
               java/src/org/apache/xindice/server/rpc/messages
                        GetDocument.java
               java/src/org/apache/xindice/util ByteBuffer.java
                        LockManager.java
               java/src/org/apache/xindice/core/filer BTreeFiler.java
                        Paged.java
               java/src/org/apache/xindice/xml SymbolTableSymbols.java
                        XMLCompressedInput.java TextWriter.java
               java/src/org/apache/xindice/core/data Types.java
               java/src/org/apache/xindice/core/indexer IndexManager.java
                        IndexQuery.java ValueIndexer.java
               java/src/org/apache/xindice/server UglyBrowser.java
               java/src/org/apache/xindice/core/query
                        XPathQueryResolver.java
  Log:
  - switch label with default value -> logged
  - ignored exception -> logged
  
  Revision  Changes    Path
  1.10      +18 -3     
xml-xindice/java/src/org/apache/xindice/xml/dom/NodeImpl.java
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/NodeImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NodeImpl.java     9 Aug 2003 05:01:55 -0000       1.9
  +++ NodeImpl.java     9 Aug 2003 19:47:32 -0000       1.10
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.xml.dom;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.xml.NodeSource;
   
   import org.w3c.dom.Attr;
  @@ -78,6 +80,8 @@
    */
   public abstract class NodeImpl implements CompressedNode, DBNode {
   
  +     private static final Log log = LogFactory.getLog(NodeImpl.class);
  +
       public static final String XMLNS_PREFIX = "xmlns";
   
       public static final String OBJECT_NS = 
"http://xml.apache.org/xindice/XMLObject";;
  @@ -519,7 +523,9 @@
                       pos = 0;
                       len = data.length;
                   } catch (Exception e) {
  -                    // TODO maybe log an error... Will never happen
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("ignored exception", 
e);
  +                                     }
                   }
               }
   
  @@ -571,6 +577,10 @@
                       newNode = new TextImpl(this, data, pos, len);
                       break;
   
  +                             default:
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("invalid node type : " 
+ getNodeType());
  +                                     }
               }
               if (newNode != null) {
                   return newNode;
  @@ -611,6 +621,11 @@
   
               case Node.TEXT_NODE:
                   return doc.createTextNode(nodeValue);
  +                
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid node type : " + 
getNodeType());
  +                             }
           }
   
           return null;
  
  
  
  1.12      +7 -2      
xml-xindice/java/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java
  
  Index: ContainerNodeImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ContainerNodeImpl.java    9 Aug 2003 18:56:18 -0000       1.11
  +++ ContainerNodeImpl.java    9 Aug 2003 19:47:32 -0000       1.12
  @@ -196,6 +196,11 @@
                   case Node.NOTATION_NODE:
                       childNodes.add(new NotationImpl(this, data, pos, len));
                       break;
  +                    
  +                             default:
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("invalid node type : " 
+ in.getNodeType());
  +                                     }
               }
   
               bis.setPos(pos);
  
  
  
  1.11      +13 -2     
xml-xindice/java/src/org/apache/xindice/xml/dom/DOMParser.java
  
  Index: DOMParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/DOMParser.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DOMParser.java    9 Aug 2003 18:56:18 -0000       1.10
  +++ DOMParser.java    9 Aug 2003 19:47:32 -0000       1.11
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.xml.dom;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.data.Value;
   import org.apache.xindice.util.ObjectStack;
   import org.apache.xindice.util.XindiceException;
  @@ -92,6 +94,9 @@
    * @version CVS $Revision$, $Date$
    */
   public final class DOMParser extends DefaultHandler implements DeclHandler, 
LexicalHandler {
  +
  +     private static final Log log = LogFactory.getLog(DOMParser.class);
  +
       private SAXParser sp;
       private ErrorHandler errors = null;
       private EntityResolver entities = null;
  @@ -221,6 +226,9 @@
           try {
               xr.setProperty(name, value);
           } catch (Exception e) {
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           }
       }
   
  @@ -228,6 +236,9 @@
           try {
               xr.setFeature(name, value);
           } catch (Exception e) {
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           }
       }
   
  
  
  
  1.9       +6 -2      
xml-xindice/java/src/org/apache/xindice/xml/dom/EntityReferenceImpl.java
  
  Index: EntityReferenceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/EntityReferenceImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- EntityReferenceImpl.java  9 Aug 2003 05:01:55 -0000       1.8
  +++ EntityReferenceImpl.java  9 Aug 2003 19:47:32 -0000       1.9
  @@ -150,6 +150,10 @@
                           // TODO: This
                           break;
   
  +                                     default:
  +                                             if (log.isWarnEnabled()) {
  +                                                     log.warn("invalid 
entity type : " + entityType);
  +                                             }
                   }
               }
           } catch (Exception e) {
  
  
  
  1.8       +10 -2     
xml-xindice/java/src/org/apache/xindice/xml/dom/DOMCompressor.java
  
  Index: DOMCompressor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/DOMCompressor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMCompressor.java        9 Aug 2003 05:01:55 -0000       1.7
  +++ DOMCompressor.java        9 Aug 2003 19:47:32 -0000       1.8
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.xml.dom;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.util.XindiceException;
   import org.apache.xindice.xml.Signatures;
   import org.apache.xindice.xml.SymbolTable;
  @@ -82,6 +84,8 @@
    */
   public final class DOMCompressor extends XMLCompressedOutput {
   
  +     private static final Log log = LogFactory.getLog(DOMCompressor.class);
  +
       public DOMCompressor(OutputStream os, SymbolTable st) {
           super(os, st);
       }
  @@ -276,6 +280,10 @@
                       break;
                   }
   
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid node type : " + 
node.getNodeType());
  +                             }
           }
           flush();
       }
  
  
  
  1.10      +8 -4      
xml-xindice/java/src/org/apache/xindice/core/MetaSystemCollection.java
  
  Index: MetaSystemCollection.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/MetaSystemCollection.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MetaSystemCollection.java 9 Aug 2003 05:01:55 -0000       1.9
  +++ MetaSystemCollection.java 9 Aug 2003 19:47:32 -0000       1.10
  @@ -192,7 +192,9 @@
               try {
                   dropCollection(mcol);
               } catch (DBException e) {
  -                // fail silently
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("ignored exception", e);
  +                             }
               }
           }
       }
  @@ -255,7 +257,9 @@
               try {
                   mcol.remove(id);
               } catch (DBException e) {
  -                // fail silently
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("ignored exception", e);
  +                             }
               }
           }
       }
  
  
  
  1.10      +10 -2     
xml-xindice/java/src/org/apache/xindice/core/DocumentCache.java
  
  Index: DocumentCache.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/DocumentCache.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DocumentCache.java        9 Aug 2003 18:56:19 -0000       1.9
  +++ DocumentCache.java        9 Aug 2003 19:47:32 -0000       1.10
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.core;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.data.Key;
   import org.apache.xindice.xml.NodeSource;
   import org.apache.xindice.xml.SymbolTable;
  @@ -79,6 +81,9 @@
    * @version CVS $Revision$, $Date$
    */
   public final class DocumentCache {
  +     
  +     private static final Log log = LogFactory.getLog(DocumentCache.class);
  +     
       private Map table = new WeakHashMap();
   
       /**
  @@ -98,6 +103,9 @@
                   NodeSource ns = new NodeSource(col, key);
                   doc = new DocumentImpl((byte[]) v, s, ns);
               } catch (Exception e) {
  +             if (log.isWarnEnabled()) {
  +                     log.warn("ignored exception", e);
  +             }
               }
           }
           return doc;
  
  
  
  1.25      +12 -2     
xml-xindice/java/src/org/apache/xindice/xml/sax/SAXEventGenerator.java
  
  Index: SAXEventGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/sax/SAXEventGenerator.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SAXEventGenerator.java    9 Aug 2003 18:56:19 -0000       1.24
  +++ SAXEventGenerator.java    9 Aug 2003 19:47:32 -0000       1.25
  @@ -424,6 +424,11 @@
                               case Node.COMMENT_NODE:
                                   // TODO: This
                                   break;
  +                                
  +                                                     default:
  +                                                             if 
(log.isWarnEnabled()) {
  +                                                                     
log.warn("invalid type : " + type);
  +                                                             }
                           }
   
                           break;
  @@ -435,6 +440,11 @@
   
                   case Node.NOTATION_NODE:
                       break;
  +                    
  +                             default:
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("invalid node type : " 
+ type);
  +                                     }
               }
   
               bis.setPos(pos);
  
  
  
  1.16      +7 -2      
xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java
  
  Index: URIMapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- URIMapper.java    9 Aug 2003 18:56:19 -0000       1.15
  +++ URIMapper.java    9 Aug 2003 19:47:33 -0000       1.16
  @@ -411,6 +411,11 @@
   
                       return COLLECTION;
                   }
  +
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid object type : " + 
objType);
  +                             }
           }
   
           return UNKNOWN;
  
  
  
  1.5       +9 -2      
xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetDocument.java
  
  Index: GetDocument.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetDocument.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GetDocument.java  7 Aug 2003 20:13:23 -0000       1.4
  +++ GetDocument.java  9 Aug 2003 19:47:33 -0000       1.5
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.server.rpc.messages;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.Collection;
   import org.apache.xindice.server.rpc.RPCDefaultMessage;
   import org.apache.xindice.util.SymbolSerializer;
  @@ -74,6 +76,8 @@
    */
   public class GetDocument extends RPCDefaultMessage {
   
  +     private static final Log log = LogFactory.getLog(GetDocument.class);
  +
       public Hashtable execute(Hashtable message) throws Exception {
           SymbolSerializer symbolSerializer = null;
   
  @@ -99,6 +103,9 @@
                   symbolSerializer = new SymbolSerializer(col.getSymbols());
               } catch (Exception e) {
                   // It's ok (in theory) for a Collection to have no symbol 
table
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("ignored exception", e);
  +                             }
               }
   
               long timestamp = 1;
  
  
  
  1.8       +11 -2     
xml-xindice/java/src/org/apache/xindice/util/ByteBuffer.java
  
  Index: ByteBuffer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/util/ByteBuffer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ByteBuffer.java   9 Aug 2003 18:56:19 -0000       1.7
  +++ ByteBuffer.java   9 Aug 2003 19:47:33 -0000       1.8
  @@ -68,6 +68,9 @@
   import java.io.Serializable;
   import java.io.UnsupportedEncodingException;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   /**
    * ByteBuffer manages volatile arrays of bytes. It is implemented with
    * nearly the same method prototypes as StringBuffer except for the
  @@ -83,6 +86,9 @@
    * @version CVS $Revision$, $Date$
    */
   public final class ByteBuffer extends OutputStream implements Serializable {
  +
  +     private static final Log log = LogFactory.getLog(ByteBuffer.class);
  +
       static final long serialVersionUID = -3900903004630456844L;
   
       private transient int length = 0;
  @@ -199,6 +205,9 @@
           try {
               value.writeTo(this);
           } catch (Exception e) {
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           }
       }
   
  
  
  
  1.6       +13 -3     
xml-xindice/java/src/org/apache/xindice/util/LockManager.java
  
  Index: LockManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/util/LockManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LockManager.java  9 Aug 2003 05:01:55 -0000       1.5
  +++ LockManager.java  9 Aug 2003 19:47:33 -0000       1.6
  @@ -62,6 +62,9 @@
   import java.util.HashMap;
   import java.util.Map;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   /**
    * LockManager manages resource locks.  A resource is any shared object that
    * can be represented as a long.  The LockManager should be constructed using
  @@ -71,10 +74,11 @@
    */
   public final class LockManager {
   
  +     private static final Log log = LogFactory.getLog(LockManager.class);
  +
       private int maxLocks = 0;
       private Map locks = new HashMap(); // Long to LockInfo
   
  -
       public LockManager(int maxLocks) {
           this.maxLocks = maxLocks;
       }
  @@ -105,6 +109,9 @@
                   try {
                       info.wait();
                   } catch (Exception e) {
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("ignored exception", 
e);
  +                                     }
                   }
               }
               info.count++;
  @@ -171,6 +178,9 @@
                   try {
                       info.wait();
                   } catch (Exception e) {
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("ignored exception", 
e);
  +                                     }
                   }
                   stolen = maxLocks - info.count;
                   total += stolen;
  
  
  
  1.15      +5 -2      
xml-xindice/java/src/org/apache/xindice/core/filer/BTreeFiler.java
  
  Index: BTreeFiler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/BTreeFiler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BTreeFiler.java   9 Aug 2003 18:56:18 -0000       1.14
  +++ BTreeFiler.java   9 Aug 2003 19:47:33 -0000       1.15
  @@ -152,6 +152,9 @@
   
               return new Record(key, v, meta);
           } catch (BTreeNotFoundException e) {
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           } catch (BTreeException e) {
               throw e;
           } catch (Exception e) {
  
  
  
  1.19      +12 -3     
xml-xindice/java/src/org/apache/xindice/core/filer/Paged.java
  
  Index: Paged.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/Paged.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Paged.java        9 Aug 2003 18:56:18 -0000       1.18
  +++ Paged.java        9 Aug 2003 19:47:33 -0000       1.19
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.core.filer;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.DBException;
   import org.apache.xindice.core.FaultCodes;
   import org.apache.xindice.core.DBObject;
  @@ -89,6 +91,8 @@
    */
   public abstract class Paged implements DBObject {
   
  +     private static final Log log = LogFactory.getLog(Paged.class);
  +
       // The maximum number of pages that will be held in the dirty cache.
       private static final int MAX_DIRTY_SIZE = 128;
   
  @@ -168,7 +172,9 @@
                           wait();
                           return (RandomAccessFile) descriptors.pop();
                       } catch (Exception e) {
  -                        // Who Cares
  +                                             if (log.isWarnEnabled()) {
  +                                                     log.warn("ignored 
exception", e);
  +                                             }
                       }
                   }
               }
  @@ -508,6 +514,9 @@
                           descCount -= 1;
                       } catch (Exception e) {
                           // TODO Hmmmm....
  +                                             if (log.isWarnEnabled()) {
  +                                                     log.warn("ignored 
exception", e);
  +                                             }
                       }
                   }
                   return true;
  
  
  
  1.6       +9 -2      
xml-xindice/java/src/org/apache/xindice/xml/SymbolTableSymbols.java
  
  Index: SymbolTableSymbols.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/SymbolTableSymbols.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SymbolTableSymbols.java   8 Aug 2003 22:47:14 -0000       1.5
  +++ SymbolTableSymbols.java   9 Aug 2003 19:47:33 -0000       1.6
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.xml;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.xml.dom.DOMParser;
   
   import org.w3c.dom.Element;
  @@ -71,6 +73,8 @@
    */
   public final class SymbolTableSymbols extends SymbolTable {
   
  +     private static final Log log = 
LogFactory.getLog(SymbolTableSymbols.class);
  +
       private static String SYMBOLS_DEFINITION
               = "<symbols>"
               + "   <symbol name=\"" + SYMBOLS + "\" id=\"0\" />"
  @@ -86,6 +90,9 @@
           try {
               symbolsElem = 
DOMParser.toDocument(SYMBOLS_DEFINITION).getDocumentElement();
           } catch (Exception e) {
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           }
           streamFromXML(symbolsElem);
       }
  
  
  
  1.7       +23 -2     
xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedInput.java
  
  Index: XMLCompressedInput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedInput.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLCompressedInput.java   9 Aug 2003 18:56:18 -0000       1.6
  +++ XMLCompressedInput.java   9 Aug 2003 19:47:33 -0000       1.7
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.xml;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.w3c.dom.Node;
   
   import java.io.DataInputStream;
  @@ -72,6 +74,9 @@
    * @version CVS $Revision$, $Date$
    */
   public class XMLCompressedInput extends DataInputStream {
  +     
  +     private static final Log log = 
LogFactory.getLog(XMLCompressedInput.class);
  +     
       private byte signature = 0;
       private SymbolTable st = null;
   
  @@ -148,6 +153,10 @@
                           return Signatures.Unknown;
   
                   }
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid signature : " + type);
  +                             }
   
           }
           return Signatures.Unknown;
  @@ -179,6 +188,10 @@
               case Node.NOTATION_NODE:
                   sizeType = (byte) (signature & 0x03);
                   break;
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid node type : " + 
nodeType);
  +                             }
           }
   
           switch (sizeType) {
  @@ -195,6 +208,10 @@
               case Signatures.NoContent:
                   // Do Nothing
   
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid size : " + sizeType);
  +                             }
           }
           return 0;
       }
  @@ -226,6 +243,10 @@
               case Signatures.NoContent:
                   // Do Nothing
   
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid signature type : " + 
countType);
  +                             }
           }
           return 0;
       }
  
  
  
  1.12      +62 -72    
xml-xindice/java/src/org/apache/xindice/xml/TextWriter.java
  
  Index: TextWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/TextWriter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TextWriter.java   9 Aug 2003 05:01:55 -0000       1.11
  +++ TextWriter.java   9 Aug 2003 19:47:33 -0000       1.12
  @@ -126,64 +126,57 @@
           switch (type) {
   
               case Node.DOCUMENT_NODE:
  -                {
  -                    writer.write("<?xml version=\"1.0\"?>\n");
  -                    writeChildren(writer, node);
  -                    break;
  -                }
  +                writer.write("<?xml version=\"1.0\"?>\n");
  +                writeChildren(writer, node);
  +                break;
   
               case Node.DOCUMENT_FRAGMENT_NODE:
  -                {
  -                    writeChildren(writer, node);
  -                    break;
  -                }
  +                writeChildren(writer, node);
  +                break;
   
               case Node.DOCUMENT_TYPE_NODE:
  -                {
  -                    if (log.isErrorEnabled()) {
  -                        log.error("can't serialize doctype yet");
  -                    }
  -                    /*
  -                    DocumentType d = (DocumentType)node;
  -                    writer.write("<!DOCTYPE ");
  -                    
writer.write(node.getOwnerDocument().getDocumentElement().getNodeName());
  -                    writer.write('>');
  -                    */
  -                    break;
  +                if (log.isErrorEnabled()) {
  +                    log.error("can't serialize doctype yet");
                   }
  +                /*
  +                DocumentType d = (DocumentType)node;
  +                writer.write("<!DOCTYPE ");
  +                
writer.write(node.getOwnerDocument().getDocumentElement().getNodeName());
  +                writer.write('>');
  +                */
  +                break;
   
               case Node.ELEMENT_NODE:
  -                {
  -                    Element e = (Element) node;
  -                    String n = e.getTagName();
  +                Element e = (Element) node;
  +                String n = e.getTagName();
   
  -                    writer.write('<');
  -                    writer.write(n);
  +                writer.write('<');
  +                writer.write(n);
   
  -                    NamedNodeMap a = e.getAttributes();
  -                    int size = a.getLength();
  -                    for (int i = 0; i < size; i++) {
  -                        Attr att = (Attr) a.item(i);
  -                        writer.write(' ');
  -                        writeNode(writer, att);
  -                    }
  -
  -                    if (e.hasChildNodes()) {
  -                        writer.write('>');
  -                        writeChildren(writer, node);
  -                        writer.write("</");
  -                        writer.write(n);
  -                        writer.write('>');
  -                    } else
  -                        writer.write(" />");
  -                    break;
  +                NamedNodeMap a = e.getAttributes();
  +                int size = a.getLength();
  +                for (int i = 0; i < size; i++) {
  +                    Attr att = (Attr) a.item(i);
  +                    writer.write(' ');
  +                    writeNode(writer, att);
                   }
   
  +                if (e.hasChildNodes()) {
  +                    writer.write('>');
  +                    writeChildren(writer, node);
  +                    writer.write("</");
  +                    writer.write(n);
  +                    writer.write('>');
  +                } else {
  +                    writer.write(" />");
  +                }
  +                break;
  +
               case Node.ATTRIBUTE_NODE:
  -                Attr a = (Attr) node;
  -                writer.write(a.getName());
  +                Attr att = (Attr) node;
  +                writer.write(att.getName());
                   writer.write("=\"");
  -                writeEscapedText(writer, a.getValue());
  +                writeEscapedText(writer, att.getValue());
                   writer.write("\"");
                   break;
   
  @@ -206,37 +199,34 @@
                   break;
   
               case Node.PROCESSING_INSTRUCTION_NODE:
  -                {
  -                    ProcessingInstruction pi = (ProcessingInstruction) node;
  -                    writer.write("<?");
  -                    writer.write(pi.getTarget());
  -                    writer.write(" ");
  -                    writer.write(pi.getData());
  -                    writer.write("?>\n");
  -                    break;
  -                }
  +                ProcessingInstruction pi = (ProcessingInstruction) node;
  +                writer.write("<?");
  +                writer.write(pi.getTarget());
  +                writer.write(" ");
  +                writer.write(pi.getData());
  +                writer.write("?>\n");
  +                break;
   
               case Node.TEXT_NODE:
  -                {
  -                    writeEscapedText(writer, node.getNodeValue());
  -                    break;
  -                }
  +                writeEscapedText(writer, node.getNodeValue());
  +                break;
   
               case Node.CDATA_SECTION_NODE:
  -                {
  -                    writer.write("<![CDATA[");
  -                    writer.write(node.getNodeValue());
  -                    writer.write("]]>");
  -                    break;
  -                }
  +                writer.write("<![CDATA[");
  +                writer.write(node.getNodeValue());
  +                writer.write("]]>");
  +                break;
   
               case Node.COMMENT_NODE:
  -                {
  -                    writer.write("<!--");
  -                    writer.write(node.getNodeValue());
  -                    writer.write("-->");
  -                    break;
  -                }
  +                writer.write("<!--");
  +                writer.write(node.getNodeValue());
  +                writer.write("-->");
  +                break;
  +                
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid node type : " + node);
  +                             }
           }
       }
   
  
  
  
  1.8       +13 -3     
xml-xindice/java/src/org/apache/xindice/core/data/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/data/Types.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Types.java        9 Aug 2003 12:23:13 -0000       1.7
  +++ Types.java        9 Aug 2003 19:47:33 -0000       1.8
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.core.data;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.w3c.dom.Document;
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.Element;
  @@ -75,6 +77,11 @@
    */
   public final class Types {
   
  +     /**
  +      * Logger used by this class
  +      */
  +     private static final Log log = LogFactory.getLog(Types.class);
  +
       public final static int EMPTY = -1;
       public final static int UNKNOWN = -1;
       public final static int VOID = 0;
  @@ -189,7 +196,10 @@
                   return "Args";
               case VARIANT:
                   return "Variant";
  -
  +            default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid type found : " + 
type);
  +                             }
           }
           return "Invalid";
       }
  
  
  
  1.19      +15 -2     
xml-xindice/java/src/org/apache/xindice/core/indexer/IndexManager.java
  
  Index: IndexManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/IndexManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- IndexManager.java 9 Aug 2003 18:56:18 -0000       1.18
  +++ IndexManager.java 9 Aug 2003 19:47:33 -0000       1.19
  @@ -415,6 +415,9 @@
                   try {
                       idxList[i].indexer.flush();
                   } catch (Exception e) {
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("ignored exception", 
e);
  +                                     }
                   }
               }
           }
  @@ -427,6 +430,9 @@
                   try {
                       idxList[i].indexer.flush();
                   } catch (Exception e) {
  +                                     if (log.isWarnEnabled()) {
  +                                             log.warn("ignored exception", 
e);
  +                                     }
                   }
               }
           }
  @@ -482,6 +488,9 @@
                       try {
                           collection.flushSymbolTable();
                       } catch (Exception e) {
  +                                             if (log.isWarnEnabled()) {
  +                                                     log.warn("ignored 
exception", e);
  +                                             }
                       }
                   }
               } catch (Exception e) {
  @@ -536,6 +545,10 @@
                               case ACTION_DELETE:
                                   list[i].indexer.remove(value, key, pos, len, 
pattern.getElementID(), pattern.getAttributeID());
                                   break;
  +                            default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid action : " + action);
  +                             }    
                           }
                       } catch (Exception e) {
                           log.warn(e);
  
  
  
  1.5       +13 -3     
xml-xindice/java/src/org/apache/xindice/core/indexer/IndexQuery.java
  
  Index: IndexQuery.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/IndexQuery.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IndexQuery.java   7 Aug 2003 20:13:21 -0000       1.4
  +++ IndexQuery.java   9 Aug 2003 19:47:33 -0000       1.5
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.core.indexer;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.data.Value;
   
   import java.util.Arrays;
  @@ -72,6 +74,11 @@
    */
   public class IndexQuery {
   
  +     /**
  +      * Logger used by this class
  +      */
  +     private static final Log log = LogFactory.getLog(IndexQuery.class);
  +
       // No Operator
       public static final int ANY = 0;   // Any And All Matches
   
  @@ -256,7 +263,10 @@
               case NSW:
                   return value.startsWith(vals[0]) ? op == SW
                           : op == NSW;
  -
  +                     default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid operation : " + op);
  +                             }
           }
   
           return false;
  
  
  
  1.13      +6 -2      
xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java
  
  Index: ValueIndexer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ValueIndexer.java 9 Aug 2003 18:56:18 -0000       1.12
  +++ ValueIndexer.java 9 Aug 2003 19:47:33 -0000       1.13
  @@ -269,6 +269,10 @@
                               return EmptyValue;
                           }
                           break;
  +                    default:
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("invalid type : " + type);
  +                     }
                   }
                   return new Value(b);
               } catch (Exception e) {
  
  
  
  1.8       +10 -3     
xml-xindice/java/src/org/apache/xindice/server/UglyBrowser.java
  
  Index: UglyBrowser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/UglyBrowser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- UglyBrowser.java  9 Aug 2003 18:56:19 -0000       1.7
  +++ UglyBrowser.java  9 Aug 2003 19:47:33 -0000       1.8
  @@ -59,6 +59,8 @@
   
   package org.apache.xindice.server;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.xindice.core.Collection;
   import org.apache.xindice.core.DBException;
   import org.apache.xindice.core.Database;
  @@ -81,6 +83,8 @@
    */
   public class UglyBrowser {
   
  +     private static final Log log = LogFactory.getLog(UglyBrowser.class);
  +
       /**
        *
        */
  @@ -196,6 +200,9 @@
               }
           } catch (DBException e) {
               // do nothing but this collection cannot store documents.
  +                     if (log.isWarnEnabled()) {
  +                             log.warn("ignored exception", e);
  +                     }
           }
   
           return result.toString();
  
  
  
  1.21      +6 -2      
xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java
  
  Index: XPathQueryResolver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XPathQueryResolver.java   9 Aug 2003 18:56:19 -0000       1.20
  +++ XPathQueryResolver.java   9 Aug 2003 19:47:33 -0000       1.21
  @@ -959,6 +959,10 @@
                                   type = "trimmed";
                               }
                               break;
  +                        default:
  +                             if (log.isWarnEnabled()) {
  +                                     log.warn("invalid object type : " + 
objType);
  +                             }
                       }
                       if (type != null) {
                           e.setAttribute("type", type);
  
  
  

Reply via email to