public HttpReport(QAT parent, String urlString, String baseDir, StatusWindow status) { // check if the basedir exists if (!(new File(baseDir).exists())) { String message = "Error - cannot generate report, directory does not exist:" + baseDir; if (status == null) { System.out.println(message); } else { status.setMessage(message); } return; } this.parent = parent; this.status = status; processedLinks = new ArrayList(); try { processURL(new URL(urlString), baseDir, status); writeDeadLinks(baseDir); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { processedLinks.clear(); } }
private void writeDeadFile(String fileName) { try { PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(fileName))); out.println("<TITLE>Error</TITLE>"); out.println("<BODY BGCOLOR=\"white\">"); out.println("<h1>Operation not allowed</h1>"); out.println("<hr>"); out.println("<P>This operation only works for live Qat instances"); out.println("<hr>"); out.println("<A HREF=\"./index.html\">Report Index</A><BR>"); out.println("</BODY>"); out.println("</HTML>"); out.flush(); out.close(); } catch (IOException e) { System.out.println("Error writing page:" + fileName + " " + e.toString()); } }