All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tmiyapub.parser.exception.IllegalCharacterException Maven / Gradle / Ivy

There is a newer version: 0.7
Show newest version
package com.tmiyapub.parser.exception;

import com.tmiyapub.parser.KeyValueLogParser;

/**
 * an exception for illegal character in pasing strings
 */
public class IllegalCharacterException extends Exception {
    private int position;
    private Character c;
    private KeyValueLogParser.ParseMode parseMode;
    private String message;

    /**
     * a constructor
     *
     * @param position character index(position of error) on parsing string
     * @param c unexpected character in the mode
     * @param parseMode the mode in parsing
     * @param message description for error
     */
    public IllegalCharacterException(int position, Character c, KeyValueLogParser.ParseMode parseMode, String message) {
        this.position = position;
        this.c = c;
        this.parseMode = parseMode;
        this.message = message;
    }

    @Override
    public String getMessage() {
        return String.format("Illegal Character Exception: '%c' at character [%d] in %s mode.(%s)", c, position, parseMode, message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy