Coverage report

  %line %branch
mnemosyne.archiver.ArchiveOutputStream
91% 
92% 

 1  
 /*
 2  
  * Copyright 2004 Charles Blaxland
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package mnemosyne.archiver;
 17  
 
 18  
 import mnemosyne.core.Persistable;
 19  
 
 20  
 import java.io.ObjectOutputStream;
 21  
 import java.io.OutputStream;
 22  
 import java.io.IOException;
 23  
 
 24  
 import org.apache.commons.logging.LogFactory;
 25  
 import org.apache.commons.logging.Log;
 26  
 
 27  
 /**
 28  
  * @version $Id: ArchiveOutputStream.java,v 1.1.1.1 2004/08/07 06:40:50 charlesblaxland Exp $
 29  
  */
 30  
 public class ArchiveOutputStream extends ObjectOutputStream
 31  
 {
 32  8
     private static final Log log = LogFactory.getLog(ArchiveOutputStream.class);
 33  
 
 34  
     public ArchiveOutputStream(OutputStream out)
 35  
             throws IOException
 36  
     {
 37  17
         super(out);
 38  17
         enableReplaceObject(true);
 39  17
     }
 40  
 
 41  
     protected Object replaceObject(Object obj) throws IOException
 42  
     {
 43  74
         if (obj instanceof Persistable)
 44  
         {
 45  27
             Persistable persistable = (Persistable) obj;
 46  27
             if (!persistable.isArchiveVersion())
 47  
             {
 48  13
                 obj = persistable.getPersistentObject();
 49  13
                 if (log.isTraceEnabled())
 50  
                 {
 51  0
                     log.trace("Replaced object of type " + persistable.getClass().getName() + " with persistent object " + obj);
 52  
                 }
 53  
             }
 54  
         }
 55  
 
 56  74
         return obj;
 57  
     }
 58  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.