Skip to content

Commit

Permalink
SWS-918 Fix compiler warnings
Browse files Browse the repository at this point in the history
The project contains various easy to fix compiler warnings like unused
imports, raw types and no longer needed @SuppressWarnings("unchecked").

This change removes:

 * unused imports
 * raw types
 * no longer needed @SuppressWarnings("unchecked")

Issue: SWS-918
https://jira.spring.io/browse/SWS-918
  • Loading branch information
marschall committed Oct 3, 2015
1 parent d212507 commit de1e640
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 26 deletions.
Expand Up @@ -45,7 +45,7 @@ protected boolean supportsRequestPayloadParameter(MethodParameter parameter) {
public JAXBElement<?> resolveArgument(MessageContext messageContext, MethodParameter parameter)
throws JAXBException {
ParameterizedType parameterizedType = (ParameterizedType) parameter.getGenericParameterType();
Class<?> clazz = (Class) parameterizedType.getActualTypeArguments()[0];
Class<?> clazz = (Class<?>) parameterizedType.getActualTypeArguments()[0];
return unmarshalElementFromRequestPayload(messageContext, clazz);
}

Expand Down
Expand Up @@ -105,13 +105,11 @@ public URI getUri() throws URISyntaxException {
*/

@Override
@SuppressWarnings("unchecked")
public Iterator<String> getRequestHeaderNames() throws IOException {
return new EnumerationIterator<String>(getHttpServletRequest().getHeaderNames());
}

@Override
@SuppressWarnings("unchecked")
public Iterator<String> getRequestHeaders(String name) throws IOException {
return new EnumerationIterator<String>(getHttpServletRequest().getHeaders(name));
}
Expand Down
Expand Up @@ -32,7 +32,7 @@ public void marshal(Object graph, Result result) throws XmlMappingException, IOE
}

@Override
public boolean supports(Class clazz) {
public boolean supports(Class<?> clazz) {
throw new UnsupportedOperationException();
}

Expand Down
Expand Up @@ -233,7 +233,7 @@ public void testTransformDom() throws Exception {

private int getNamespaceCount(OMElement element) {
int i = 0;
Iterator namespaces = element.getAllDeclaredNamespaces();
Iterator<?> namespaces = element.getAllDeclaredNamespaces();
while (namespaces.hasNext()) {
namespaces.next();
i++;
Expand Down
Expand Up @@ -127,7 +127,7 @@ public void resolveSoapHeaderMismatch() throws Exception {
public void resolveSoapHeaderMismatchList() throws Exception {
Object result = resolver.resolveArgument(messageContext, soapHeaderMismatchList);
assertTrue("result must be a List", List.class.isAssignableFrom(result.getClass()));
assertTrue("result List must be empty", ((List) result).isEmpty());
assertTrue("result List must be empty", ((List<?>) result).isEmpty());
}

public void soapHeaderWithEmptyValue(@SoapHeader("") SoapHeaderElement element) {
Expand Down
Expand Up @@ -20,9 +20,6 @@
import java.io.ByteArrayOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;

Expand All @@ -33,7 +30,6 @@
import org.springframework.ws.soap.AbstractSoapMessageTestCase;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.transport.MockTransportOutputStream;
import org.springframework.ws.transport.TransportConstants;
import org.springframework.xml.transform.StringSource;
Expand Down
Expand Up @@ -38,7 +38,6 @@ public abstract class SpringSecurityUtils {
* @throws DisabledException if the account is disabled
* @throws LockedException if the account is locked
*/
@SuppressWarnings("deprecation")
public static void checkUserValidity(UserDetails user)
throws AccountExpiredException, CredentialsExpiredException, DisabledException, LockedException {
if (!user.isAccountNonLocked()) {
Expand Down
Expand Up @@ -597,7 +597,6 @@ protected RequestData initializeRequestData(MessageContext messageContext) {
}

@Override
@SuppressWarnings("unchecked")
protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext)
throws WsSecurityValidationException {
if (logger.isDebugEnabled()) {
Expand Down
Expand Up @@ -17,10 +17,8 @@
package org.springframework.ws.soap.security.support;

import javax.net.ssl.KeyManager;
import javax.net.ssl.TrustManager;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

Expand Down
Expand Up @@ -19,7 +19,6 @@
import javax.net.ssl.TrustManager;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

Expand Down
Expand Up @@ -18,6 +18,8 @@

import java.security.Principal;
import java.util.Iterator;
import java.util.Map;

import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
Expand Down Expand Up @@ -48,8 +50,8 @@ public boolean commit() {
@Override
public void initialize(Subject subject,
CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map options) {
Map<String,?> sharedState,
Map<String,?> options) {
this.subject = subject;
}

Expand All @@ -73,8 +75,8 @@ public boolean logout() {
}

private String getName(Subject subject) {
for (Iterator iterator = subject.getPrincipals().iterator(); iterator.hasNext();) {
Principal principal = (Principal) iterator.next();
for (Iterator<Principal> iterator = subject.getPrincipals().iterator(); iterator.hasNext();) {
Principal principal = iterator.next();
if (principal instanceof X500Principal) {
return principal.getName();
}
Expand Down
Expand Up @@ -20,6 +20,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
Expand Down Expand Up @@ -69,8 +71,8 @@ public boolean commit() throws LoginException {
@Override
public void initialize(Subject subject,
CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map options) {
Map<String,?> sharedState,
Map<String,?> options) {
this.subject = subject;
this.callbackHandler = callbackHandler;
}
Expand Down Expand Up @@ -126,9 +128,9 @@ private boolean validate(String username, String password) {
public boolean logout() {
principals.clear();

Iterator iterator = subject.getPrincipals(SimplePrincipal.class).iterator();
Iterator<SimplePrincipal> iterator = subject.getPrincipals(SimplePrincipal.class).iterator();
while (iterator.hasNext()) {
SimplePrincipal principal = (SimplePrincipal) iterator.next();
SimplePrincipal principal = iterator.next();
subject.getPrincipals().remove(principal);
}

Expand Down
Expand Up @@ -70,7 +70,6 @@ public void andRespond(ResponseCreator responseCreator) {
// FaultAwareWebServiceConnection implementation

@Override
@SuppressWarnings("unchecked")
public void send(WebServiceMessage message) throws IOException {
if (!requestMatchers.isEmpty()) {
for (RequestMatcher requestMatcher : requestMatchers) {
Expand All @@ -84,7 +83,6 @@ public void send(WebServiceMessage message) throws IOException {
}

@Override
@SuppressWarnings("unchecked")
public WebServiceMessage receive(WebServiceMessageFactory messageFactory) throws IOException {
if (responseCreator != null) {
return responseCreator.createResponse(uri, request, messageFactory);
Expand Down
Expand Up @@ -18,7 +18,6 @@

import java.io.IOException;

import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.ws.WebServiceMessage;
Expand Down

0 comments on commit de1e640

Please sign in to comment.