Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-8816

Coverity static analysis, Dereference null return value, CredentialStoreAliasDefinition (elytron-subsystem)

    XMLWordPrintable

Details

    Description

      Coverity found 2 possible occurences of dereferencing null. Method propertyAliasFromOperation(final ModelNode operation) can return null.
      And return value of propertyAliasFromOperation(final ModelNode operation) is dereferenced in transformOperationAddress(final ModelNode operation) and sameAlias(final OperationContext context, final ModelNode operation)

          private static void transformOperationAddress(final ModelNode operation) {
              Property alias = propertyAliasFromOperation(operation);
              String newAlias = alias.getValue().asString().toLowerCase(Locale.ROOT);
              alias.getValue().set(newAlias);
          }
      
          private static boolean sameAlias(final OperationContext context, final ModelNode operation) {
              String contextAlias = context.getCurrentAddress().getLastElement().getValue();
              String operationAlias = propertyAliasFromOperation(operation).getValue().asString();
              return  operationAlias.equals(contextAlias);
          }
      
          private static Property propertyAliasFromOperation(final ModelNode operation) {
              ModelNode address = operation.get(ModelDescriptionConstants.OP_ADDR);
              List<Property> list = address.asPropertyList();
              Property alias = null;
              for (Property p: list) {
                  if (ElytronDescriptionConstants.ALIAS.equals(p.getName())) {
                      alias = p;
                      break;
                  }
              }
              return alias;
          }
      

      Add null check into transformOperationAddress(final ModelNode operation) and sameAlias(final OperationContext context, final ModelNode operation)

      Attachments

        Issue Links

          Activity

            Public project attachment banner

              context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
              current Project key: JBEAP

              People

                rhn-support-ivassile Ilia Vassilev
                mchoma@redhat.com Martin Choma
                Martin Choma Martin Choma
                Martin Choma Martin Choma
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: