1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package Torello.CSS;

/**
 * This exception will be thrown by the Static-Build Methods offered by each of the individual
 * {@link CSSToken} Classes if the User provides faulty {@code String}-Input.
 */
public class TokenizeException extends RuntimeException 
{
    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
    protected static final long serialVersionUID = 1;

    /** Constructs a {@code TokenizeException} with no detail message. */
    public TokenizeException()
    { super(); }

    /**
     * Constructs a {@code TokenizeException} with the specified detail message.
     * @param message the detail message.
     */
    public TokenizeException(String message)
    { super(message); }


    // Constructors invoked by CSSToken.build (there are 2 "build" methods in that class)
    // That is the super / parent "build" method for all subclass build methods (except URLToken)
    //
    // These methods are package-private because they don't serve any purpose whatsoever to an
    // API-User writing code using Torello.CSS.  These are strictly internal

    TokenizeException(String inputStr, String tokenizedStr)
    {
        this(
            "The Tokenzier was unable to convert the entire Input-String provided into a single " +
            "CSSToken instance. In tokenizing Input-String:\n" +
            "\t[" + inputStr + "] - Length: " + inputStr.length() + "] characters\n" +
            "The following partially tokenized Output-String was generated:\n" +
            "\t[" + tokenizedStr + "] - Length: " + tokenizedStr.length() + "] characters"
        );
    }

    // This one is also a constructor used by CSSToken's two "build" methods
    TokenizeException(Class<? extends CSSToken> tokenClass)
    {
        this(
            "The Input-String provided does not contain enough character data to form a " +
            "CSSToken '" + tokenClass.getSimpleName()  + "' instance."
        );
    }
}