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 super();
036 }
037
038 public AntivirusScannerException(int type) {
039 _type = type;
040 }
041
042
046 @Deprecated
047 public AntivirusScannerException(String msg) {
048 super(msg);
049 }
050
051 public AntivirusScannerException(String msg, int type) {
052 super(msg);
053
054 _type = type;
055 }
056
057 public AntivirusScannerException(String msg, Throwable cause) {
058 super(msg, cause);
059 }
060
061 public AntivirusScannerException(Throwable cause) {
062 super(cause);
063 }
064
065 public String getMessageKey() {
066 if (_type == PROCESS_FAILURE) {
067 return "unable-to-scan-file-for-viruses";
068 }
069 else if (_type == VIRUS_DETECTED) {
070 return "a-virus-was-detected-in-the-file";
071 }
072
073 return "an-unexpected-error-occurred-while-scanning-for-viruses";
074 }
075
076 private int _type;
077
078 }