MCPcopy Create free account
hub / github.com/castello/spring_basic / main8

Method main8

ch2/RequestParamTest.java:75–81  ·  view source on GitHub ↗
(@RequestParam(required=false) int year)

Source from the content-addressed store, hash-verified

73 }
74
75 @RequestMapping("/requestParam8")
76 public String main8(@RequestParam(required=false) int year) {
77 // http://localhost/ch2/requestParam8 ---->> 500 java.lang.IllegalStateException: Optional int parameter 'year' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
78 // http://localhost/ch2/requestParam8?year ---->> 400 Bad Request, nested exception is java.lang.NumberFormatException: For input string: ""
79 System.out.printf("[%s]year=[%s]%n", new Date(), year);
80 return "yoil";
81 }
82
83 @RequestMapping("/requestParam9")
84 public String main9(@RequestParam(required=true) int year) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected