Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

small code tidyups incl. typos, and code standard improvements #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.web.context.request.WebRequest;

public class AjaxUtils {
public final class AjaxUtils {

public static boolean isAjaxRequest(WebRequest webRequest) {
String requestedWith = webRequest.getHeader("X-Requested-With");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void setNested(NestedBean nested) {
this.nested = nested;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("JavaBean");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void setMap(Map<String, NestedBean> map) {
this.map = map;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("NestedBean");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
@SuppressWarnings("serial")
public class BusinessException extends Exception {

public BusinessException(String message) {
super(message);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ExceptionController {

@RequestMapping("/global-exception")
public @ResponseBody String businessException() throws BusinessException {
throw new BusinessException();
throw new BusinessException("Business Exception occurred");
}

@ExceptionHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void setAdditionalInfo(Map<String, String> additionalInfo) {
this.additionalInfo = additionalInfo;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("properties name=");
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/views/home.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<a id="byProducesAcceptJson" class="writeJsonLink" href="<c:url value="/mapping/produces" />">By produces via Accept=application/json</a>
</li>
<li>
<a id="byProducesAcceptXml" class="writeXmlLink" href="<c:url value="/mapping/produces" />">By produces via Accept=appilcation/xml</a>
<a id="byProducesAcceptXml" class="writeXmlLink" href="<c:url value="/mapping/produces" />">By produces via Accept=application/xml</a>
</li>
<li>
<a id="byProducesJsonExt" class="writeJsonLink" href="<c:url value="/mapping/produces.json" />">By produces via ".json"</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import org.junit.Before;
import org.junit.Test;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

Expand Down Expand Up @@ -52,7 +51,7 @@ public void submitSuccess() throws Exception {
.param("_additionalInfo[java]", "on")
.param("subscribeNewsletter", "false"))
.andDo(print())
.andExpect(status().isMovedTemporarily())
.andExpect(status().is3xxRedirection())
.andExpect(redirectedUrl("/form"))
.andExpect(flash().attribute("message",
"Form submitted successfully. Bound properties name='Joe', age=56, " +
Expand Down Expand Up @@ -100,8 +99,7 @@ public void submitError() throws Exception {
.andExpect(model().attributeHasFieldErrors("formBean", "name", "age"));
}

private String getTimezone(int year, int month, int day)
{
private String getTimezone(int year, int month, int day) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
Expand Down