mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 10:17:43 +08:00
Mysterious NPE in QueryTreeAnalyzer #496
This commit is contained in:
parent
b1fa7a4af4
commit
6097afb82c
@ -120,6 +120,26 @@ public class QueryParserAstBasedTest {
|
||||
assertTrue(paramNames.contains("par"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorsInJoin() {
|
||||
try {
|
||||
QueryParserAstBased parser = new QueryParserAstBased(prepareDomainModel(),
|
||||
"select h, sum(u.int1) from sec$User u join u.group g join g.hierarchy hwhere u.constraint.id = :storeSelect group by h");
|
||||
parser.getEntityName();
|
||||
fail();
|
||||
} catch (JpqlSyntaxException e) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
try {
|
||||
QueryParserAstBased parser = new QueryParserAstBased(prepareDomainModel(),
|
||||
"select u from sec$User u join fetch u.group g");
|
||||
parser.getEntityName();
|
||||
fail();
|
||||
} catch (JpqlSyntaxException e) {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUsedEntityNames() throws Exception {
|
||||
|
@ -88,7 +88,7 @@ ql_statement
|
||||
: select_statement | update_statement | delete_statement;
|
||||
|
||||
select_statement
|
||||
: sl='SELECT' select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)?
|
||||
: sl='SELECT' select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)? EOF
|
||||
-> ^(T_QUERY<QueryNode>[$sl] (select_clause)? from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)?);
|
||||
|
||||
update_statement
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $ANTLR 3.5.2 JPA2.g 2018-03-26 13:42:00
|
||||
// $ANTLR 3.5.2 JPA2.g 2018-09-12 09:43:17
|
||||
|
||||
package com.haulmont.cuba.core.sys.jpql.antlr2;
|
||||
|
||||
@ -6,6 +6,9 @@ package com.haulmont.cuba.core.sys.jpql.antlr2;
|
||||
|
||||
import com.haulmont.cuba.core.sys.jpql.JPA2RecognitionException;
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class JPA2Lexer extends Lexer {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user