Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Oct 31, 2019
1 parent 0b97576 commit ef48899
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
@Controller
public class ThreadUnsafeController extends AbstractController {

private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
static {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");

public ThreadUnsafeController() {
sdf.setLenient(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -25,7 +22,7 @@
public class WeakReferenceController extends AbstractController {

@RequestMapping(value = "/weakreference", method = RequestMethod.GET)
public ModelAndView doGet(ModelAndView mav, @ModelAttribute("logLevel") String logLevel, HttpServletRequest req, HttpServletResponse res, Locale locale) {
public ModelAndView doGet(ModelAndView mav, @ModelAttribute("logLevel") String logLevel, Locale locale) {

setViewAndCommonObjects(mav, locale, "weakreference");

Expand All @@ -43,7 +40,7 @@ public ModelAndView doGet(ModelAndView mav, @ModelAttribute("logLevel") String l

@RequestMapping(value = "/weakreference", method = RequestMethod.POST)
public String process(@RequestParam(value = "logLevel", required = false) String logLevel,
RedirectAttributes redirectAttributes, HttpServletRequest req, HttpServletResponse res, Locale locale) throws IOException {
RedirectAttributes redirectAttributes) throws IOException {

Logger logger = Logger.getLogger(this.getClass().getCanonicalName());
logger.setLevel(Level.parse(logLevel));
Expand All @@ -53,6 +50,5 @@ public String process(@RequestParam(value = "logLevel", required = false) String
handler.setFormatter(formatter);
redirectAttributes.addFlashAttribute("logLevel", logLevel);
return "redirect:/weakreference";

}
}

0 comments on commit ef48899

Please sign in to comment.