MCPcopy Index your code
hub / github.com/OWASP/SecurityShepherd / getModuleSolution

Method getModuleSolution

src/main/java/dbProcs/Getter.java:1373–1400  ·  view source on GitHub ↗

Used to return a module cheat sheet @param ApplicationRoot The current running context of the application @param moduleId The identifier of the module to return the cheat sheet for @param lang The Locale the user has enabled @return String[] containing {ModuleName, CheatSheetSolution}

(String ApplicationRoot, String moduleId, Locale lang)

Source from the content-addressed store, hash-verified

1371 * @return String[] containing {ModuleName, CheatSheetSolution}
1372 */
1373 public static String[] getModuleSolution (String ApplicationRoot, String moduleId, Locale lang)
1374 {
1375 log.debug("*** Getter.getModuleSolution ***");
1376 String[] result = new String[2];
1377 Connection conn = Database.getCoreConnection(ApplicationRoot);
1378 //Getting Translations
1379 ResourceBundle bundle = ResourceBundle.getBundle("i18n.cheatsheets.solutions", lang);
1380 try
1381 {
1382 CallableStatement callstmt = conn.prepareCall("call cheatSheetGetSolution(?)");
1383 log.debug("Gathering cheatSheetGetSolution ResultSet");
1384 callstmt.setString(1, moduleId);
1385 ResultSet resultSet = callstmt.executeQuery();
1386 log.debug("Opening Result Set from cheatSheetGetSolution");
1387 resultSet.next();
1388 result[0] = resultSet.getString(1);
1389 result[1] = bundle.getString(resultSet.getString(2));
1390
1391 }
1392 catch (SQLException e)
1393 {
1394 log.error("Could not execute query: " + e.toString());
1395 result = null;
1396 }
1397 Database.closeConnection(conn);
1398 log.debug("*** END getModuleSolution ***");
1399 return result;
1400 }
1401
1402 /**
1403 * This method returns modules in option tags in different <select> elements depending on their current open/closed status.

Callers 2

testGetModuleSolutionMethod · 0.95
doPostMethod · 0.95

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95

Tested by 1

testGetModuleSolutionMethod · 0.76