Coverage Report - org.paneris.bibliomania.pagination.ShowTexLog
 
Classes in this File Line Coverage Branch Coverage Complexity
ShowTexLog
0%
0/12
0%
0/2
4
 
 1  
 package org.paneris.bibliomania.pagination;
 2  
 
 3  
 import java.io.File;
 4  
 import java.io.FileNotFoundException;
 5  
 import java.io.FileReader;
 6  
 import java.io.IOException;
 7  
 
 8  
 import org.melati.Melati;
 9  
 import org.melati.util.IoUtils;
 10  
 import org.paneris.bibliomania.BibliomaniaDatabase;
 11  
 import org.paneris.bibliomania.BibliomaniaServlet;
 12  
 import org.webmacro.WebMacroException;
 13  
 import org.webmacro.servlet.HandlerException;
 14  
 import org.webmacro.servlet.WebContext;
 15  
 
 16  0
 public class ShowTexLog extends BibliomaniaServlet {
 17  
 
 18  
   private static final long serialVersionUID = 1L;
 19  
 
 20  
   protected String area() {
 21  0
     return "Admin";
 22  
   }
 23  
 
 24  
   protected String bibliomaniaHandle(Melati melati, WebContext context)
 25  
       throws WebMacroException {
 26  0
     File log = new File(context.getForm("texLogFile"));
 27  0
     if (!((BibliomaniaDatabase)melati.getDatabase()).pagination().
 28  
             isTempFile(log))
 29  0
       throw new HandlerException("access to " + log + " not granted");
 30  
 
 31  
     try {
 32  0
       context.put("log", new String(IoUtils.slurp(new FileReader(log), 4096)));
 33  0
     } catch (FileNotFoundException e) {
 34  0
       throw new HandlerException("File" + log + " not found:" + e.toString());
 35  0
     } catch (IOException e) {
 36  0
       throw new HandlerException(e.toString());
 37  0
     }
 38  
 
 39  0
     return bibliomaniaTemplate("pagination/TexLog.wm");
 40  
   }
 41  
 }