Search in sources :

Example 1 with CommentTerminatorNotFoundException

use of org.dbflute.exception.CommentTerminatorNotFoundException in project dbflute-core by dbflute.

the class IfNodeTest method test_parse_IF_terminatorNotFound.

// ===================================================================================
// Exception
// =========
public void test_parse_IF_terminatorNotFound() {
    // ## Arrange ##
    String sql = "where";
    sql = sql + " /*IF pmb.memberId*";
    sql = sql + " select foo";
    SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
    // ## Act ##
    try {
        analyzer.analyze();
        // ## Assert ##
        fail();
    } catch (CommentTerminatorNotFoundException e) {
        // OK
        log(e.getMessage());
    }
}
Also used : CommentTerminatorNotFoundException(org.dbflute.exception.CommentTerminatorNotFoundException) SqlAnalyzer(org.dbflute.twowaysql.SqlAnalyzer)

Example 2 with CommentTerminatorNotFoundException

use of org.dbflute.exception.CommentTerminatorNotFoundException in project dbflute-core by dbflute.

the class SqlTokenizer method throwCommentTerminatorNotFoundException.

protected void throwCommentTerminatorNotFoundException(String expression) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The comment end was NOT found!");
    br.addItem("Advice");
    br.addElement("Please confirm the SQL comment writing.");
    br.addElement("Any comments DOESN'T have a comment end.");
    br.addElement("For example:");
    br.addElement("  (x) -- /*pmb.xxxId3");
    br.addElement("  (o) -- /*pmb.xxxId*/3");
    br.addItem("Specified SQL");
    br.addElement(expression);
    br.addItem("Comment Expression");
    br.addElement(_sql);
    final String msg = br.buildExceptionMessage();
    throw new CommentTerminatorNotFoundException(msg);
}
Also used : CommentTerminatorNotFoundException(org.dbflute.exception.CommentTerminatorNotFoundException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Aggregations

CommentTerminatorNotFoundException (org.dbflute.exception.CommentTerminatorNotFoundException)2 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1 SqlAnalyzer (org.dbflute.twowaysql.SqlAnalyzer)1