diff --git a/build.gradle b/build.gradle index 1b9f60da187..4e424f249a3 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ configure(allprojects) { project -> ext.hibernate3Version = "3.6.10.Final" ext.hibernate4Version = "4.3.8.Final" ext.hibval4Version = "4.3.2.Final" - ext.hibval5Version = "5.2.0.Beta1" + ext.hibval5Version = "5.2.0.Beta1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA ext.hsqldbVersion = "2.3.2" ext.httpclientVersion = "4.4" ext.httpasyncVersion = "4.0.2" @@ -93,13 +93,13 @@ configure(allprojects) { project -> "-Xlint:-unchecked", "-Xlint:-options"] compileJava { - sourceCompatibility=1.6 - targetCompatibility=1.6 + sourceCompatibility = 1.6 + targetCompatibility = 1.6 } compileTestJava { - sourceCompatibility=1.8 - targetCompatibility=1.8 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 options.compilerArgs += "-parameters" } @@ -395,8 +395,8 @@ project("spring-beans-groovy") { } compileGroovy { - sourceCompatibility=1.6 - targetCompatibility=1.6 + sourceCompatibility = 1.6 + targetCompatibility = 1.6 } } @@ -541,8 +541,8 @@ project("spring-oxm") { compileTestJava { // necessary to avoid java.lang.VerifyError on jibx compilation // see http://jira.codehaus.org/browse/JIBX-465 - sourceCompatibility=1.6 - targetCompatibility=1.6 + sourceCompatibility = 1.6 + targetCompatibility = 1.6 } if (System.getProperty("java.version").contains("1.9.")) { @@ -1031,7 +1031,7 @@ project("spring-aspects") { dependencies { aspects(project(":spring-orm")) ajc("org.aspectj:aspectjtools:1.9.0.BETA-1") // for the ability to build on JDK 9, not exposed in the POMs yet - rt("org.aspectj:aspectjrt:${aspectjVersion}") + rt("org.aspectj:aspectjrt:${aspectjVersion}") // regular AspectJ version here, to be exposed in the POMs compile("org.aspectj:aspectjweaver:${aspectjVersion}") provided("org.eclipse.persistence:javax.persistence:2.0.0") optional(project(":spring-aop")) // for @Async support diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 528f83328b6..31ac98086e6 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,7 +232,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator * having a chance to resolve an argument value before the standard * argument handling kicks in. */ - public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) { + public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) { this.customArgumentResolvers = argumentResolvers; } @@ -250,7 +250,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator * Any such custom ModelAndViewResolver will kick in first, having a chance to * resolve an return value before the standard ModelAndView handling kicks in. */ - public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) { + public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) { this.customModelAndViewResolvers = customModelAndViewResolvers; } @@ -381,7 +381,8 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator if (response instanceof EventResponse) { // Update the existing model, if any, when responding to an event - // whereas we're replacing the model in case of an action response. - Map existingModel = (Map) request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE); + Map existingModel = (Map) + request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE); if (existingModel != null) { existingModel.putAll(implicitModel); modelToStore = existingModel; @@ -812,9 +813,9 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator } } } - return PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) && + return (PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) && PortletAnnotationMappingUtils.checkParameters(this.params, request) && - PortletAnnotationMappingUtils.checkHeaders(this.headers, request); + PortletAnnotationMappingUtils.checkHeaders(this.headers, request)); } public boolean isBetterMatchThan(RequestMappingInfo other) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index a4c20452c12..3dd4726785b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -334,7 +334,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator *

Any such custom WebArgumentResolver will kick in first, having a chance to resolve * an argument value before the standard argument handling kicks in. */ - public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) { + public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) { this.customArgumentResolvers = argumentResolvers; } @@ -352,7 +352,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator *

Any such custom ModelAndViewResolver will kick in first, having a chance to resolve * a return value before the standard ModelAndView handling kicks in. */ - public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) { + public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) { this.customModelAndViewResolvers = customModelAndViewResolvers; } @@ -929,7 +929,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator // to be picked up by the RedirectView webRequest.getRequest().setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, responseStatus); - responseArgumentUsed = true; + this.responseArgumentUsed = true; } // Invoke custom resolvers if present... @@ -992,8 +992,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator } } - private void handleResponseBody(Object returnValue, ServletWebRequest webRequest) - throws Exception { + private void handleResponseBody(Object returnValue, ServletWebRequest webRequest) throws Exception { if (returnValue == null) { return; } @@ -1002,8 +1001,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator writeWithMessageConverters(returnValue, inputMessage, outputMessage); } - private void handleHttpEntityResponse(HttpEntity responseEntity, ServletWebRequest webRequest) - throws Exception { + private void handleHttpEntityResponse(HttpEntity responseEntity, ServletWebRequest webRequest) throws Exception { if (responseEntity == null) { return; } @@ -1030,6 +1028,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator private void writeWithMessageConverters(Object returnValue, HttpInputMessage inputMessage, HttpOutputMessage outputMessage) throws IOException, HttpMediaTypeNotAcceptableException { + List acceptedMediaTypes = inputMessage.getHeaders().getAccept(); if (acceptedMediaTypes.isEmpty()) { acceptedMediaTypes = Collections.singletonList(MediaType.ALL); @@ -1061,7 +1060,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator } throw new HttpMediaTypeNotAcceptableException(allSupportedMediaTypes); } - } @@ -1079,30 +1077,30 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator private final String[] headers; RequestMappingInfo(String[] patterns, RequestMethod[] methods, String[] params, String[] headers) { - this.patterns = patterns != null ? patterns : new String[0]; - this.methods = methods != null ? methods : new RequestMethod[0]; - this.params = params != null ? params : new String[0]; - this.headers = headers != null ? headers : new String[0]; + this.patterns = (patterns != null ? patterns : new String[0]); + this.methods = (methods != null ? methods : new RequestMethod[0]); + this.params = (params != null ? params : new String[0]); + this.headers = (headers != null ? headers : new String[0]); } public boolean hasPatterns() { - return patterns.length > 0; + return (this.patterns.length > 0); } public String[] getPatterns() { - return patterns; + return this.patterns; } public int getMethodCount() { - return methods.length; + return this.methods.length; } public int getParamCount() { - return params.length; + return this.params.length; } public int getHeaderCount() { - return headers.length; + return this.headers.length; } public boolean matches(HttpServletRequest request) { @@ -1122,8 +1120,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator } public Set methodNames() { - Set methodNames = new LinkedHashSet(methods.length); - for (RequestMethod method : methods) { + Set methodNames = new LinkedHashSet(this.methods.length); + for (RequestMethod method : this.methods) { methodNames.add(method.name()); } return methodNames; @@ -1145,18 +1143,18 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append(Arrays.asList(patterns)); - if (methods.length > 0) { + builder.append(Arrays.asList(this.patterns)); + if (this.methods.length > 0) { builder.append(','); - builder.append(Arrays.asList(methods)); + builder.append(Arrays.asList(this.methods)); } - if (headers.length > 0) { + if (this.headers.length > 0) { builder.append(','); - builder.append(Arrays.asList(headers)); + builder.append(Arrays.asList(this.headers)); } - if (params.length > 0) { + if (this.params.length > 0) { builder.append(','); - builder.append(Arrays.asList(params)); + builder.append(Arrays.asList(this.params)); } return builder.toString(); }