1 19 24 25 package org.netbeans.modules.exceptions; 26 27 import java.io.IOException ; 28 import java.io.PrintWriter ; 29 import java.sql.ResultSet ; 30 import java.sql.Statement ; 31 import javax.servlet.ServletException ; 32 import javax.servlet.http.HttpServlet ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 import static org.netbeans.modules.exceptions.Utils.*; 36 37 42 public class SelectIssue extends HttpServlet { 43 private String issueId; 44 public static String ID_PARAM = "Id"; 45 49 protected void processRequest(HttpServletRequest request, HttpServletResponse response) 50 throws ServletException , IOException { 51 try { 52 response.setContentType("text/html;charset=UTF-8"); 53 PrintWriter out = response.getWriter(); 54 issueId = request.getParameter(ID_PARAM); 55 Statement stmt = getConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); 56 out.println("<table border='1'>"); 57 ResultSet result; 59 result = executeQuery(stmt, SELECT_ISSUE + String.valueOf(issueId)); 60 String loggerId=""; 61 if (!result.next()){ 62 out.println("Issue Id was not found in ISSUE TABLE"); 63 }else{ 64 loggerId = result.getString(3); 65 out.println(createTableRow("Issue Id", result.getString(1))); 66 out.println(createTableRow("Summary",result.getString(2))); 67 out.println(createTableRow("LoggerId",loggerId)); 68 out.println(createTableRow("VM",result.getString(4))); 69 out.println(createTableRow("Product version",result.getString(5))); 70 out.println(createTableRow("Component",result.getString(6))); 71 out.println(createTableRow("SubComponent",result.getString(7))); 72 out.println(createTableRow("Assign to",result.getString(8))); 73 out.println(createTableRow("Operating System",result.getString(9))); 74 out.println(createTableRow("Severity", result.getString(10))); 75 } 76 result = executeQuery(stmt, SELECT_USER + String.valueOf(issueId)); 78 if (!result.next()){ 79 out.println("Issue Id was not found in IssueNbUser TABLE"); 80 }else{ 81 out.println(createTableRow("Date", result.getString(1))); 82 out.println(createTableRow("User Name", result.getString(2))); 83 } 84 result = executeQuery(stmt, SELECT_HASH_BY_ISSUE + String.valueOf(issueId)); 86 if (!result.next()){ 87 out.println("Issue Id was not found in HASHCODE"); 88 }else{ 89 out.println(createTableRow("HASH", result.getString(1))); 90 } 91 out.println("</table>"); 92 out.println("<h3>STACK_TRACE:</h3>"); 94 result = executeQuery(stmt, SELECT_STACKTRACE + String.valueOf(issueId)); 95 if (!result.next()){ 96 out.println("IssueId was not found in StackTrace TABLE"); 97 }else{ 98 out.println("<b>MESSAGE:</b>" + result.getString(1)+"<br/>\n"); 99 out.println(result.getString(2)+":<br/>\n"); 100 } 101 out.println("<blockquote>"); 103 result = executeQuery(stmt, SELECT_LINES + String.valueOf(issueId)+ " order by Line_Order"); 104 while (result.next()){ 105 out.println(result.getString(1)+"("+result.getString(2)+":"+result.getString(3)+")<br/>\n"); 106 } 107 out.println("</blockquote>"); 108 out.println("<h3>COMMENTS:</h3>"); 110 result = executeQuery(stmt, SELECT_COMMENT + String.valueOf(issueId)); 111 while (result.next()){ 112 out.println("<p>\n"); 113 out.println("<b>"+result.getString(1)+":</b>"); 114 out.println(result.getString(2)+"\n"); 115 out.println("</p>\n"); 116 } 117 result = executeQuery(stmt, SELECT_LOGGER + String.valueOf(loggerId)); 118 out.println("<h3>LOGGER:</h3>"); 119 String str; 120 while (result.next()){ 121 out.println("<p>\n"); 122 str = Utils.getHTMLLog(result); 123 out.println(str+"\n"); 124 out.println("</p>\n"); 125 } 126 stmt.close(); 127 } catch (Exception ex) { 128 java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, 129 ex.getMessage(), ex); 130 } 131 } 132 private String createTableRow(String name, String value){ 133 return "<tr><td>"+name+"</td><td>"+value+"</td></tr>"; 134 } 135 136 141 protected void doGet(HttpServletRequest request, HttpServletResponse response) 142 throws ServletException , IOException { 143 processRequest(request, response); 144 } 145 146 150 protected void doPost(HttpServletRequest request, HttpServletResponse response) 151 throws ServletException , IOException { 152 processRequest(request, response); 153 } 154 155 157 public String getServletInfo() { 158 return "This servlet is for showing content of an issue"; 159 } 160 } 162 | Popular Tags |