| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.web.taglib; |
| 20 |
|
|
| 21 |
|
import javax.servlet.http.HttpServletRequest; |
| 22 |
|
import javax.servlet.jsp.JspException; |
| 23 |
|
import javax.servlet.jsp.tagext.TagSupport; |
| 24 |
|
|
| 25 |
|
import org.apache.struts.Globals; |
| 26 |
|
import org.apache.struts.action.ActionErrors; |
| 27 |
|
import org.apache.struts.action.ActionMessage; |
| 28 |
|
import org.apache.struts.action.ActionMessages; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@deprecated |
| 32 |
|
|
| 33 |
|
@Deprecated |
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 12 |
Complexity Density: 0.57 |
|
| 34 |
|
public final class AddErrorTag extends TagSupport { |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
private static final long serialVersionUID = 1L; |
| 39 |
|
private String name = Globals.ERROR_KEY; |
| 40 |
|
private String key; |
| 41 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0
|
public String getName() {... |
| 43 |
0
|
return name; |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public void setName(String value) {... |
| 47 |
0
|
name = value; |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 50 |
0
|
public String getKey() {... |
| 51 |
0
|
return key; |
| 52 |
|
} |
| 53 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 54 |
0
|
public void setKey(String value) {... |
| 55 |
0
|
key = value; |
| 56 |
|
} |
| 57 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 58 |
0
|
public int doStartTag() throws JspException {... |
| 59 |
0
|
return (SKIP_BODY); |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.42 |
|
| 62 |
0
|
public int doEndTag() throws JspException {... |
| 63 |
0
|
ActionErrors errors = null; |
| 64 |
0
|
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); |
| 65 |
|
|
| 66 |
0
|
if(request == null || getKey() == null) { |
| 67 |
0
|
return EVAL_PAGE; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
0
|
try { |
| 71 |
0
|
errors = (ActionErrors) request.getAttribute(getName()); |
| 72 |
|
} catch(ClassCastException cce) { |
| 73 |
|
} |
| 74 |
|
|
| 75 |
0
|
if(errors == null) { |
| 76 |
0
|
errors = new ActionErrors(); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
0
|
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(getKey())); |
| 80 |
0
|
request.setAttribute(getName(), errors); |
| 81 |
0
|
clearState(); |
| 82 |
0
|
return EVAL_PAGE; |
| 83 |
|
} |
| 84 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 85 |
0
|
public void release() {... |
| 86 |
0
|
super.release(); |
| 87 |
0
|
clearState(); |
| 88 |
|
} |
| 89 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 90 |
0
|
private void clearState() {... |
| 91 |
0
|
name = Globals.ERROR_KEY; |
| 92 |
0
|
key = null; |
| 93 |
|
} |
| 94 |
|
} |