Skip to content

Commit 69e158d

Browse files
authored
Refactor TestHttp.testHttpclient to avoid the Exception Suppression (#6733)
* Refactor TestHttp.testHttpclient to avoid the Exception Suppression * Remove the unnecessary import
1 parent 0535d9b commit 69e158d

File tree

1 file changed

+3
-15
lines changed
  • engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test

1 file changed

+3
-15
lines changed

engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/TestHttp.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import org.apache.http.HttpEntity;
2828
import org.apache.http.HttpResponse;
29-
import org.apache.http.client.ClientProtocolException;
3029
import org.apache.http.client.methods.HttpGet;
3130
import org.apache.http.client.methods.HttpHead;
3231
import org.apache.http.impl.client.DefaultHttpClient;
@@ -41,7 +40,7 @@
4140
public class TestHttp extends AbstractTestNGSpringContextTests {
4241
@Test
4342
@Parameters("template-url")
44-
public void testHttpclient(String templateUrl) {
43+
public void testHttpclient(String templateUrl) throws IOException {
4544
final HttpHead method = new HttpHead(templateUrl);
4645
final DefaultHttpClient client = new DefaultHttpClient();
4746

@@ -62,20 +61,9 @@ public void testHttpclient(String templateUrl) {
6261

6362
output = new BufferedOutputStream(new FileOutputStream(localFile));
6463
entity.writeTo(output);
65-
} catch (final ClientProtocolException e) {
66-
// TODO Auto-generated catch block
67-
e.printStackTrace();
68-
} catch (final IOException e) {
69-
// TODO Auto-generated catch block
70-
e.printStackTrace();
7164
} finally {
72-
try {
73-
if (output != null) {
74-
output.close();
75-
}
76-
} catch (final IOException e) {
77-
// TODO Auto-generated catch block
78-
e.printStackTrace();
65+
if (output != null) {
66+
output.close();
7967
}
8068
}
8169

0 commit comments

Comments
 (0)