From ed5ec377373fd552744dc348a66c9f610e433283 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 8 Feb 2018 22:46:49 -0800 Subject: [PATCH] Fix warnings --- .../faces/webflow/JsfManagedBeanPropertyAccessor.java | 1 - .../faces/webflow/FlowActionListenerTests.java | 2 +- .../faces/webflow/FlowResponseStateManagerTests.java | 8 ++++++-- .../JsfManagedBeanAwareELExpressionParserTests.java | 1 + .../webflow/JsfManagedBeanPropertyAccessorTests.java | 2 ++ .../faces/webflow/JsfViewFactoryTests.java | 2 +- .../springframework/faces/webflow/MockApplication.java | 2 +- .../faces/webflow/MockJsfExternalContext.java | 1 - 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java index aab6a7e3..6a80af32 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java @@ -20,7 +20,6 @@ import javax.el.ExpressionFactory; import javax.el.ValueExpression; import javax.faces.context.FacesContext; -import org.springframework.expression.AccessException; import org.springframework.expression.EvaluationContext; import org.springframework.expression.PropertyAccessor; import org.springframework.expression.TypedValue; diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java index c6e3d39e..3a2e03b7 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java @@ -83,7 +83,7 @@ public class FlowActionListenerTests extends TestCase { return String.class; } - public Object invoke(FacesContext context, Object... args) throws EvaluationException { + public Object invoke(FacesContext context, Object[] args) throws EvaluationException { return this.result; } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java index b4cb8467..24800726 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java @@ -16,15 +16,18 @@ public class FlowResponseStateManagerTests extends TestCase { private final JSFMockHelper jsfMock = new JSFMockHelper(); + private StaticWebApplicationContext webappContext; + private FlowResponseStateManager responseStateManager; private RequestContext requestContext; private FlowExecutionContext flowExecutionContext; + protected void setUp() throws Exception { this.jsfMock.setUp(); - StaticWebApplicationContext webappContext = new StaticWebApplicationContext(); - webappContext.setServletContext(this.jsfMock.servletContext()); + this.webappContext = new StaticWebApplicationContext(); + this.webappContext.setServletContext(this.jsfMock.servletContext()); this.requestContext = EasyMock.createMock(RequestContext.class); RequestContextHolder.setRequestContext(this.requestContext); @@ -35,6 +38,7 @@ public class FlowResponseStateManagerTests extends TestCase { protected void tearDown() throws Exception { super.tearDown(); + this.webappContext.close(); this.jsfMock.tearDown(); RequestContextHolder.setRequestContext(null); } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanAwareELExpressionParserTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanAwareELExpressionParserTests.java index 38e34330..bf40395a 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanAwareELExpressionParserTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanAwareELExpressionParserTests.java @@ -30,6 +30,7 @@ public class JsfManagedBeanAwareELExpressionParserTests extends TestCase { RequestContextHolder.setRequestContext(null); } + @SuppressWarnings("unchecked") public void testGetJSFBean() { this.jsfMock.externalContext().getRequestMap().put("myJsfBean", new Object()); Expression expr = this.parser.parseExpression("myJsfBean", new FluentParserContext().evaluate(RequestContext.class)); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java index dd98a283..9446f5bc 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java @@ -41,11 +41,13 @@ public class JsfManagedBeanPropertyAccessorTests extends TestCase { RequestContextHolder.setRequestContext(null); } + @SuppressWarnings("unchecked") public void testCanRead() { this.jsfMock.externalContext().getRequestMap().put("myJsfBean", new Object()); assertTrue(this.accessor.canRead(null, null, "myJsfBean")); } + @SuppressWarnings("unchecked") public void testRead() { Object jsfBean = new Object(); this.jsfMock.externalContext().getRequestMap().put("myJsfBean", jsfBean); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java index 8c6005cb..210d66f8 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java @@ -159,7 +159,7 @@ public class JsfViewFactoryTests extends TestCase { /** * View already exists in view/flash scope and must be restored and the lifecycle executed, no flow event signaled */ - @SuppressWarnings("deprecation") + @SuppressWarnings({ "deprecation", "unchecked" }) public final void testGetView_RestoreWithBindings() { this.lifecycle = new NoExecutionLifecycle(this.jsfMock.lifecycle()); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java index 5d158c1d..73c3f35c 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java @@ -141,7 +141,7 @@ public class MockApplication extends Application { return null; } - public MethodBinding createMethodBinding(String ref, Class... params) throws ReferenceSyntaxException { + public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException { return null; } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java index 0a9efeae..993eba70 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java @@ -18,7 +18,6 @@ package org.springframework.faces.webflow; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; import java.net.URL; import java.security.Principal; import java.util.Collections;