001package Torello.HTML;
002
003import Torello.Java.ExceptionCheckError;
004
005/**
006 * If, when attempting to instantiate or construct a {@code TagNode}, the {@code String} used to
007 * instantiate that node is invalid, this exception will be thrown to inform the programmer that
008 * his passed constructor-{@code String} was invalid.  That failed-{@code String} will be available
009 * as a {@code public final String} field inside this exception class.
010 * 
011 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=EXPM>
012 */
013public class MalformedTagNodeException extends IllegalArgumentException
014{
015    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX> */
016    public static final long serialVersionUID = 1;
017
018    /**
019     * <EMBED CLASS='external-html' DATA-FILE-ID=EXPF>
020     * 
021     * <BR /><BR />This public final field contains the {@code String} that, when a {@code TagNode}
022     * attempted to build this {@code String} into a {@code TagNode} instance, caused an exception
023     * to throw.
024     */
025    public final String htmlElementStr;
026
027    /**
028     * Constructs a new exception with the specified detail message, and one {@code public, final} 
029     * parameter: {@code htmlElementStr}.
030     * 
031     * @param message the detail message.
032     * 
033     * @param htmlElementStr This will be passed the constructor-string that was passed to the
034     * constructor which caused this {@code Exception} to throw in the first place.  This 
035     * {@code String} will be available in the {@code public final String htmlElementStr} field,
036     * for inspection and reference.  <I><B>It ought not to be left null.</B></I>
037     * 
038     * <EMBED CLASS='external-html' DATA-FILE-ID=EXPF_PARAM>
039     * @see #htmlElementStr
040     */
041    public MalformedTagNodeException(String message, String htmlElementStr)
042    {
043        super(message);
044
045        if (htmlElementStr == null) throw new ExceptionCheckError
046            ("'htmlElementStr' was passed a null reference");
047
048        this.htmlElementStr = htmlElementStr;
049    }
050
051    /**
052     * Constructs a new exception with the specified detail message, cause-chain throwable, and one 
053     * {@code public, final} parameter: {@code htmlElementStr}.
054     * 
055     * <BR /><BR /><DIV CLASS=JDHint>
056     * <B STYLE='color:red;'>Note:</B> The detail message associated with cause is not
057     * automatically incorporated into this exception's detail message.
058     * </DIV>
059     * 
060     * @param message The detail message (which is saved for later retrieval by the
061     * {@code Throwable.getMessage()} method).
062     * 
063     * @param cause the cause (which is saved for later retrieval by the {@code Throwable.getCause()}
064     * method).  (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
065     * 
066     * @param htmlElementStr This will be passed the constructor-string that was passed to the
067     * constructor which caused this {@code Exception} to throw in the first place.  This 
068     * {@code String} will be available in the {@code public final String htmlElementStr} field, 
069     * for inspection and reference.  <I><B>It ought not to be left null.</B></I>
070     * 
071     * <EMBED CLASS='external-html' DATA-FILE-ID=EXPF_PARAM>
072     * 
073     * @see #htmlElementStr
074     */
075    public MalformedTagNodeException(String message, Throwable cause, String htmlElementStr)
076    {
077        super(message, cause);
078
079        if (htmlElementStr == null) throw new ExceptionCheckError
080            ("'htmlElementStr' was passed a null reference");
081
082        this.htmlElementStr = htmlElementStr;
083    }
084}