Skip to content

Commit 3a553db

Browse files
add try-catch to ensure release of http resource
1 parent a62337f commit 3a553db

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

addons-client/folo/client-java/src/main/java/org/commonjava/indy/folo/client/IndyFoloAdminClientModule.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,21 @@ public TrackingIdsDTO getTrackingIds( final String trackingType )
115115
public void deleteFilesFromStoreByTrackingID( final BatchDeleteRequest request )
116116
throws IndyClientException
117117
{
118-
http.postRaw( UrlUtils.buildUrl( "/folo/admin/batch/delete" ), request );
118+
String url = UrlUtils.buildUrl("/folo/admin/batch/delete");
119+
HttpResources resources = null;
120+
try
121+
{
122+
resources = http.postRaw(url, request);
123+
if (resources.getStatusCode() != HttpStatus.SC_OK)
124+
{
125+
throw new IndyClientException( resources.getStatusCode(), "Error deleting files: %s",
126+
new IndyResponseErrorDetails( resources.getResponse() ) );
127+
}
128+
}
129+
finally
130+
{
131+
IOUtils.closeQuietly( resources );
132+
}
119133
}
120134

121135
@Deprecated

0 commit comments

Comments
 (0)