Merge remote-tracking branch 'upstream/next' into next
This commit is contained in:
		| @ -30,6 +30,8 @@ import org.owasp.webgoat.session.Screen; | ||||
| import org.owasp.webgoat.session.WebSession; | ||||
| import org.owasp.webgoat.session.WebgoatContext; | ||||
| import org.owasp.webgoat.session.WebgoatProperties; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| /** | ||||
|  * ************************************************************************************************* | ||||
| @ -66,6 +68,8 @@ import org.owasp.webgoat.session.WebgoatProperties; | ||||
|  */ | ||||
| public abstract class AbstractLesson extends Screen implements Comparable<Object> { | ||||
|  | ||||
|     final Logger logger = LoggerFactory.getLogger(AbstractLesson.class); | ||||
|  | ||||
|     /** | ||||
|      * Description of the Field | ||||
|      */ | ||||
| @ -496,9 +500,8 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object | ||||
|         String src; | ||||
|  | ||||
|         try { | ||||
|             // System.out.println("Loading source file: " + | ||||
|             // getSourceFileName()); | ||||
|             src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getSourceFileName()))), true); | ||||
|             logger.debug("Loading source file: " + getSourceFileName()); | ||||
|             src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getSourceFileName()))), false); | ||||
|  | ||||
|         } catch (FileNotFoundException e) { | ||||
|             s.setMessage("Could not find source file"); | ||||
| @ -782,8 +785,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object | ||||
|     } | ||||
|  | ||||
|     public void setSourceFileName(String sourceFileName) { | ||||
|         // System.out.println("Setting source file of lesson " + this + " to: " | ||||
|         // + sourceFileName); | ||||
|         logger.debug("Setting source file of lesson " + this + " to: " + sourceFileName); | ||||
|         this.sourceFileName = sourceFileName; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -346,32 +346,35 @@ public class Course { | ||||
|      */ | ||||
|     private void loadResources() { | ||||
|         for (AbstractLesson lesson : lessons) { | ||||
|             logger.info("Loading resources for lesson -> " + lesson.getName()); | ||||
|             String className = lesson.getClass().getName(); | ||||
|             String classFile = getSourceFile(className); | ||||
|             logger.info("Lesson classname: " + className); | ||||
|             logger.info("Lesson java file: " + classFile); | ||||
|  | ||||
|             for (String absoluteFile : files) { | ||||
|                 String fileName = getFileName(absoluteFile); | ||||
|                 logger.debug("Course: looking at file: " + absoluteFile); | ||||
|                 //logger.debug("Course: looking at file: " + absoluteFile); | ||||
|  | ||||
|                 if (absoluteFile.endsWith(classFile)) { | ||||
|                     // System.out.println("Set source file for " + classFile); | ||||
|                     logger.info("Set source file for " + classFile); | ||||
|                     lesson.setSourceFileName(absoluteFile); | ||||
|                 } | ||||
|  | ||||
|                 if (absoluteFile.startsWith("/lesson_plans") && absoluteFile.endsWith(".html") | ||||
|                         && className.endsWith(fileName)) { | ||||
|                     logger.debug("DEBUG: setting lesson plan file " + absoluteFile + " for lesson " | ||||
|                     logger.info("setting lesson plan file " + absoluteFile + " for lesson " | ||||
|                             + lesson.getClass().getName()); | ||||
|                     logger.debug("fileName: " + fileName + " == className: " + className); | ||||
|                     logger.info("fileName: " + fileName + " == className: " + className); | ||||
|                     String language = getLanguageFromFileName("/lesson_plans", absoluteFile); | ||||
|                     lesson.setLessonPlanFileName(language, absoluteFile); | ||||
|                     WebGoatI18N.loadLanguage(language); | ||||
|                 } | ||||
|                 if (absoluteFile.startsWith("/lesson_solutions") && absoluteFile.endsWith(".html") | ||||
|                         && className.endsWith(fileName)) { | ||||
|                     logger.debug("DEBUG: setting lesson solution file " + absoluteFile + " for lesson " | ||||
|                     logger.info("setting lesson solution file " + absoluteFile + " for lesson " | ||||
|                             + lesson.getClass().getName()); | ||||
|                     logger.debug("fileName: " + fileName + " == className: " + className); | ||||
|                     logger.info("fileName: " + fileName + " == className: " + className); | ||||
|                     lesson.setLessonSolutionFileName(absoluteFile); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @ -219,7 +219,7 @@ public class WebSession { | ||||
|     /** | ||||
|      * Constructor for the WebSession object | ||||
|      * | ||||
|      * @param servlet Description of the Parameter | ||||
|      * @param webgoatContext | ||||
|      * @param context Description of the Parameter | ||||
|      */ | ||||
|     public WebSession(WebgoatContext webgoatContext, ServletContext context) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user