Package hudson.util
Class FormFillFailure
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- hudson.util.FormFillFailure
-
- All Implemented Interfaces:
Serializable,org.kohsuke.stapler.HttpResponse
public abstract class FormFillFailure extends IOException implements org.kohsuke.stapler.HttpResponse
Represents a failure in a form field doFillXYZ method.Use one of the factory methods to create an instance, then throw it from your
doFillXyzmethod.- Since:
- 2.50
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static FormFillFailureerror(String message)Sends out a string error message that indicates an error.static FormFillFailureerror(String format, Object... args)Sends out a string error message that indicates an error, by formatting it withString.format(String, Object[])static FormFillFailureerror(Throwable e, String message)Sends out a string error message, with optional "show details" link that expands to the full stack trace.static FormFillFailureerror(Throwable e, String format, Object... args)static FormFillFailureerrorWithMarkup(String message)Sends out an HTML fragment that indicates an error.voidgenerateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node)FormValidation.KindgetKind()booleanisSelectionCleared()abstract StringrenderHtml()static FormFillFailurerespond(FormValidation.Kind kind, String html)Sends out an arbitrary HTML fragment as the output.static FormFillFailurewarning(String message)static FormFillFailurewarning(String format, Object... args)static FormFillFailurewarning(Throwable e, String message)static FormFillFailurewarning(Throwable e, String format, Object... args)static FormFillFailurewarningWithMarkup(String message)FormFillFailurewithSelectionCleared()Flags this failure as requiring that the select options should be cleared out.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
error
public static FormFillFailure error(@NonNull String message)
Sends out a string error message that indicates an error.- Parameters:
message- Human readable message to be sent.
-
warning
public static FormFillFailure warning(@NonNull String message)
-
error
public static FormFillFailure error(String format, Object... args)
Sends out a string error message that indicates an error, by formatting it withString.format(String, Object[])
-
warning
public static FormFillFailure warning(String format, Object... args)
-
error
public static FormFillFailure error(Throwable e, String message)
Sends out a string error message, with optional "show details" link that expands to the full stack trace.Use this with caution, so that anonymous users do not gain too much insights into the state of the system, as error stack trace often reveals a lot of information. Consider if an error needs to be exposed to everyone or just those who have higher access to job/hudson/etc.
-
warning
public static FormFillFailure warning(Throwable e, String message)
-
error
public static FormFillFailure error(Throwable e, String format, Object... args)
-
warning
public static FormFillFailure warning(Throwable e, String format, Object... args)
-
errorWithMarkup
public static FormFillFailure errorWithMarkup(String message)
Sends out an HTML fragment that indicates an error.This method must be used with care to avoid cross-site scripting attack.
- Parameters:
message- Human readable message to be sent.error(null)can be used asok().
-
warningWithMarkup
public static FormFillFailure warningWithMarkup(String message)
-
respond
public static FormFillFailure respond(FormValidation.Kind kind, String html)
Sends out an arbitrary HTML fragment as the output.
-
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node) throws IOException, javax.servlet.ServletException- Specified by:
generateResponsein interfaceorg.kohsuke.stapler.HttpResponse- Throws:
IOExceptionjavax.servlet.ServletException
-
getKind
public FormValidation.Kind getKind()
-
isSelectionCleared
public boolean isSelectionCleared()
-
withSelectionCleared
public FormFillFailure withSelectionCleared()
Flags this failure as requiring that the select options should be cleared out.- Returns:
thisfor method chaining.
-
renderHtml
public abstract String renderHtml()
-
-