Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,21 @@ public TrackingIdsDTO getTrackingIds( final String trackingType )
public void deleteFilesFromStoreByTrackingID( final BatchDeleteRequest request )
throws IndyClientException
{
http.postRaw( UrlUtils.buildUrl( "/folo/admin/batch/delete" ), request );
String url = UrlUtils.buildUrl("/folo/admin/batch/delete");
HttpResources resources = null;
try
{
resources = http.postRaw(url, request);
if (resources.getStatusCode() != HttpStatus.SC_OK)
{
throw new IndyClientException( resources.getStatusCode(), "Error deleting files: %s",
new IndyResponseErrorDetails( resources.getResponse() ) );
}
}
finally
{
IOUtils.closeQuietly( resources );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to recommend to use try(resource) instead of this finally.

    String url = UrlUtils.buildUrl("/folo/admin/batch/delete");
    try (HttpResources resources = http.postRaw( url, request ))
    {
        if ( resources.getStatusCode() != HttpStatus.SC_OK )
        {
            throw new IndyClientException( resources.getStatusCode(), "Error deleting files: %s",
                                           new IndyResponseErrorDetails( resources.getResponse() ) );
        }
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll make a change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ligangty I've changed it and there is nothing more that I can enhance

}

@Deprecated
Expand Down