Policy with 'Layout' 'Lax' having no subelements leads to a 
NullPointerException in PolicyEngine
------------------------------------------------------------------------------------------------

                 Key: RAMPART-143
                 URL: https://issues.apache.org/jira/browse/RAMPART-143
             Project: Rampart
          Issue Type: Bug
          Components: rampart-policy
    Affects Versions: 1.3
         Environment: Windows Vista 32bit(XP32bit, Java 1.4.2, Eclipse 3.3
            Reporter: Heinz Zerbes


I'm using a quit simple policy with Rampart. The Element 'Layout' having 
subelement 'Lax' wich itself has no more subelements or attributes, leades to a 
NullPointerException in PolicyEngine.processOperationElement:164. THe fact that 
'Lax' has no subelements is not checked, thus the usage of this null 
(sub)element leads to a NullPointerException. The specification says explicitly 
that 'Lax' can be empty.

The code from PolicyEngine.java:
    private static PolicyOperator processOperationElement(
            OMElement operationElement, PolicyOperator operator) {

        if (Constants.TYPE_POLICY == operator.getType()) {
            Policy policyOperator = (Policy) operator;

            OMAttribute attribute;
            OMNamespace namespace;
            QName key;

// <<<<<<<<<<<<<<<<<< my comment: operationElement ist null because of missing 
subelement, tus next statement fails >>>>>>>>>>>>
            for (Iterator iterator = operationElement.getAllAttributes(); 
iterator
                    .hasNext();) {
                attribute = (OMAttribute) iterator.next();
                namespace = attribute.getNamespace();

                if (namespace == null) {
                    key = new QName(attribute.getLocalName());

                } else if (namespace.getPrefix() == null) {
                    key = new QName(namespace.getNamespaceURI(), attribute
                            .getLocalName());

                } else {
                    key = new QName(namespace.getNamespaceURI(), attribute
                            .getLocalName(), namespace.getPrefix());
                }

                policyOperator.addAttribute(key, attribute.getAttributeValue());
            }
        }

        OMElement childElement;



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to