|
| 1 | +package testcasesupport; |
| 2 | + |
| 3 | +import javax.servlet.http.*; |
| 4 | + |
| 5 | +public class ServletMain extends HttpServlet { |
| 6 | + |
| 7 | + private static final long serialVersionUID = 1L; /* needed since Servlets are serializable */ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + public void doPost(HttpServletRequest request, HttpServletResponse response) { |
| 12 | + doGet(request, response); |
| 13 | + } |
| 14 | + |
| 15 | + public void doGet(HttpServletRequest request, HttpServletResponse response) { |
| 16 | + doGetCWE1(request, response); |
| 17 | + doGetCWE2(request, response); |
| 18 | + doGetCWE3(request, response); |
| 19 | + doGetCWE4(request, response); |
| 20 | + doGetCWE5(request, response); |
| 21 | + doGetCWE6(request, response); |
| 22 | + doGetCWE7(request, response); |
| 23 | + doGetCWE8(request, response); |
| 24 | + doGetCWE9(request, response); |
| 25 | + } |
| 26 | + |
| 27 | + private static void doGetCWE1(HttpServletRequest request, HttpServletResponse response) { |
| 28 | + try { |
| 29 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-1 */ |
| 30 | + /* END-AUTOGENERATED-SERVLET-TESTS-1 */ |
| 31 | + } catch (Throwable t) { |
| 32 | + |
| 33 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 34 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 35 | + */ |
| 36 | + |
| 37 | + System.out.println( |
| 38 | + " Caught thowable from doGetCWE1 "); |
| 39 | + |
| 40 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 41 | + |
| 42 | + System.out.println("Stack trace below"); |
| 43 | + |
| 44 | + StackTraceElement stes[] = t.getStackTrace(); |
| 45 | + |
| 46 | + for (StackTraceElement ste : stes) { |
| 47 | + System.out.println(" " + ste.toString()); |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + private static void doGetCWE2(HttpServletRequest request, HttpServletResponse response) { |
| 53 | + try { |
| 54 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-2 */ |
| 55 | + /* END-AUTOGENERATED-SERVLET-TESTS-2 */ |
| 56 | + } catch (Throwable t) { |
| 57 | + |
| 58 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 59 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 60 | + */ |
| 61 | + |
| 62 | + System.out.println( |
| 63 | + " Caught thowable from doGetCWE2 "); |
| 64 | + |
| 65 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 66 | + |
| 67 | + System.out.println("Stack trace below"); |
| 68 | + |
| 69 | + StackTraceElement stes[] = t.getStackTrace(); |
| 70 | + |
| 71 | + for (StackTraceElement ste : stes) { |
| 72 | + System.out.println(" " + ste.toString()); |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + private static void doGetCWE3(HttpServletRequest request, HttpServletResponse response) { |
| 78 | + try { |
| 79 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-3 */ |
| 80 | + /* END-AUTOGENERATED-SERVLET-TESTS-3 */ |
| 81 | + } catch (Throwable t) { |
| 82 | + |
| 83 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 84 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 85 | + */ |
| 86 | + |
| 87 | + System.out.println( |
| 88 | + " Caught thowable from doGetCWE3 "); |
| 89 | + |
| 90 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 91 | + |
| 92 | + System.out.println("Stack trace below"); |
| 93 | + |
| 94 | + StackTraceElement stes[] = t.getStackTrace(); |
| 95 | + |
| 96 | + for (StackTraceElement ste : stes) { |
| 97 | + System.out.println(" " + ste.toString()); |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + |
| 102 | + private static void doGetCWE4(HttpServletRequest request, HttpServletResponse response) { |
| 103 | + try { |
| 104 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-4 */ |
| 105 | + /* END-AUTOGENERATED-SERVLET-TESTS-4 */ |
| 106 | + } catch (Throwable t) { |
| 107 | + |
| 108 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 109 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 110 | + */ |
| 111 | + |
| 112 | + System.out.println( |
| 113 | + " Caught thowable from doGetCWE4 "); |
| 114 | + |
| 115 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 116 | + |
| 117 | + System.out.println("Stack trace below"); |
| 118 | + |
| 119 | + StackTraceElement stes[] = t.getStackTrace(); |
| 120 | + |
| 121 | + for (StackTraceElement ste : stes) { |
| 122 | + System.out.println(" " + ste.toString()); |
| 123 | + } |
| 124 | + } |
| 125 | + } |
| 126 | + |
| 127 | + private static void doGetCWE5(HttpServletRequest request, HttpServletResponse response) { |
| 128 | + try { |
| 129 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-5 */ |
| 130 | + /* END-AUTOGENERATED-SERVLET-TESTS-5 */ |
| 131 | + } catch (Throwable t) { |
| 132 | + |
| 133 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 134 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 135 | + */ |
| 136 | + |
| 137 | + System.out.println( |
| 138 | + " Caught thowable from doGetCWE5 "); |
| 139 | + |
| 140 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 141 | + |
| 142 | + System.out.println("Stack trace below"); |
| 143 | + |
| 144 | + StackTraceElement stes[] = t.getStackTrace(); |
| 145 | + |
| 146 | + for (StackTraceElement ste : stes) { |
| 147 | + |
| 148 | + System.out.println(" " + ste.toString()); |
| 149 | + } |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + private static void doGetCWE6(HttpServletRequest request, HttpServletResponse response) { |
| 154 | + try { |
| 155 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-6 */ |
| 156 | + /* END-AUTOGENERATED-SERVLET-TESTS-6 */ |
| 157 | + } catch (Throwable t) { |
| 158 | + |
| 159 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 160 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 161 | + */ |
| 162 | + |
| 163 | + System.out.println( |
| 164 | + " Caught thowable from doGetCWE6 "); |
| 165 | + |
| 166 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 167 | + |
| 168 | + System.out.println("Stack trace below"); |
| 169 | + |
| 170 | + StackTraceElement stes[] = t.getStackTrace(); |
| 171 | + |
| 172 | + for (StackTraceElement ste : stes) { |
| 173 | + System.out.println(" " + ste.toString()); |
| 174 | + } |
| 175 | + } |
| 176 | + } |
| 177 | + |
| 178 | + private static void doGetCWE7(HttpServletRequest request, HttpServletResponse response) { |
| 179 | + try { |
| 180 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-7 */ |
| 181 | + /* END-AUTOGENERATED-SERVLET-TESTS-7 */ |
| 182 | + } catch (Throwable t) { |
| 183 | + |
| 184 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 185 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 186 | + */ |
| 187 | + |
| 188 | + System.out.println( |
| 189 | + " Caught thowable from doGetCWE7 "); |
| 190 | + |
| 191 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 192 | + |
| 193 | + System.out.println("Stack trace below"); |
| 194 | + |
| 195 | + StackTraceElement stes[] = t.getStackTrace(); |
| 196 | + |
| 197 | + for (StackTraceElement ste : stes) { |
| 198 | + System.out.println(" " + ste.toString()); |
| 199 | + } |
| 200 | + } |
| 201 | + } |
| 202 | + |
| 203 | + private static void doGetCWE8(HttpServletRequest request, HttpServletResponse response) { |
| 204 | + try { |
| 205 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-8 */ |
| 206 | + /* END-AUTOGENERATED-SERVLET-TESTS-8 */ |
| 207 | + } catch (Throwable t) { |
| 208 | + |
| 209 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 210 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 211 | + */ |
| 212 | + |
| 213 | + System.out.println( |
| 214 | + " Caught thowable from doGetCWE8 "); |
| 215 | + |
| 216 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 217 | + |
| 218 | + System.out.println("Stack trace below"); |
| 219 | + |
| 220 | + StackTraceElement stes[] = t.getStackTrace(); |
| 221 | + |
| 222 | + for (StackTraceElement ste : stes) { |
| 223 | + System.out.println(" " + ste.toString()); |
| 224 | + } |
| 225 | + } |
| 226 | + } |
| 227 | + |
| 228 | + private static void doGetCWE9(HttpServletRequest request, HttpServletResponse response) { |
| 229 | + try { |
| 230 | + /* BEGIN-AUTOGENERATED-SERVLET-TESTS-9 */ |
| 231 | + /* END-AUTOGENERATED-SERVLET-TESTS-9 */ |
| 232 | + } catch (Throwable t) { |
| 233 | + |
| 234 | + /* this will only happen on an IOException or something (the runTest for the test cases will catch any exceptions from the test cases). So, we just abort |
| 235 | + * and write to the console (since we can't write to the response without possibly throwing another exception) |
| 236 | + */ |
| 237 | + |
| 238 | + System.out.println( |
| 239 | + " Caught thowable from doGetCWE9 "); |
| 240 | + |
| 241 | + System.out.println(" Throwable's message = " + t.getMessage()); |
| 242 | + |
| 243 | + System.out.println("Stack trace below"); |
| 244 | + |
| 245 | + StackTraceElement stes[] = t.getStackTrace(); |
| 246 | + |
| 247 | + for (StackTraceElement ste : stes) { |
| 248 | + System.out.println(" " + ste.toString()); |
| 249 | + } |
| 250 | + } |
| 251 | + } |
| 252 | +} |
0 commit comments