001
014
015 package com.liferay.portlet.documentlibrary.antivirus;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018
019
023 public class AntivirusScannerException extends PortalException {
024
025 public static final int PROCESS_FAILURE = 1;
026
027 public static final int VIRUS_DETECTED = 2;
028
029
033 @Deprecated
034 public AntivirusScannerException() {
035 }
036
037 public AntivirusScannerException(int type) {
038 _type = type;
039 }
040
041
045 @Deprecated
046 public AntivirusScannerException(String msg) {
047 super(msg);
048 }
049
050 public AntivirusScannerException(String msg, int type) {
051 super(msg);
052
053 _type = type;
054 }
055
056 public AntivirusScannerException(String msg, Throwable cause) {
057 super(msg, cause);
058 }
059
060 public AntivirusScannerException(Throwable cause) {
061 super(cause);
062 }
063
064 public String getMessageKey() {
065 if (_type == PROCESS_FAILURE) {
066 return "unable-to-scan-file-for-viruses";
067 }
068 else if (_type == VIRUS_DETECTED) {
069 return "a-virus-was-detected-in-the-file";
070 }
071
072 return "an-unexpected-error-occurred-while-scanning-for-viruses";
073 }
074
075 private int _type;
076
077 }