| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.services.exceptions; |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
|
|
|
| 0% |
Uncovered Elements: 68 (68) |
Complexity: 25 |
Complexity Density: 0.69 |
|
| 37 |
|
public class AuthenticatorException extends RuntimeException { |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
private static final long serialVersionUID = -7799413588815903874L; |
| 42 |
|
public static final int INVALID_DATA = -1; |
| 43 |
|
public static final int UNKNOWN_USER = -2; |
| 44 |
|
public static final int INVALID_PASSWORD = -3; |
| 45 |
|
public static final int INACTIVE_ACCOUNT = -4; |
| 46 |
|
public static final int SYSTEM_ERROR = -5; |
| 47 |
|
public static final int INVALID_AUTHENTICATION_TYPE = -6; |
| 48 |
|
public static final int CUSTOM_ERROR = -7; |
| 49 |
|
|
| 50 |
|
public static final int ERRORPAGE_TYPE_UNDEFINED = -1; |
| 51 |
|
public static final int ERRORPAGE_TYPE_FORWARD = 1; |
| 52 |
|
public static final int ERRORPAGE_TYPE_URL = 2; |
| 53 |
|
|
| 54 |
|
private int type = 0; |
| 55 |
|
private String messageKey = "itracker.web.error.login.system"; |
| 56 |
|
private int errorPageType = ERRORPAGE_TYPE_UNDEFINED; |
| 57 |
|
private String errorPageValue = null; |
| 58 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 59 |
0
|
public AuthenticatorException() {... |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
0
|
public AuthenticatorException(int type) {... |
| 63 |
0
|
this.type = type; |
| 64 |
|
} |
| 65 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 66 |
0
|
public AuthenticatorException(int type, String messageKey) {... |
| 67 |
0
|
this(type); |
| 68 |
0
|
this.messageKey = messageKey; |
| 69 |
|
} |
| 70 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 71 |
0
|
public AuthenticatorException(String message, int type) {... |
| 72 |
0
|
super(message); |
| 73 |
0
|
this.type = type; |
| 74 |
|
} |
| 75 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 76 |
0
|
public AuthenticatorException(String message, int type, Throwable cause) {... |
| 77 |
0
|
super(message, cause); |
| 78 |
0
|
this.type = type; |
| 79 |
|
} |
| 80 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 81 |
0
|
public AuthenticatorException(String message, int type, String messageKey) {... |
| 82 |
0
|
this(message, type); |
| 83 |
0
|
this.messageKey = messageKey; |
| 84 |
|
} |
| 85 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
0
|
public int getType() {... |
| 87 |
0
|
return type; |
| 88 |
|
} |
| 89 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 90 |
0
|
public void setType(int type) {... |
| 91 |
0
|
this.type = type; |
| 92 |
|
} |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 94 |
0
|
public String getMessage() {... |
| 95 |
0
|
String message = super.getMessage(); |
| 96 |
0
|
if(message == null || message.equals("")) { |
| 97 |
0
|
message = "Empty message, type: " + getTypeString(); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
0
|
return message; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
@return |
| 106 |
|
|
| 107 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 108 |
0
|
public String getMessageKey() {... |
| 109 |
0
|
return messageKey; |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
@param |
| 115 |
|
|
| 116 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 117 |
0
|
public void setMessageKey(String messageKey) {... |
| 118 |
0
|
this.messageKey = messageKey; |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
@see |
| 126 |
|
@see |
| 127 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
0
|
public int getErrorPageType() {... |
| 129 |
0
|
return errorPageType; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
|
|
| 135 |
|
@param |
| 136 |
|
@see |
| 137 |
|
@see |
| 138 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
0
|
public void setErrorPageType(int value) {... |
| 140 |
0
|
errorPageType = value; |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
@see |
| 149 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 150 |
0
|
public String getErrorPageValue() {... |
| 151 |
0
|
return errorPageValue; |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
|
|
| 158 |
|
@param |
| 159 |
|
@see |
| 160 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 161 |
0
|
public void setErrorPageValue(String value) {... |
| 162 |
0
|
errorPageValue = value; |
| 163 |
|
} |
| 164 |
|
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 8 |
Complexity Density: 0.53 |
|
| 165 |
0
|
private String getTypeString() {... |
| 166 |
0
|
if(type == INVALID_DATA) { |
| 167 |
0
|
return "Invalid Data"; |
| 168 |
0
|
} else if(type == UNKNOWN_USER) { |
| 169 |
0
|
return "Unknown User"; |
| 170 |
0
|
} else if(type == INVALID_PASSWORD) { |
| 171 |
0
|
return "Invalid Password"; |
| 172 |
0
|
} else if(type == INACTIVE_ACCOUNT) { |
| 173 |
0
|
return "Inactive Account"; |
| 174 |
0
|
} else if(type == SYSTEM_ERROR) { |
| 175 |
0
|
return "System Error"; |
| 176 |
0
|
} else if(type == INVALID_AUTHENTICATION_TYPE) { |
| 177 |
0
|
return "Invalid Authentication Type"; |
| 178 |
0
|
} else if(type == CUSTOM_ERROR ) { |
| 179 |
0
|
return "Custom Error. Check message key."; |
| 180 |
|
} |
| 181 |
|
|
| 182 |
0
|
return "Unknown Type"; |
| 183 |
|
} |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
|