private void checkForDuplicateClassAlias(String classAlias) throws SemanticException { if ( classAlias != null && fromElementByClassAlias.containsKey( classAlias ) ) { throw new SemanticException( "Duplicate definition of alias '" + classAlias + "'" ); } }
/** * Prints this throwable and its backtrace to the specified print writer. * * @param w the print writer.s */ public void printStackTrace(PrintWriter w) { super.printStackTrace( w ); if ( cause != null ) { w.println( "Cause:" ); cause.printStackTrace( w ); } }
/** * Set the select expression that defines the result variable. * * @param selectExpression the select expression; * selectExpression.getAlias() must be non-null * @throws SemanticException if selectExpression or * selectExpression.getAlias() is null. */ public void setSelectExpression(SelectExpression selectExpression) throws SemanticException { if ( selectExpression == null || selectExpression.getAlias() == null ) { throw new SemanticException( "A ResultVariableRefNode must refer to a non-null alias." ); } this.selectExpression = selectExpression; }
/** * Prints a stack trace. */ @AllowPrintStacktrace public void printStackTrace() { super.printStackTrace(); if ( cause != null ) { cause.printStackTrace(); } }
protected SemanticException nonMap() { return new SemanticException( expressionDescription() + " expression did not reference map property" ); }
/** * Prints a stack trace to the specified print stream. * * @param s the print stream. */ @AllowPrintStacktrace public void printStackTrace(PrintStream s) { super.printStackTrace( s ); if ( cause != null ) { s.println( "Cause:" ); cause.printStackTrace( s ); } }
@Override public void resolve( boolean generateJoin, boolean implicitJoin, String classAlias, AST parent, AST parentPredicate) throws SemanticException { if (parent != null) { throw new SemanticException( expressionDescription() + " expression cannot be further de-referenced" ); } super.resolve(generateJoin, implicitJoin, classAlias, parent, parentPredicate); }
/** * Prints a stack trace. */ public void printStackTrace() { super.printStackTrace(); if ( cause != null ) { cause.printStackTrace(); } }
@Override protected void validateMapPropertyExpression(AST node) throws SemanticException { try { FromReferenceNode fromReferenceNode = (FromReferenceNode) node; QueryableCollection collectionPersister = fromReferenceNode.getFromElement().getQueryableCollection(); if ( !Map.class.isAssignableFrom( collectionPersister.getCollectionType().getReturnedClass() ) ) { throw new SemanticException( "node did not reference a map" ); } } catch (SemanticException se) { throw se; } catch (Throwable t) { throw new SemanticException( "node did not reference a map" ); } }
/** * Prints a stack trace. */ public void printStackTrace() { super.printStackTrace(); if ( cause != null ) { cause.printStackTrace(); } }
@Override protected void handleResultVariableRef(AST resultVariableRef) throws SemanticException { if ( isSubQuery() ) { throw new SemanticException( "References to result variables in subqueries are not supported." ); } ( (ResultVariableRefNode) resultVariableRef ).setSelectExpression( selectExpressionsByResultVariable.get( resultVariableRef.getText() ) ); }
/** * Prints a stack trace. */ public void printStackTrace() { super.printStackTrace(); if ( cause != null ) { cause.printStackTrace(); } }
private void error(String msg) throws TokenStreamException, SemanticException { Token token = LT(0); throw new SemanticException( msg, token.getFilename(), token.getLine(), token.getColumn() ); }
/** * Prints a stack trace. */ public void printStackTrace() { super.printStackTrace(); if ( cause != null ) { cause.printStackTrace(); } }
public void resolve(boolean inSelect) throws SemanticException { initializeMethodNode( this, inSelect ); if ( !isCollectionPropertyMethod() ) { throw new SemanticException( this.getText() + " is not a collection property name!" ); } AST expr = getFirstChild(); if ( expr == null ) { throw new SemanticException( this.getText() + " requires a path!" ); } resolveCollectionProperty( expr ); }