Skip to content

Commit 9dcd03d

Browse files
committed
Clean up imports and warnings
1 parent 5ff1c69 commit 9dcd03d

File tree

11 files changed

+47
-83
lines changed

11 files changed

+47
-83
lines changed

spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import java.util.LinkedHashMap;
2828
import java.util.List;
2929
import java.util.Map;
30+
3031
import javax.xml.stream.*;
31-
import javax.xml.transform.stax.StAXSource;
3232
import javax.xml.transform.stream.StreamSource;
3333

3434
import com.thoughtworks.xstream.MarshallingStrategy;
@@ -59,9 +59,11 @@
5959
import com.thoughtworks.xstream.mapper.CannotResolveClassException;
6060
import com.thoughtworks.xstream.mapper.Mapper;
6161
import com.thoughtworks.xstream.mapper.MapperWrapper;
62+
6263
import org.w3c.dom.Document;
6364
import org.w3c.dom.Element;
6465
import org.w3c.dom.Node;
66+
6567
import org.xml.sax.ContentHandler;
6668
import org.xml.sax.InputSource;
6769
import org.xml.sax.XMLReader;

spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,34 +16,21 @@
1616

1717
package org.springframework.oxm.jibx;
1818

19-
import java.io.IOException;
2019
import java.io.StringWriter;
21-
import java.util.concurrent.atomic.AtomicReference;
22-
import javax.xml.transform.sax.SAXSource;
2320
import javax.xml.transform.stream.StreamResult;
24-
import javax.xml.transform.stream.StreamSource;
2521

2622
import org.custommonkey.xmlunit.XMLUnit;
2723
import org.junit.BeforeClass;
2824
import org.junit.Test;
2925

30-
import org.mockito.ArgumentCaptor;
3126
import org.springframework.oxm.AbstractMarshallerTests;
3227
import org.springframework.oxm.Marshaller;
33-
import org.springframework.oxm.XmlMappingException;
34-
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
3528
import org.springframework.tests.Assume;
3629
import org.springframework.tests.TestGroup;
37-
import org.xml.sax.InputSource;
38-
import org.xml.sax.XMLReader;
3930

4031
import static org.custommonkey.xmlunit.XMLAssert.*;
41-
import static org.junit.Assert.assertEquals;
4232
import static org.junit.Assert.assertFalse;
4333
import static org.junit.Assert.assertTrue;
44-
import static org.mockito.Mockito.mock;
45-
import static org.mockito.Mockito.reset;
46-
import static org.mockito.Mockito.verify;
4734

4835
/**
4936
* @author Arjen Poutsma
@@ -114,7 +101,7 @@ public void dtd() throws Exception {
114101
}
115102

116103
@Test
117-
public void testSupports() throws Exception {
104+
public void supports() throws Exception {
118105
assertTrue("JibxMarshaller does not support Flights", marshaller.supports(Flights.class));
119106
assertTrue("JibxMarshaller does not support FlightType", marshaller.supports(FlightType.class));
120107
assertFalse("JibxMarshaller supports illegal type", marshaller.supports(getClass()));

spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import javax.servlet.http.HttpSession;
2626

2727
import org.springframework.http.HttpMethod;
28-
import org.springframework.http.HttpStatus;
2928
import org.springframework.util.CollectionUtils;
3029
import org.springframework.util.ObjectUtils;
3130
import org.springframework.util.StringUtils;

spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
import java.util.HashMap;
2424
import java.util.Map;
2525

26+
import org.junit.Before;
27+
import org.junit.Test;
28+
29+
import org.springframework.beans.FatalBeanException;
30+
2631
import com.fasterxml.jackson.annotation.JsonInclude;
2732
import com.fasterxml.jackson.core.JsonGenerator;
2833
import com.fasterxml.jackson.core.JsonParser;
@@ -45,17 +50,8 @@
4550
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
4651
import com.fasterxml.jackson.databind.ser.std.NumberSerializers.NumberSerializer;
4752
import com.fasterxml.jackson.databind.type.SimpleType;
48-
import org.junit.Before;
49-
import org.junit.Test;
50-
51-
import org.springframework.beans.FatalBeanException;
5253

53-
import static junit.framework.Assert.assertTrue;
54-
import static org.junit.Assert.assertEquals;
55-
import static org.junit.Assert.assertFalse;
56-
import static org.junit.Assert.assertNotNull;
57-
import static org.junit.Assert.assertNull;
58-
import static org.junit.Assert.assertSame;
54+
import static org.junit.Assert.*;
5955

6056
/**
6157
* Test cases for {@link Jackson2ObjectMapperFactoryBean} class.

spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@
3636
import org.springframework.core.io.ClassPathResource;
3737
import org.springframework.core.io.Resource;
3838
import org.springframework.http.MockHttpInputMessage;
39-
import org.springframework.http.converter.HttpMessageConverter;
4039

4140
/**
4241
* Test fixture for {@link Jaxb2CollectionHttpMessageConverter}.

spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,16 +18,13 @@
1818

1919
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
2020
import static org.junit.Assert.*;
21-
import static org.junit.Assert.assertNotEquals;
2221

2322
import java.io.IOException;
24-
import java.io.InputStream;
2523
import java.io.InputStreamReader;
2624
import java.io.StringReader;
2725
import java.nio.charset.Charset;
2826

2927
import javax.xml.parsers.DocumentBuilderFactory;
30-
import javax.xml.stream.XMLStreamException;
3128
import javax.xml.stream.XMLStreamReader;
3229
import javax.xml.transform.Source;
3330
import javax.xml.transform.dom.DOMSource;
@@ -44,8 +41,10 @@
4441
import org.springframework.http.MockHttpInputMessage;
4542
import org.springframework.http.MockHttpOutputMessage;
4643
import org.springframework.util.FileCopyUtils;
44+
4745
import org.w3c.dom.Document;
4846
import org.w3c.dom.Element;
47+
4948
import org.xml.sax.InputSource;
5049
import org.xml.sax.SAXException;
5150
import org.xml.sax.XMLReader;
@@ -162,7 +161,6 @@ public void readStAXSourceExternal() throws Exception {
162161
streamReader.close();
163162
}
164163

165-
166164
@Test
167165
public void readStreamSource() throws Exception {
168166
MockHttpInputMessage inputMessage = new MockHttpInputMessage(BODY.getBytes("UTF-8"));

spring-web/src/test/java/org/springframework/web/client/AbstractJettyServerTestCase.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.util.Collections;
2121
import java.util.List;
22+
2223
import javax.servlet.GenericServlet;
2324
import javax.servlet.ServletException;
2425
import javax.servlet.ServletRequest;
@@ -32,18 +33,23 @@
3233
import org.apache.commons.fileupload.FileUploadException;
3334
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
3435
import org.apache.commons.fileupload.servlet.ServletFileUpload;
36+
3537
import org.eclipse.jetty.server.Server;
3638
import org.eclipse.jetty.servlet.ServletContextHandler;
3739
import org.eclipse.jetty.servlet.ServletHolder;
40+
3841
import org.junit.AfterClass;
39-
import static org.junit.Assert.*;
4042
import org.junit.BeforeClass;
4143

4244
import org.springframework.http.MediaType;
4345
import org.springframework.util.FileCopyUtils;
4446
import org.springframework.util.SocketUtils;
4547

46-
/** @author Arjen Poutsma */
48+
import static org.junit.Assert.*;
49+
50+
/**
51+
* @author Arjen Poutsma
52+
*/
4753
public class AbstractJettyServerTestCase {
4854

4955
protected static String helloWorld = "H\u00e9llo W\u00f6rld";
@@ -184,15 +190,8 @@ private static class PutServlet extends HttpServlet {
184190

185191
private final String s;
186192

187-
188-
private final byte[] buf;
189-
190-
private final MediaType contentType;
191-
192193
private PutServlet(String s, byte[] buf, MediaType contentType) {
193194
this.s = s;
194-
this.buf = buf;
195-
this.contentType = contentType;
196195
}
197196

198197
@Override
@@ -226,24 +225,24 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
226225
FileItemFactory factory = new DiskFileItemFactory();
227226
ServletFileUpload upload = new ServletFileUpload(factory);
228227
try {
229-
List items = upload.parseRequest(req);
228+
List<FileItem> items = upload.parseRequest(req);
230229
assertEquals(4, items.size());
231-
FileItem item = (FileItem) items.get(0);
230+
FileItem item = items.get(0);
232231
assertTrue(item.isFormField());
233232
assertEquals("name 1", item.getFieldName());
234233
assertEquals("value 1", item.getString());
235234

236-
item = (FileItem) items.get(1);
235+
item = items.get(1);
237236
assertTrue(item.isFormField());
238237
assertEquals("name 2", item.getFieldName());
239238
assertEquals("value 2+1", item.getString());
240239

241-
item = (FileItem) items.get(2);
240+
item = items.get(2);
242241
assertTrue(item.isFormField());
243242
assertEquals("name 2", item.getFieldName());
244243
assertEquals("value 2+2", item.getString());
245244

246-
item = (FileItem) items.get(3);
245+
item = items.get(3);
247246
assertFalse(item.isFormField());
248247
assertEquals("logo", item.getFieldName());
249248
assertEquals("logo.jpg", item.getName());

spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,9 @@
4343
import org.springframework.util.concurrent.ListenableFuture;
4444
import org.springframework.util.concurrent.ListenableFutureCallback;
4545

46-
/** @author Arjen Poutsma */
46+
/**
47+
* @author Arjen Poutsma
48+
*/
4749
public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCase {
4850

4951
private AsyncRestTemplate template;
@@ -398,7 +400,7 @@ public void onFailure(Throwable t) {
398400
}
399401

400402
@Test
401-
@SuppressWarnings("unchecked")
403+
@SuppressWarnings({ "unchecked", "rawtypes" })
402404
public void exchangeGet() throws Exception {
403405
HttpHeaders requestHeaders = new HttpHeaders();
404406
requestHeaders.set("MyHeader", "MyValue");
@@ -411,7 +413,7 @@ public void exchangeGet() throws Exception {
411413
}
412414

413415
@Test
414-
@SuppressWarnings("unchecked")
416+
@SuppressWarnings({ "unchecked", "rawtypes" })
415417
public void exchangeGetCallback() throws Exception {
416418
HttpHeaders requestHeaders = new HttpHeaders();
417419
requestHeaders.set("MyHeader", "MyValue");

spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@
4141
*/
4242
public class HttpMessageConverterExtractorTests {
4343

44-
private HttpMessageConverterExtractor extractor;
44+
private HttpMessageConverterExtractor<?> extractor;
4545

4646
private ClientHttpResponse response;
4747

@@ -152,7 +152,8 @@ public void generics() throws IOException {
152152
assertEquals(expected, result);
153153
}
154154

155-
private List<HttpMessageConverter<?>> createConverterList(HttpMessageConverter converter) {
155+
private List<HttpMessageConverter<?>> createConverterList(
156+
HttpMessageConverter<?> converter) {
156157
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>(1);
157158
converters.add(converter);
158159
return converters;

spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,36 +16,16 @@
1616

1717
package org.springframework.web.client;
1818

19-
import java.io.IOException;
2019
import java.io.UnsupportedEncodingException;
2120
import java.net.URI;
2221
import java.net.URISyntaxException;
2322
import java.nio.charset.Charset;
24-
import java.util.Collections;
2523
import java.util.EnumSet;
26-
import java.util.List;
2724
import java.util.Set;
2825

29-
import javax.servlet.GenericServlet;
30-
import javax.servlet.ServletException;
31-
import javax.servlet.ServletRequest;
32-
import javax.servlet.ServletResponse;
33-
import javax.servlet.http.HttpServlet;
34-
import javax.servlet.http.HttpServletRequest;
35-
import javax.servlet.http.HttpServletResponse;
36-
37-
import org.apache.commons.fileupload.FileItem;
38-
import org.apache.commons.fileupload.FileItemFactory;
39-
import org.apache.commons.fileupload.FileUploadException;
40-
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
41-
import org.apache.commons.fileupload.servlet.ServletFileUpload;
42-
import org.eclipse.jetty.server.Server;
43-
import org.eclipse.jetty.servlet.ServletContextHandler;
44-
import org.eclipse.jetty.servlet.ServletHolder;
45-
import org.junit.AfterClass;
4626
import org.junit.Before;
47-
import org.junit.BeforeClass;
4827
import org.junit.Test;
28+
4929
import org.springframework.core.io.ClassPathResource;
5030
import org.springframework.core.io.Resource;
5131
import org.springframework.http.HttpEntity;
@@ -55,14 +35,14 @@
5535
import org.springframework.http.MediaType;
5636
import org.springframework.http.ResponseEntity;
5737
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
58-
import org.springframework.util.FileCopyUtils;
5938
import org.springframework.util.LinkedMultiValueMap;
6039
import org.springframework.util.MultiValueMap;
61-
import org.springframework.util.SocketUtils;
6240

6341
import static org.junit.Assert.*;
6442

65-
/** @author Arjen Poutsma */
43+
/**
44+
* @author Arjen Poutsma
45+
*/
6646
public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
6747

6848
private RestTemplate template;
@@ -198,11 +178,10 @@ public void multipart() throws UnsupportedEncodingException {
198178
}
199179

200180
@Test
201-
@SuppressWarnings("unchecked")
202181
public void exchangeGet() throws Exception {
203182
HttpHeaders requestHeaders = new HttpHeaders();
204183
requestHeaders.set("MyHeader", "MyValue");
205-
HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
184+
HttpEntity<String> requestEntity = new HttpEntity<String>(requestHeaders);
206185
ResponseEntity<String> response =
207186
template.exchange(baseUrl + "/{method}", HttpMethod.GET, requestEntity, String.class, "get");
208187
assertEquals("Invalid content", helloWorld, response.getBody());

0 commit comments

Comments
 (0)