vladimir    2003/06/27 21:12:22

  Modified:    java/src/org/apache/xindice/core/meta/inline
                        InlineMetaService.java
  Log:
  - log.isXYZEnabled around a log statement
  - minor: 4 spaces, no tabs
  
  Revision  Changes    Path
  1.2       +57 -49    
xml-xindice/java/src/org/apache/xindice/core/meta/inline/InlineMetaService.java
  
  Index: InlineMetaService.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/meta/inline/InlineMetaService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InlineMetaService.java    13 Jun 2003 14:11:47 -0000      1.1
  +++ InlineMetaService.java    28 Jun 2003 04:12:22 -0000      1.2
  @@ -92,27 +92,28 @@
   
        private static Log log = 
LogFactory.getLog("org.apache.xindice.core.meta.inline");
   
  -     /**
  -      * Get an <code>InlineMetaMap</code> instance corresponding to the
  -      * current header version.  Used by <code>Collection</code> to inform
  -      * the InlineMeta code of the metadata values for the entry being 
stored.
  -      * 
  -      * @return InlineMetaMap instance
  -      */
  -     public InlineMetaMap getEmptyMap() {
  -             try {
  -                     return (InlineMetaMap) currentMapClass.newInstance();
  -             }
  -             catch (Exception e) {
  -                     /*
  -                      * This can only happen as a result of a programming 
error,
  -                      * so log it and throw a runtime.  Shouldn't happen in 
production.
  -                      */
  -                     log.fatal("unable to create instance of current inline 
metadata" + " map class '" + currentMapClass.getName() + "'", e);
  -                     throw new IllegalStateException(
  -                             "unable to create instance" + " of current 
inline metadata map class '" + currentMapClass.getName() + "'");
  -             }
  -     }
  +    /**
  +     * Get an <code>InlineMetaMap</code> instance corresponding to the
  +     * current header version.  Used by <code>Collection</code> to inform
  +     * the InlineMeta code of the metadata values for the entry being stored.
  +     * 
  +     * @return InlineMetaMap instance
  +     */
  +    public InlineMetaMap getEmptyMap() {
  +        try {
  +            return (InlineMetaMap) currentMapClass.newInstance();
  +        } catch (Exception e) {
  +            String msg = "unable to create instance of current inline 
metadata map class '" + currentMapClass.getName() + "'";
  +            /*
  +             * This can only happen as a result of a programming error,
  +             * so log it and throw a runtime.  Shouldn't happen in 
production.
  +             */
  +            if (log.isFatalEnabled()) {
  +                log.fatal(msg, e);
  +            }
  +            throw new IllegalStateException(msg);
  +        }
  +    }
   
        /**
         * Create a Value object containing the appropriate header and
  @@ -156,36 +157,43 @@
         * @throws InlineMetaException if missing the reader for the header, or 
if
         *         the header is corrupted.
         */
  -     public DatabaseEntry readDatabaseEntry(Value rawValue) throws 
InlineMetaException {
  -
  -             log.debug("readDatabaseEntry: rawValue: length=" + 
rawValue.getLength());
  -
  -             byte[] rawData = rawValue.getData();
  -
  -             log.debug("readDatabaseEntry: rawData: length=" + 
rawData.length + " byte 0: " + rawData[0] + " byte 1: " + rawData[1]);
  -
  -             /*
  -              * Read the header.
  -              */
  -
  -             int version = rawData[1];
  -             if (!haveReaderForVersion(version)) {
  -                     throw new 
InlineMetaException(FaultCodes.GEN_CRITICAL_ERROR, "No inline metadata reader 
available for version " + version);
  -             }
  -             InlineMetaReader reader = readerByVersion[version];
  -             log.debug("readHeader: reader=" + reader);
  -
  -             InlineMetaMap map = reader.read(rawData, 2, rawData[0] - 2);
  -             log.debug("readDatabaseEntry: map: type=" + map.get("type"));
  -
  -             /*
  -              * Exract the data into a Value object.
  -              */
  +    public DatabaseEntry readDatabaseEntry(Value rawValue) throws 
InlineMetaException {
  +        if (log.isDebugEnabled()) {
  +            log.debug("readDatabaseEntry: rawValue: length=" + 
rawValue.getLength());
  +        }
  +        
  +        byte[] rawData = rawValue.getData();
  +
  +        if (log.isDebugEnabled()) {
  +            log.debug("readDatabaseEntry: rawData: length=" + rawData.length 
+ " byte 0: " + rawData[0] + " byte 1: " + rawData[1]);
  +        }
  +
  +        /* Read the header. */
  +
  +        int version = rawData[1];
  +        if (!haveReaderForVersion(version)) {
  +            throw new InlineMetaException(FaultCodes.GEN_CRITICAL_ERROR, "No 
inline metadata reader available for version " + version);
  +        }
  +        InlineMetaReader reader = readerByVersion[version];
  +        if (log.isDebugEnabled()) {
  +            log.debug("readHeader: reader=" + reader);
  +        }
  +        
  +        InlineMetaMap map = reader.read(rawData, 2, rawData[0] - 2);
  +        if (log.isDebugEnabled()) {
  +            log.debug("readDatabaseEntry: map: type=" + map.get("type"));
  +        }
  +
  +        /*
  +         * Exract the data into a Value object.
  +         */
   
                Value value = new Value(rawData, rawData[0], rawData.length - 
rawData[0]);
  -             log.debug("readDatabaseEntry: value: type=" + map.get("type"));
  +        if (log.isDebugEnabled()) {
  +            log.debug("readDatabaseEntry: value: type=" + map.get("type"));
  +        }
   
  -             return new DatabaseEntry(map, value);
  +        return new DatabaseEntry(map, value);
        }
   
        /**
  
  
  

Reply via email to