Skip to content
Snippets Groups Projects
Commit 7a2c06a8 authored by srosse's avatar srosse
Browse files

OO-295: catch the error generated by a ZIP with the wrong encoding

parent c1f7f418
No related branches found
No related tags found
No related merge requests found
...@@ -95,23 +95,30 @@ public class CmdUnzip extends BasicController implements FolderCommand { ...@@ -95,23 +95,30 @@ public class CmdUnzip extends BasicController implements FolderCommand {
return null; return null;
} }
boolean fileNotExist = false; VFSItem currentVfsItem = null;
for (String sItem:selection.getFiles()) { try {
VFSItem vfsItem = currentContainer.resolve(sItem); boolean fileNotExist = false;
if (vfsItem != null && (vfsItem instanceof VFSLeaf)) { for (String sItem:selection.getFiles()) {
if (!doUnzip((VFSLeaf)vfsItem, currentContainer, ureq, wContr)) { currentVfsItem = currentContainer.resolve(sItem);
status = FolderCommandStatus.STATUS_FAILED; if (currentVfsItem != null && (currentVfsItem instanceof VFSLeaf)) {
if (!doUnzip((VFSLeaf)currentVfsItem, currentContainer, ureq, wContr)) {
status = FolderCommandStatus.STATUS_FAILED;
break;
}
} else {
fileNotExist = true;
break; break;
} }
} else {
fileNotExist = true;
break;
} }
}
if (fileNotExist) {
if (fileNotExist) { status = FolderCommandStatus.STATUS_FAILED;
status = FolderCommandStatus.STATUS_FAILED; getWindowControl().setError(translator.translate("FileDoesNotExist"));
getWindowControl().setError(translator.translate("FileDoesNotExist")); }
} catch (IllegalArgumentException e) {
logError("Corrupted ZIP", e);
String name = currentVfsItem == null ? "NULL" : currentVfsItem.getName();
getWindowControl().setError(translator.translate("FileUnzipFailed", new String[]{name}));
} }
return null; return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment