Skip to content

Commit 8e5fed4

Browse files
committed
Applied NH-2293
SVN: trunk@5166
1 parent db3f2c4 commit 8e5fed4

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Linq;
2+
using NHibernate.Hql.Ast.ANTLR;
3+
using NUnit.Framework;
4+
using SharpTestsEx;
5+
6+
namespace NHibernate.Test.NHSpecificTest.NH2293
7+
{
8+
public class Fixture : BugTestCase
9+
{
10+
protected override System.Collections.IList Mappings
11+
{
12+
get
13+
{
14+
return Enumerable.Empty<object>().ToList();
15+
}
16+
}
17+
18+
[Test]
19+
public void WhenQueryHasJustAfromThenThrowQuerySyntaxException()
20+
{
21+
using (ISession session = OpenSession())
22+
{
23+
session.Executing(s => s.CreateQuery("from").List()).Throws<QuerySyntaxException>();
24+
}
25+
}
26+
}
27+
}

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@
465465
<Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
466466
<Compile Include="NHSpecificTest\NH2287\Domain.cs" />
467467
<Compile Include="NHSpecificTest\NH2287\Fixture.cs" />
468+
<Compile Include="NHSpecificTest\NH2293\Fixture.cs" />
468469
<Compile Include="NHSpecificTest\NH2294\Fixture.cs" />
469470
<Compile Include="TypesTest\CharClass.cs" />
470471
<Compile Include="TypesTest\CharClassFixture.cs" />

src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public void WeakKeywords()
134134
// Case 2: The current token is after FROM and before '.'.
135135
if (t != IDENT && input.LA(-1) == FROM && ((input.LA(2) == DOT) || (input.LA(2) == IDENT) || (input.LA(2) == -1)))
136136
{
137-
HqlToken hqlToken = (HqlToken)input.LT(1);
138-
if (hqlToken.PossibleId)
137+
HqlToken hqlToken = input.LT(1) as HqlToken;
138+
if (hqlToken != null && hqlToken.PossibleId)
139139
{
140140
hqlToken.Type = IDENT;
141141
if (log.IsDebugEnabled)

0 commit comments

Comments
 (0)