com.tmiyapub.parser.exception.IllegalCharacterException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kvlog-parser Show documentation
Show all versions of kvlog-parser Show documentation
a parser for log contains both key and value.
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);
}
}