|
From: <ric...@us...> - 2009-10-01 13:40:43
|
Revision: 4737
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4737&view=rev
Author: ricbrown
Date: 2009-10-01 12:29:45 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Merge r4736 (Fix NH-1915, throw correct exception when joining on invalid path)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-10-01 12:29:05 UTC (rev 4736)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-10-01 12:29:45 UTC (rev 4737)
@@ -679,6 +679,12 @@
dot.Resolve( true, false, alias == null ? null : alias.Text );
FromElement fromElement = dot.GetImpliedJoin();
+
+ if (fromElement == null)
+ {
+ throw new InvalidPathException("Invalid join: " + dot.Path);
+ }
+
fromElement.SetAllPropertyFetch(propertyFetch!=null);
if ( with != null )
Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-10-01 12:29:05 UTC (rev 4736)
+++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-10-01 12:29:45 UTC (rev 4737)
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using NHibernate.Engine.Query;
+using NHibernate.Hql.Ast.ANTLR;
using NHibernate.Util;
using NUnit.Framework;
@@ -131,5 +132,20 @@
s.CreateQuery(string.Format("from SimpleClass sc where sc.LongValue = {0}", int.MaxValue + 1L)).List();
}
}
+
+ [Test]
+ public void InvalidJoinOnProperty()
+ {
+ // NH-1915
+ using (ISession s = OpenSession())
+ {
+ Assert.Throws<InvalidPathException>(
+ () =>
+ {
+ s.CreateQuery("from Zoo z inner join fetch z.classification").List();
+ },
+ "Incorrect path not caught during parsing");
+ }
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|