diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java index b80b027..6a2d300 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java @@ -792,8 +792,8 @@ public final class WorkspaceStorageHubClientService implements Workspace{ storageHubClientService.deleteItemById(itemId); }catch(Exception e){ - LOGGER.error("Delete item by id error: "+e.getMessage()); - throw new Exception("Erro on deleting the item. "+e.getMessage()); + LOGGER.error("Error on deleting the trash item by id: "+itemId,e); + throw e; } } @@ -910,7 +910,6 @@ public final class WorkspaceStorageHubClientService implements Workspace{ try{ Item baseFolderTrash = storageHubClientService.openTrash(); return HLMapper.toWorkspaceItem(baseFolderTrash); - }catch(Exception e){ throw new Exception("Error on getting the Trash content: "+e.getMessage()); } @@ -951,7 +950,8 @@ public final class WorkspaceStorageHubClientService implements Workspace{ return HLMapper.toWorkspaceItem(theItem); }catch(Exception e){ - throw new Exception("Error on restoring the Trash Item: "+e.getMessage()); + LOGGER.error("Error on restoring the trash item by id: "+itemId,e); + throw e; } } diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java b/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java index 94555cd..8fcd81a 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java @@ -298,7 +298,8 @@ public class HLMapper { //CONVERTING TRASH ITEM if(item.isTrashed() && item instanceof TrashItem){ type = WorkspaceItemType.TRASH_ITEM; - TrashItem trashItem = (TrashItem) item; //?? + TrashItem trashItem = (TrashItem) item; + itemName = trashItem.getTitle(); //IN CASE OF TRASHED ITEM THE NAME IS THE ID, SO I'M USING THE TITLE theItem = new org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem(); org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem theTrashItem = (org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem) theItem; theTrashItem.setDeletedBy(trashItem.getDeletedBy()); @@ -307,6 +308,7 @@ public class HLMapper { theTrashItem.setDeletedFrom(trashItem.getDeletedFrom()); theTrashItem.setLenght(trashItem.getLenght()); theTrashItem.setMimeType(trashItem.getMimeType()); + isFolder = trashItem.isFolder(); //DO NOT MOVE THIS SET if(isFolder) //Avoiding null exception on type = WorkspaceItemType.TRASH_FOLDER;