Skip to content

Commit

Permalink
SRUClient: Fix resource leak
Browse files Browse the repository at this point in the history
CID 44603 (#1 of 1): Resource leak (RESOURCE_LEAK)

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 14, 2016
1 parent d6e9b45 commit c964d84
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -219,8 +220,12 @@ private void saxInit() {
*/
public void testResponseResource(String fileName) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(getClass().getResourceAsStream("/" + fileName), out);
testingResponseString = out.toString("UTF-8");
InputStream in = getClass().getResourceAsStream("/" + fileName);
if (in != null) {
IOUtils.copy(in, out);
testingResponseString = out.toString("UTF-8");
in.close();
}
}

/**
Expand Down

0 comments on commit c964d84

Please sign in to comment.