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

Method validateLanguage

src/main/java/utils/Validate.java:358–378  ·  view source on GitHub ↗

Function that will check if a valid language is set. if not, returns en (English) @param lang Session Language Parameter @return en by default, or the valid setting found in the submitted lang

(HttpSession ses)

Source from the content-addressed store, hash-verified

356 * @return en by default, or the valid setting found in the submitted lang
357 */
358 public static String validateLanguage(HttpSession ses)
359 {
360 String result = "en_GB";
361 String lang = new String();
362 try
363 {
364 lang = ses.getAttribute("lang").toString();
365 //log.debug("lang submitted: " + lang);
366 if(lang != null)
367 {
368 if (!lang.isEmpty())
369 result = lang;
370 }
371 //log.debug("lang set to: " + result);
372 }
373 catch(Exception e)
374 {
375 log.error("Could not Retrieve User Lang Setting");
376 }
377 return result;
378 }
379
380 /**
381 * Validates objects received through a function request. Also ensures max length is not too high.

Callers 15

doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doGetMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doGetMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95
doPostMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected