Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git@github.com:UNC-Libraries/Curators-Workbe…
Browse files Browse the repository at this point in the history
…nch.git
  • Loading branch information
gregjan committed Mar 8, 2013
2 parents bddcc50 + 5311235 commit 66805d6
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions forms/src/main/java/cdr/forms/FormController.java
Expand Up @@ -302,18 +302,14 @@ private SubmittedFile handleUploadedFile(MultipartFile file, BindingResult error
}

private synchronized String virusScan(File depositFile) {
try {
ScanResult result = this.getClamScan().scan(new FileInputStream(depositFile));
switch(result.getStatus()) {
case PASSED:
return null;
case FAILED:
return "A virus was detected in your file. Please scan your computer for viruses or report this issue to technical support.";
case ERROR:
throw new Error("There was a problem running the virus scan.", result.getException());
}
} catch (FileNotFoundException e) {
throw new Error("There was a problem finding the uploaded file: "+depositFile.getName(), e);
ScanResult result = this.getClamScan().scan(depositFile);
switch(result.getStatus()) {
case PASSED:
return null;
case FAILED:
return "A virus was detected in your file. Please scan your computer for viruses or report this issue to technical support.";
case ERROR:
throw new Error("There was a problem running the virus scan.", result.getException());
}
return null;
}
Expand Down

0 comments on commit 66805d6

Please sign in to comment.