Buggy code:
public class JoinNode extends TableOperatorNode { public static final int INNERJOIN = 1 ; public static final int CROSSJOIN = 2 ; public static final int LEFTOUTERJOIN = 3 ; public static final int RIGHTOUTERJOIN = 4 ; public static final int FULLOUTERJOIN = 5 ; public static final int UNIONJOIN = 6 ; private boolean optimized ; private PredicateList leftPredicateList ; private PredicateList rightPredicateList ; protected boolean flattenableJoin = true ; Vector aggregateVector ; SubqueryList subqueryList ; ValueNode joinClause ; boolean joinClauseNormalized ; PredicateList joinPredicates ; ResultColumnList usingClause ; public void init ( Object leftResult , Object rightResult , Object onClause , Object usingClause , Object selectList , Object tableProperties ) throws StandardException { } public CostEstimate optimizeIt ( Optimizer optimizer , OptimizablePredicateList predList , CostEstimate outerCost , RowOrdering rowOrdering ) throws StandardException { } public boolean pushOptPredicate ( OptimizablePredicate optimizablePredicate ) throws StandardException { } public Optimizable modifyAccessPath ( JBitSet outerTables ) throws StandardException { } protected void adjustNumberOfRowsReturned ( CostEstimate costEstimate ) { } public ResultColumnList getAllResultColumns ( TableName allTableName ) throws StandardException { } private ResultColumnList getAllResultColumnsNoUsing ( TableName allTableName ) throws StandardException { } public ResultColumn getMatchingColumn ( ColumnReference columnReference ) throws StandardException { ResultSetNode logicalLeftRS = getLogicalLeftResultSet ( ) ; ResultSetNode logicalRightRS = getLogicalRightResultSet ( ) ; ResultColumn leftRC = null ; ResultColumn resultColumn = null ; ResultColumn rightRC = null ; ResultColumn usingRC = null ; leftRC = logicalLeftRS . getMatchingColumn ( columnReference ) ; if ( leftRC != null ) { resultColumn = leftRC ; if ( ( usingClause ) != null ) { usingRC = usingClause . getResultColumn ( leftRC . getName ( ) ) ; } } if ( usingRC == null ) { rightRC = logicalRightRS . getMatchingColumn ( columnReference ) ; } if ( rightRC != null ) { if ( leftRC != null ) { <START_BUG> throw StandardException . newException ( LANG_AMBIGUOUS_COLUMN_NAME , columnReference . getFullColumnName ( ) ) ; <END_BUG> } resultColumn = rightRC ; } if ( ( resultColumns ) != null ) { int rclSize = resultColumns . size ( ) ; for ( int index = 0 ; index < rclSize ; index ++ ) { ResultColumn rc = ( ( ResultColumn ) ( resultColumns . elementAt ( index ) ) ) ; VirtualColumnNode vcn = ( ( VirtualColumnNode ) ( rc . getExpression ( ) ) ) ; if ( resultColumn == ( vcn . getSourceColumn ( ) ) ) { resultColumn = rc ; break ; } } } return resultColumn ; } public void bindResultColumns ( FromList fromListParam ) throws StandardException { } public void bindResultColumns ( TableDescriptor targetTableDescriptor , FromVTI targetVTI , ResultColumnList targetColumnList , DMLStatementNode statement , FromList fromListParam ) throws StandardException { } private void buildRCL ( ) throws StandardException { } private void deferredBindExpressions ( FromList fromListParam ) throws StandardException { } public ResultSetNode preprocess ( int numTables , GroupByList gbl , FromList fromList ) throws StandardException { } void projectResultColumns ( ) throws StandardException { } public void normExpressions ( ) throws StandardException { } public void pushExpressions ( PredicateList outerPredicateList ) throws StandardException { } protected void pushExpressionsToLeft ( PredicateList outerPredicateList ) throws StandardException { } private void pushExpressionsToRight ( PredicateList outerPredicateList ) throws StandardException { } private void grabJoinPredicates ( PredicateList outerPredicateList ) throws StandardException { } public FromList flatten ( ResultColumnList rcl , PredicateList outerPList , SubqueryList sql , GroupByList gbl ) throws StandardException { } public boolean LOJ_reorderable ( int numTables ) throws StandardException { } public FromTable transformOuterJoins ( ValueNode predicateTree , int numTables ) throws StandardException { } public void generate ( ActivationClassBuilder acb , MethodBuilder mb ) throws StandardException { } public void generateCore ( ActivationClassBuilder acb , MethodBuilder mb , int joinType ) throws StandardException { } protected void generateCore ( ActivationClassBuilder acb , MethodBuilder mb , int joinType , ValueNode joinClause , SubqueryList subquerys ) throws StandardException { } private int getJoinArguments ( ActivationClassBuilder acb , MethodBuilder mb , ValueNode joinClause ) throws StandardException { } protected void oneRowRightSide ( ActivationClassBuilder acb , MethodBuilder mb ) throws StandardException { } protected int getNumJoinArguments ( ) { } protected int addOuterJoinArguments ( ActivationClassBuilder acb , MethodBuilder mb ) throws StandardException { } public static String joinTypeToString ( int joinType ) { } protected PredicateList getLeftPredicateList ( ) throws StandardException { } protected PredicateList getRightPredicateList ( ) throws StandardException { } public int updateTargetLockMode ( ) { } void notFlattenableJoin ( ) { } public boolean isFlattenableJoinNode ( ) { } boolean isOrderedOn ( ColumnReference [ ] crs , boolean permuteOrdering , Vector fbtVector ) throws StandardException { } public void printSubNodes ( int depth ) { } void setSubqueryList ( SubqueryList subqueryList ) { } void setAggregateVector ( Vector aggregateVector ) { } ResultSetNode getLogicalLeftResultSet ( ) { } ResultSetNode getLogicalRightResultSet ( ) { } public Visitable accept ( Visitor v ) throws StandardException { } public JBitSet LOJgetReferencedTables ( int numTables ) throws StandardException { } }

Fix:
throw StandardException . newException ( LANG_AMBIGUOUS_COLUMN_NAME , columnReference . getSQLColumnName ( ) ) ;