1 19 20 package edu.umd.cs.findbugs.tools.html; 21 22 import java.io.IOException ; 23 import java.io.OutputStream ; 24 import java.io.PrintStream ; 25 26 import edu.umd.cs.findbugs.BugPattern; 27 28 public class PlainPrintBugDescriptions extends PrintBugDescriptions { 29 private String docTitle; 30 private PrintStream out; 31 32 public PlainPrintBugDescriptions(String docTitle, OutputStream out) { 33 this.docTitle = docTitle; 34 this.out = new PrintStream (out); 35 } 36 37 protected String getDocTitle() { return docTitle; } 38 39 protected PrintStream getPrintStream() { return out; } 40 41 @Override 42 protected void prologue() throws IOException { 43 out.println("<html><head><title>" + docTitle + "</title>"); 44 header(); 45 out.println("</head><body>"); 46 beginBody(); 47 out.println("<h1>" + docTitle + "</h1>"); 48 } 49 50 @Override 51 protected void emit(BugPattern bugPattern) throws IOException { 52 out.println("<h2>" + bugPattern.getAbbrev() + ": " + 53 bugPattern.getShortDescription() + "</h2>"); 54 out.println(bugPattern.getDetailText()); 55 } 56 57 @Override 58 protected void epilogue() throws IOException { 59 endBody(); 60 out.println("</body></html>"); 61 } 62 63 64 protected void header() throws IOException { 65 } 66 67 68 protected void beginBody() throws IOException { 69 } 70 71 72 protected void endBody() throws IOException { 73 } 74 75 public static void main(String [] args) throws Exception { 76 String docTitle = "FindBugs Bug Descriptions"; 77 if (args.length > 0) 78 docTitle = args[0]; 79 new PlainPrintBugDescriptions(docTitle, System.out).print(); 80 } 81 } 82 83 | Popular Tags |