List<Reference> refs = client.getProductReferences(p);
if (refs == null) {
throw new Exception("FileManager returned null References");
}
for (Reference ref : refs) {
if (!client.removeFile(new File(new URI(ref.getDataStoreReference()))
.getAbsolutePath())) {
throw new Exception("Failed to delete file '"
+ ref.getDataStoreReference() + "'");
}
}