You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2022/10/09 09:52:41 UTC
[cloudstack] branch main updated: Refactor TestHttp.testHttpclient to avoid the Exception Suppression (#6733)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 69e158d77d2 Refactor TestHttp.testHttpclient to avoid the Exception Suppression (#6733)
69e158d77d2 is described below
commit 69e158d77d24bbd0a9b6900d406aba266db5ccb3
Author: Codegass <wc...@gmail.com>
AuthorDate: Sun Oct 9 05:52:32 2022 -0400
Refactor TestHttp.testHttpclient to avoid the Exception Suppression (#6733)
* Refactor TestHttp.testHttpclient to avoid the Exception Suppression
* Remove the unnecessary import
---
.../org/apache/cloudstack/storage/test/TestHttp.java | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/TestHttp.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/TestHttp.java
index 43a24768918..339f9f603f4 100644
--- a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/TestHttp.java
+++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/TestHttp.java
@@ -26,7 +26,6 @@ import java.io.OutputStream;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.impl.client.DefaultHttpClient;
@@ -41,7 +40,7 @@ import junit.framework.Assert;
public class TestHttp extends AbstractTestNGSpringContextTests {
@Test
@Parameters("template-url")
- public void testHttpclient(String templateUrl) {
+ public void testHttpclient(String templateUrl) throws IOException {
final HttpHead method = new HttpHead(templateUrl);
final DefaultHttpClient client = new DefaultHttpClient();
@@ -62,20 +61,9 @@ public class TestHttp extends AbstractTestNGSpringContextTests {
output = new BufferedOutputStream(new FileOutputStream(localFile));
entity.writeTo(output);
- } catch (final ClientProtocolException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
} finally {
- try {
- if (output != null) {
- output.close();
- }
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (output != null) {
+ output.close();
}
}