提交 758eb9a9 编写于 作者: M mindless

[FIXED HUDSON-7438] as FormValidation extends IOException, pass the message

in _errorWithMarkup to super(message) so that getMessage() returns the message.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@37017 71c3de6d-444a-0410-be80-ed276b4c234a
上级 415cd547
......@@ -221,7 +221,7 @@ public abstract class FormValidation extends IOException implements HttpResponse
private static FormValidation _errorWithMarkup(final String message, final Kind kind) {
if(message==null)
return ok();
return new FormValidation(kind) {
return new FormValidation(kind, message) {
public String renderHtml() {
// 1x16 spacer needed for IE since it doesn't support min-height
return "<div class="+ kind.name().toLowerCase(Locale.ENGLISH) +"><img src='"+
......@@ -477,6 +477,11 @@ public abstract class FormValidation extends IOException implements HttpResponse
this.kind = kind;
}
private FormValidation(Kind kind, String message) {
super(message);
this.kind = kind;
}
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
respond(rsp, renderHtml());
}
......
......@@ -46,4 +46,9 @@ public class FormValidationTest extends TestCase {
assertNotNull(actual);
assertEquals(FormValidation.Kind.ERROR, actual.kind);
}
// @Bug(7438)
public void testMessage() {
assertEquals("test msg", FormValidation.errorWithMarkup("test msg").getMessage());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册