metro
  1. metro
  2. METRO-8

Inconsistency in AsymmetricBindingProcessor

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: current
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      8

      Description

      AsymmetricBindingProcessor.process method reads:

      public void process()throws PolicyException{
      Token st = getSignatureToken();
      Token et = getEncryptionToken();
      if(st != null)

      { primarySP = new SignaturePolicy(); .... }

      if(et != null)

      { primaryEP = new EncryptionPolicy(); .... }

      ....
      addPrimaryTargets();

      and the addPrimaryTargets method reads:

      protected void addPrimaryTargets()throws PolicyException{
      SignaturePolicy.FeatureBinding spFB =
      (SignaturePolicy.FeatureBinding)primarySP.getFeatureBinding();
      EncryptionPolicy.FeatureBinding epFB =
      (EncryptionPolicy.FeatureBinding)primaryEP.getFeatureBinding();

      So this code results in NPE in addPrimaryTargets() if either 'st' or 'et' are
      null in the process method.

      Therefore this code is inconsistent — if a signature token and an encryption
      token has to be always present, then such an error check should be performed
      earlier (in the constructor) and a graceful error message should be reported to
      the user, pointing to the wrong WSDL.

      If either of those can be indeed null, then the addPrimaryTargets() method
      shouldn't choke with NPE.

        Activity

        Hide
        Martin Grebac added a comment -

        This I see fixed in current version of the code.

        Show
        Martin Grebac added a comment - This I see fixed in current version of the code.

          People

          • Assignee:
            Martin Grebac
            Reporter:
            kohsuke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: