Loading src/adql/db/DBChecker.java +2 −2 Original line number Diff line number Diff line Loading @@ -1306,13 +1306,13 @@ public class DBChecker implements QueryChecker { * </p> * * @author Grégory Mantelet (ARI) * @version 1.4 (04/2017) * @version 1.4 (05/2017) * @since 1.4 */ private static class SearchColumnOutsideGroupByHandler extends SearchColumnHandler { @Override protected boolean goInto(final ADQLObject obj){ return !(obj instanceof ClauseADQL<?> && ((ClauseADQL<?>)obj).getName().equalsIgnoreCase("GROUP BY")) && super.goInto(obj); return !(obj instanceof ClauseADQL<?> && ((ClauseADQL<?>)obj).getName() != null && ((ClauseADQL<?>)obj).getName().equalsIgnoreCase("GROUP BY")) && super.goInto(obj); } } Loading test/adql/db/TestDBChecker.java +17 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,23 @@ public class TestDBChecker { assertEquals(expected[i], names[i]); } @Test public void testClauseADQLWithNameNull(){ /* The name of an ADQLClause is got in DBChecker by SearchColumnOutsideGroupByHandler.goInto(...) * and possibly in other locations in the future. If this name is NULL, no NullPointerException * should be thrown. * * This issue can be tested by creating a ConstraintsGroup (i.e. in a constraints location like WHERE or JOIN...ON, * a constraint (or more) between parenthesis). */ ADQLParser parser = new ADQLParser(new DBChecker(tables, new ArrayList<FunctionDef>(0))); try{ parser.parseQuery("SELECT * FROM foo WHERE (colI BETWEEN 1 AND 10)"); }catch(ParseException pe){ pe.printStackTrace(); fail(); } } @Test public void testGroupByWithQualifiedColName(){ ADQLParser parser = new ADQLParser(new DBChecker(tables, new ArrayList<FunctionDef>(0))); Loading Loading
src/adql/db/DBChecker.java +2 −2 Original line number Diff line number Diff line Loading @@ -1306,13 +1306,13 @@ public class DBChecker implements QueryChecker { * </p> * * @author Grégory Mantelet (ARI) * @version 1.4 (04/2017) * @version 1.4 (05/2017) * @since 1.4 */ private static class SearchColumnOutsideGroupByHandler extends SearchColumnHandler { @Override protected boolean goInto(final ADQLObject obj){ return !(obj instanceof ClauseADQL<?> && ((ClauseADQL<?>)obj).getName().equalsIgnoreCase("GROUP BY")) && super.goInto(obj); return !(obj instanceof ClauseADQL<?> && ((ClauseADQL<?>)obj).getName() != null && ((ClauseADQL<?>)obj).getName().equalsIgnoreCase("GROUP BY")) && super.goInto(obj); } } Loading
test/adql/db/TestDBChecker.java +17 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,23 @@ public class TestDBChecker { assertEquals(expected[i], names[i]); } @Test public void testClauseADQLWithNameNull(){ /* The name of an ADQLClause is got in DBChecker by SearchColumnOutsideGroupByHandler.goInto(...) * and possibly in other locations in the future. If this name is NULL, no NullPointerException * should be thrown. * * This issue can be tested by creating a ConstraintsGroup (i.e. in a constraints location like WHERE or JOIN...ON, * a constraint (or more) between parenthesis). */ ADQLParser parser = new ADQLParser(new DBChecker(tables, new ArrayList<FunctionDef>(0))); try{ parser.parseQuery("SELECT * FROM foo WHERE (colI BETWEEN 1 AND 10)"); }catch(ParseException pe){ pe.printStackTrace(); fail(); } } @Test public void testGroupByWithQualifiedColName(){ ADQLParser parser = new ADQLParser(new DBChecker(tables, new ArrayList<FunctionDef>(0))); Loading