Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1554

An incomplete fix for the NPE bugs in IdentityConstraint.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Won't Fix
    • 2.6.2
    • None
    • Other

    Description

      The fix revision 320527 was aimed to remove an NPE bug on the "this.fSelector" in the method "getSelectorStr" of the file

      "/xerces/java/trunk/src/org/apache/xerces/impl/xs/identity/IdentityConstraint.java" , but it is incomplete.
      Since the "this.fSelector" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods.

      The buggy code locations the same fix needs to be applied at are as bellows:

      Line 148 of the method "equals";

      public boolean equals(IdentityConstraint id)

      { boolean areEqual = fIdentityConstraintName.equals(id.fIdentityConstraintName); if(!areEqual) return false; areEqual = fSelector.toString().equals(id.fSelector.toString()); if(!areEqual) return false; areEqual = (fFieldCount == id.fFieldCount); if(!areEqual) return false; for(int i=0; i<fFieldCount; i++) if(!fFields[i].toString().equals(id.fFields[i].toString())) return false; return true; }

      // equals

      Attachments

        1. attP006.xsd
          0.7 kB
          Guangtai Liang

        Activity

          People

            Unassigned Unassigned
            guangtai Guangtai Liang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified