package de.digitalcollections.blueprints.webapp.springboot.controller;

import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class MainController {

  private static final Logger LOGGER = LoggerFactory.getLogger(MainController.class);

  @GetMapping(value = {"", "/"})
  public String printWelcome(Model model) {
    LOGGER.info("Homepage requested");
    model.addAttribute("time", new Date());
    return "main";
  }
}

@@ -422,16 +422,185 @@
 lass);%0A%0A
+  private static int getLength(int i) %7B%0A    String s = null;%0A%0A    if (i == 1) %7B%0A      s = %221%22;%0A    %7D else if (i == 2) %7B%0A      s = %222%22;%0A    %7D%0A    return s.length();%0A  %7D%0A%0A
   @GetMa
@@ -751,16 +751,59 @@
 ate());%0A
+    model.addAttribute(%22s%22, getLength(5));%0A
     retu

add small example of null pointer dereference 😲