Skip to content

Commit 1aa65cc

Browse files
add try-catch to ensure release of http resource (#37)
* add try-catch to ensure release of http resource * replace try with try-with-resource
1 parent a62337f commit 1aa65cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ 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+
try (HttpResources resources = http.postRaw(url, request)) {
120+
if (resources.getStatusCode() != HttpStatus.SC_OK) {
121+
throw new IndyClientException( resources.getStatusCode(), "Error deleting files: %s",
122+
new IndyResponseErrorDetails( resources.getResponse() ) );
123+
}
124+
}
119125
}
120126

121127
@Deprecated

0 commit comments

Comments
 (0)