OPENJPA-595 A common path() action in JPQL.jjt being used for Enum literal causes a simple aliase resolution to fail

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@654626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-05-08 21:24:47 +00:00
parent b796e1710f
commit 3f9dcdbb76
2 changed files with 8 additions and 2 deletions

View File

@ -1322,8 +1322,11 @@ public class JPQLExpressionBuilder
Object value = field.get(null); Object value = field.get(null);
return factory.newLiteral(value, Literal.TYPE_UNKNOWN); return factory.newLiteral(value, Literal.TYPE_UNKNOWN);
} catch (NoSuchFieldException nsfe) { } catch (NoSuchFieldException nsfe) {
throw parseException(EX_USER, "no-field", if (node.parser.inEnumPath)
new Object[]{ c.getName(), fieldName }, nsfe); throw parseException(EX_USER, "no-field",
new Object[]{ c.getName(), fieldName }, nsfe);
else
return getPath(node, false, true);
} catch (Exception e) { } catch (Exception e) {
throw parseException(EX_USER, "unaccessible-field", throw parseException(EX_USER, "unaccessible-field",
new Object[]{ className, fieldName }, e); new Object[]{ className, fieldName }, e);

View File

@ -64,6 +64,7 @@ import java.io.*;
public class JPQL public class JPQL
{ {
String jpql; String jpql;
boolean inEnumPath;
public JPQL (String jpql) public JPQL (String jpql)
@ -968,7 +969,9 @@ void enum_primary() : { }
void enum_literal() : { } void enum_literal() : { }
{ {
{ inEnumPath = true; }
path() path()
{ inEnumPath = false; }
} }