morten      01/06/15 02:57:12

  Modified:    java/src/org/apache/xalan/xsltc/compiler LogicalExpr.java
  Log:
  Fix to prevent compile-time null-pointer exceptions for certain logical
  expressions. Some nexted AND-expressions would cause this error because
  their true-list would not be backpatched. This would result in an
  instruction list with one or more branch instructions with no target,
  such as a GOTO(null) or an IFEQ(null) instruction.
  PR:           none, bug found in test run and fixed immediately
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.5       +7 -7      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java
  
  Index: LogicalExpr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LogicalExpr.java  2001/06/13 10:13:30     1.4
  +++ LogicalExpr.java  2001/06/15 09:57:12     1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: LogicalExpr.java,v 1.4 2001/06/13 10:13:30 morten Exp $
  + * @(#)$Id: LogicalExpr.java,v 1.5 2001/06/15 09:57:12 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -183,18 +183,18 @@
            _falseList.append(_right._falseList.append(_left._falseList));
   
            // Special case for OR-expression as a left child of AND
  -         if (_left instanceof LogicalExpr) {
  -             LogicalExpr left = (LogicalExpr)_left;
  -             if (left.getOp() == OR) left.backPatchTrueList(middle);
  +         if ((_left instanceof LogicalExpr) &&
  +             (((LogicalExpr)_left).getOp() == OR)) {
  +             ((LogicalExpr)_left).backPatchTrueList(middle);
            }
            else {
                _trueList.append(_left._trueList);
            }
   
            // Special case for OR-expression as a right child of AND
  -         if (_right instanceof LogicalExpr) {
  -             LogicalExpr right = (LogicalExpr)_right;
  -             if (right.getOp() == OR) right.backPatchTrueList(after);
  +         if ((_right instanceof LogicalExpr) &&
  +             (((LogicalExpr)_right).getOp() == OR)) {
  +             ((LogicalExpr)_right).backPatchTrueList(after);
            }
            else {
                _trueList.append(_right._trueList);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to