parse security JSR250 annotations at the class level
515571
private boolean parseClassSecurity(Class<?> cls, SecurityContext sc) {

        // try DenyAll
        DenyAll denyAll = cls.getAnnotation(DenyAll.class);
        if (denyAll != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Found class level @DenyAll - authorization denied for " + cls.getName());
            }
            return false;
        } else { // try RolesAllowed

            RolesAllowed rolesAllowed = cls.getAnnotation(RolesAllowed.class);
            if (rolesAllowed != null) {

                String[] theseroles = rolesAllowed.value();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(
                             tc,
                             "found RolesAllowed in class level: {} "
                                 + cls.getName(),
                             new Object[] { theseroles });
                }
                if (!ensureAuthentication(sc)) {
                    return false;
                }
                if (!isUserInRole(sc, Arrays.asList(theseroles), false)) {
                    return false;
                }
                return true;
            } else { // try PermitAll
//				PermitAll permitAll = cls.getAnnotation(PermitAll.class);
                return true;
            }

        }

    }
1086863
public String parse() {
    Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>();

    for (Class clazz : classpathScanner.findClassesToParse()) {
      if (clazz != null) {
        ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(),
          allRelevantAnnotationClasses).extractValidationRules();
        if (classValidationRules.size() > 0) {
          String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName();
          classNameToValidationRulesMap.put(name, classValidationRules);
        }
      }
    }

    return toJson(classNameToValidationRulesMap);
  }
1262477
static ReferenceTypeSignature parseClassBound(final Parser parser, final String definingClassName)
            throws ParseException {
        parser.expect(':');
        // May return null if there is no signature after ':' (class bound signature may be empty)
        return parseReferenceTypeSignature(parser, definingClassName);
    }
280578
def init_parser(self):
        

        #self.token_list = None
        #self.prev_token_lists = None

        self.valid_children = dict()
        self.valid_children['lems'] = ['component', 'componenttype',
                                       'target', 'include',
                                       'dimension', 'unit', 'assertion']
                                       
        #TODO: make this generic for any domain specific language based on LEMS
        self.valid_children['neuroml'] = ['include', 'componenttype']
                                       
        self.valid_children['componenttype'] = ['dynamics',
                                                'child', 'children',
                                                'componentreference',
                                                'exposure', 'eventport',
                                                'fixed', 'link', 'parameter',
                                                'property',
                                                'indexparameter',
                                                'path', 'requirement',
                                                'componentrequirement',
                                                'instancerequirement',
                                                'simulation', 'structure',
                                                'text', 'attachments',
                                                'constant', 'derivedparameter']
                                                
        self.valid_children['dynamics'] = ['derivedvariable',
                                           'conditionalderivedvariable',
                                           'oncondition',
                                           'onevent', 'onstart',
                                           'statevariable', 'timederivative',
                                           'kineticscheme', 'regime']
                                           
        self.valid_children['component'] = ['component']
                                           
        self.valid_children['conditionalderivedvariable'] = ['case']
        
        self.valid_children['regime'] = ['oncondition', 'onentry', 'timederivative']
        self.valid_children['oncondition'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onentry'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onevent'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onstart'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['structure'] = ['childinstance',
                                            'eventconnection',
                                            'foreach',
                                            'multiinstantiate',
                                            'with',
                                            'tunnel']
                                       
        self.valid_children['foreach'] = ['foreach', 'eventconnection']     
                                            
        self.valid_children['simulation'] = ['record', 'eventrecord', 'run',
                                             'datadisplay', 'datawriter', 'eventwriter']

        self.tag_parse_table = dict()
        #self.tag_parse_table['assertion'] = self.parse_assertion
        self.tag_parse_table['attachments'] = self.parse_attachments
        self.tag_parse_table['child'] = self.parse_child
        self.tag_parse_table['childinstance'] = self.parse_child_instance
        self.tag_parse_table['children'] = self.parse_children
        self.tag_parse_table['component'] = self.parse_component
        self.tag_parse_table['componentreference'] = self.parse_component_reference   
        self.tag_parse_table['componentrequirement'] = self.parse_component_requirement
        self.tag_parse_table['componenttype'] = self.parse_component_type
        self.tag_parse_table['constant'] = self.parse_constant
        self.tag_parse_table['datadisplay'] = self.parse_data_display
        self.tag_parse_table['datawriter'] = self.parse_data_writer
        self.tag_parse_table['eventwriter'] = self.parse_event_writer
        self.tag_parse_table['derivedparameter'] = self.parse_derived_parameter
        self.tag_parse_table['derivedvariable'] = self.parse_derived_variable
        self.tag_parse_table['conditionalderivedvariable'] = self.parse_conditional_derived_variable
        self.tag_parse_table['case'] = self.parse_case
        self.tag_parse_table['dimension'] = self.parse_dimension
        self.tag_parse_table['dynamics'] = self.parse_dynamics
        self.tag_parse_table['eventconnection'] = self.parse_event_connection
        self.tag_parse_table['eventout'] = self.parse_event_out
        self.tag_parse_table['eventport'] = self.parse_event_port
        self.tag_parse_table['exposure'] = self.parse_exposure
        self.tag_parse_table['fixed'] = self.parse_fixed
        self.tag_parse_table['foreach'] = self.parse_for_each
        self.tag_parse_table['include'] = self.parse_include
        self.tag_parse_table['indexparameter'] = self.parse_index_parameter
        self.tag_parse_table['kineticscheme'] = self.parse_kinetic_scheme
        self.tag_parse_table['link'] = self.parse_link
        self.tag_parse_table['multiinstantiate'] = self.parse_multi_instantiate
        self.tag_parse_table['oncondition'] = self.parse_on_condition
        self.tag_parse_table['onentry'] = self.parse_on_entry
        self.tag_parse_table['onevent'] = self.parse_on_event
        self.tag_parse_table['onstart'] = self.parse_on_start
        self.tag_parse_table['parameter'] = self.parse_parameter
        self.tag_parse_table['property'] = self.parse_property
        self.tag_parse_table['path'] = self.parse_path
        self.tag_parse_table['record'] = self.parse_record
        self.tag_parse_table['eventrecord'] = self.parse_event_record
        self.tag_parse_table['regime'] = self.parse_regime
        self.tag_parse_table['requirement'] = self.parse_requirement
        self.tag_parse_table['instancerequirement'] = self.parse_instance_requirement     
        self.tag_parse_table['run'] = self.parse_run
        #self.tag_parse_table['show'] = self.parse_show
        self.tag_parse_table['simulation'] = self.parse_simulation
        self.tag_parse_table['stateassignment'] = self.parse_state_assignment
        self.tag_parse_table['statevariable'] = self.parse_state_variable
        self.tag_parse_table['structure'] = self.parse_structure
        self.tag_parse_table['target'] = self.parse_target
        self.tag_parse_table['text'] = self.parse_text
        self.tag_parse_table['timederivative'] = self.parse_time_derivative
        self.tag_parse_table['transition'] = self.parse_transition
        self.tag_parse_table['tunnel'] = self.parse_tunnel
        self.tag_parse_table['unit'] = self.parse_unit
        self.tag_parse_table['with'] = self.parse_with

        self.xml_node_stack = []

        self.current_component_type = None
        self.current_dynamics = None
        self.current_regime = None
        self.current_event_handler = None
        self.current_structure = None
        self.current_simulation = None
        self.current_component = None
        
        def counter():
            count = 1
            while True:
                yield count
                count = count + 1

        self.id_counter = counter()
45440
def provider_parser(subparser):
    """"""
    subparser.add_argument("--auth-access-key",
                           help="specify ACCESS_KEY for authentication")
    subparser.add_argument("--auth-access-secret",
                           help="specify ACCESS_SECRET for authentication")
    subparser.add_argument(
        "--private-zone",
        help=("indicates what kind of hosted zone to use. If true, use "
              "only private zones. If false, use only public zones"))

    # TODO: these are only required for testing, we should figure out
    # a way to remove them & update the integration tests
    # to dynamically populate the auth credentials that are required.
    subparser.add_argument(
        "--auth-username", help="alternative way to specify the ACCESS_KEY for authentication")
    subparser.add_argument(
        "--auth-token", help="alternative way to specify the ACCESS_SECRET for authentication")
454062
protected static void registerSensitiveKeys(Class<? extends JsonPayload> cls) {
		List<Field> fields = RuntimeUtils.listFields(cls, new RuntimeUtils.FieldFilter() {
			@Override
			public boolean accept(Field field) {
				return Modifier.isStatic(field.getModifiers()) && // static fields
						field.getAnnotation(SensitiveDataKey.class) != null &&  // marked as 'sensitive'
						field.getType().equals(String.class); // with type of String
			}
		});

		if (fields.size() > 0) {
			List<String> keys = new ArrayList<>(fields.size());
			try {
				for (Field field : fields) {
					field.setAccessible(true);
					String value = (String) field.get(null);
					keys.add(value);
				}
				SENSITIVE_KEYS_LOOKUP.put(cls, keys);
			} catch (Exception e) {
				ApptentiveLog.e(e, "Exception while registering sensitive keys");
				logException(e);
			}
		}
	}
594476
protected void initSecurityConstraint(XmlParser.Node node)
    {
        try
        {
            SecurityConstraint scBase = new SecurityConstraint();
            XmlParser.Node auths = node.get("auth-constraint");
            if (auths != null)
            {
                scBase.setAuthenticate(true);
                // auth-constraint
                Iterator iter = auths.iterator("role-name");
                while (iter.hasNext())
                {
                    String role = ((XmlParser.Node) iter.next()).toString(false, true);
                    scBase.addRole(role);
                }
            }
            XmlParser.Node data = node.get("user-data-constraint");
            if (data != null)
            {
                data = data.get("transport-guarantee");
                String guarantee = data.toString(false, true).toUpperCase();
                if (guarantee == null || guarantee.length() == 0 || "NONE".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_NONE);
                else if ("INTEGRAL".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_INTEGRAL);
                else if ("CONFIDENTIAL".equals(guarantee))
                    scBase.setDataConstraint(SecurityConstraint.DC_CONFIDENTIAL);
                else
                {
                    log.warn("Unknown user-data-constraint:" + guarantee);
                    scBase.setDataConstraint(SecurityConstraint.DC_CONFIDENTIAL);
                }
            }
            Iterator iter = node.iterator("web-resource-collection");
            while (iter.hasNext())
            {
                XmlParser.Node collection = (XmlParser.Node) iter.next();
                String name = collection.getString("web-resource-name", false, true);
                SecurityConstraint sc = (SecurityConstraint) scBase.clone();
                sc.setName(name);
                Iterator iter2 = collection.iterator("http-method");
                while (iter2.hasNext())
                    sc.addMethod(((XmlParser.Node) iter2.next()).toString(false, true));
                iter2 = collection.iterator("url-pattern");
                while (iter2.hasNext())
                {
                    String url = ((XmlParser.Node) iter2.next()).toString(false, true);
                    getWebApplicationContext().addSecurityConstraint(url, sc);
                }
            }
        }
        catch (CloneNotSupportedException e)
        {
            log.fatal(e);
        }
    }
172997
public BackendSecuritySpec parseBeSecurity()
            throws BackendSecurityParserException {

        try {
            BackendSecurityDeserializer bsd =
                    new BackendSecurityDeserializer(m_encoding, m_validate);
            return bsd.deserialize(m_beSecurityPath);

        } catch (Throwable th) {
            throw new BackendSecurityParserException("[DefaultBackendSecurity] "
                    + "An error has occured in parsing the backend security "
                    + "configuration file located at \""
                    + m_beSecurityPath
                    + "\". "
                    + "The underlying error was a "
                    + th.getClass().getName()
                    + "The message was \""
                    + th.getMessage() + "\".");
        }
    }
1314464
private Object parseClassParameter(final String serializedObject) {
        Object res = null;
        try {
            res = Class.forName(serializedObject);
        } catch (final ClassNotFoundException e) {
            throw new CoreRuntimeException("Impossible to load class " + serializedObject, e);
        }
        return res;
    }
1044333
private void parseSpecs(URL url) throws MalformedURLException {
        String spec = url.getFile();

        int separator = spec.indexOf("!/");
        /*
         * REMIND: we don't handle nested JAR URLs
         */
        if (separator == -1) {
            throw new MalformedURLException("no !/ found in url spec:" + spec);
        }

        jarFileURL = new URL(spec.substring(0, separator++));
        entryName = null;

        /* if ! is the last letter of the innerURL, entryName is null */
        if (++separator != spec.length()) {
            entryName = spec.substring(separator, spec.length());
            entryName = ParseUtil.decode (entryName);
        }
    }
934629
@Override
    public void parse(ClassInfo.Builder builder) throws InvalidClassFileFormatException {
        parse((ClassNameAndSuperclassInfo.Builder) builder);

        final List<FieldDescriptor> fieldDescriptorList = new LinkedList<>();
        final List<MethodDescriptor> methodDescriptorList = new LinkedList<>();
        final TreeSet<ClassDescriptor> referencedClassSet = new TreeSet<>();
        javaClass.accept(new AnnotationVisitor() {
            @Override
            public void visit(Method obj) {
                methodDescriptorList.add(parseMethod(obj));
            }

            @Override
            public void visit(Field obj) {
                fieldDescriptorList.add(parseField(obj));
            }

            @Override
            public void visit(ConstantClass obj) {
                @SlashedClassName
                String className = obj.getBytes(javaClass.getConstantPool());
                if (className.indexOf('[') >= 0) {
                    ClassParser.extractReferencedClassesFromSignature(referencedClassSet, className);
                } else if (ClassName.isValidClassName(className)) {
                    referencedClassSet.add(DescriptorFactory.instance().getClassDescriptor(className));
                }
            }

            @Override
            public void visit(ConstantNameAndType obj) {
                String signature = obj.getSignature(javaClass.getConstantPool());
                ClassParser.extractReferencedClassesFromSignature(referencedClassSet, signature);
            }
        });

    }
508689
private Description checkAnnotations(
      Tree tree,
      int treePos,
      List<? extends AnnotationTree> annotations,
      Comment danglingJavadoc,
      int firstModifierPos,
      int lastModifierPos,
      VisitorState state) {
    SuggestedFix.Builder builder = SuggestedFix.builder();
    List<AnnotationTree> moveBefore = new ArrayList<>();
    List<AnnotationTree> moveAfter = new ArrayList<>();

    boolean annotationProblem = false;
    for (AnnotationTree annotation : annotations) {
      int annotationPos = ((JCTree) annotation).getStartPosition();
      if (annotationPos <= firstModifierPos) {
        continue;
      }
      AnnotationType annotationType =
          ASTHelpers.getAnnotationType(annotation, getSymbol(tree), state);
      if (annotationPos >= lastModifierPos) {
        if (tree instanceof ClassTree || annotationType == AnnotationType.DECLARATION) {
          annotationProblem = true;
          moveBefore.add(annotation);
        }
      } else {
        annotationProblem = true;
        if (tree instanceof ClassTree
            || annotationType == AnnotationType.DECLARATION
            || annotationType == null) {
          moveBefore.add(annotation);
        } else {
          moveAfter.add(annotation);
        }
      }
    }
    if (annotationProblem) {
      for (AnnotationTree annotation : moveBefore) {
        builder.delete(annotation);
      }
      for (AnnotationTree annotation : moveAfter) {
        builder.delete(annotation);
      }
      String javadoc =
          danglingJavadoc == null ? "" : removeJavadoc(state, treePos, danglingJavadoc, builder);
      builder
          .replace(
              firstModifierPos,
              firstModifierPos,
              String.format("%s%s ", javadoc, joinSource(state, moveBefore)))
          .replace(
              lastModifierPos, lastModifierPos, String.format("%s ", joinSource(state, moveAfter)));
      ImmutableList<String> names =
          annotations.stream()
              .map(ASTHelpers::getSymbol)
              .filter(Objects::nonNull)
              .map(Symbol::getSimpleName)
              .map(a -> "@" + a)
              .collect(toImmutableList());
      String flattened = names.stream().collect(joining(", "));
      String isAre = names.size() > 1 ? "are not type annotations" : "is not a type annotation";
      String message =
          String.format(
              "%s %s, so should appear before any modifiers and after Javadocs.", flattened, isAre);
      return buildDescription(tree).setMessage(message).addFix(builder.build()).build();
    }
    return NO_MATCH;
  }
306185
static Object callSecurely(final CodeSource codeSource, Callable callable,
            Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
    {
        final Thread thread = Thread.currentThread();
        // Run in doPrivileged as we might be checked for "getClassLoader"
        // runtime permission
        final ClassLoader classLoader = (ClassLoader)AccessController.doPrivileged(
            new PrivilegedAction<Object>() {
                @Override
                public Object run() {
                    return thread.getContextClassLoader();
                }
            });
        Map<ClassLoader,SoftReference<SecureCaller>> classLoaderMap;
        synchronized(callers)
        {
            classLoaderMap = callers.get(codeSource);
            if(classLoaderMap == null)
            {
                classLoaderMap = new WeakHashMap<ClassLoader,SoftReference<SecureCaller>>();
                callers.put(codeSource, classLoaderMap);
            }
        }
        SecureCaller caller;
        synchronized(classLoaderMap)
        {
            SoftReference<SecureCaller> ref = classLoaderMap.get(classLoader);
            if (ref != null) {
                caller = ref.get();
            } else {
                caller = null;
            }
            if (caller == null) {
                try
                {
                    // Run in doPrivileged as we'll be checked for
                    // "createClassLoader" runtime permission
                    caller = (SecureCaller)AccessController.doPrivileged(
                            new PrivilegedExceptionAction<Object>()
                    {
                        @Override
                        public Object run() throws Exception
                        {
                            ClassLoader effectiveClassLoader;
                            Class<?> thisClass = getClass();
                            if(classLoader.loadClass(thisClass.getName()) != thisClass) {
                                effectiveClassLoader = thisClass.getClassLoader();
                            } else {
                                effectiveClassLoader = classLoader;
                            }
                            SecureClassLoaderImpl secCl =
                                new SecureClassLoaderImpl(effectiveClassLoader);
                            Class<?> c = secCl.defineAndLinkClass(
                                    SecureCaller.class.getName() + "Impl",
                                    secureCallerImplBytecode, codeSource);
                            return c.newInstance();
                        }
                    });
                    classLoaderMap.put(classLoader, new SoftReference<SecureCaller>(caller));
                }
                catch(PrivilegedActionException ex)
                {
                    throw new UndeclaredThrowableException(ex.getCause());
                }
            }
        }
        return caller.call(callable, cx, scope, thisObj, args);
    }
472530
private <A extends Annotation, AS extends Annotation> void processClassAnnotations(int processorIndex,
                                                                                       InjectionProcessorProvider<A, AS> provider,
                                                                                       Class<?> klass)
                    throws InjectionException
    {
        Class<A> annClass = provider.getAnnotationClass();
        if (annClass != null)
        {
            A ann = klass.getAnnotation(annClass);
            if (ann != null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "found class annotation " + toStringSecure(ann));

                InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider);
                addOrMergeInjectionBinding(processorIndex, processor, klass, null, ann);
            }

            Class<AS> pluralAnnClass = provider.getAnnotationsClass();
            if (pluralAnnClass != null)
            {
                AS pluralAnn = klass.getAnnotation(pluralAnnClass);
                if (pluralAnn != null)
                {
                    InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider);

                    A[] singleAnns = processor.getAnnotations(pluralAnn);
                    if (singleAnns != null)
                    {
                        for (A singleAnn : singleAnns)
                        {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                Tr.debug(tc, "found plural class annotation " + toStringSecure(singleAnn));
                            addOrMergeInjectionBinding(processorIndex, processor, klass, null, singleAnn);
                        }
                    }
                }
            }
        }
    }
607902
private void parseUsersAuthentication(final XMLExtendedStreamReader reader,
                                          final ModelNode realmAddress, final List<ModelNode> list)
            throws XMLStreamException {
        final ModelNode usersAddress = realmAddress.clone().add(AUTHENTICATION, USERS);
        list.add(Util.getEmptyOperation(ADD, usersAddress));

        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            requireNamespace(reader, namespace);
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case USER: {
                    parseUser(reader, usersAddress, list);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }
922953
private int checkClass(final ClassReader reader, Pattern suppressAnnotationsPattern) throws ForbiddenApiException {
    final String className = Type.getObjectType(reader.getClassName()).getClassName();
    final ClassScanner scanner = new ClassScanner(this, forbiddenSignatures, suppressAnnotationsPattern); 
    try {
      reader.accept(scanner, ClassReader.SKIP_FRAMES);
    } catch (RelatedClassLoadingException rcle) {
      final Exception cause = rcle.getException();
      final StringBuilder msg = new StringBuilder()
          .append("Check for forbidden API calls failed while scanning class '")
          .append(className)
          .append('\'');
      final String source = scanner.getSourceFile();
      if (source != null) {
        msg.append(" (").append(source).append(')');
      }
      msg.append(": ").append(cause);
      msg.append(" (while looking up details about referenced class '").append(rcle.getClassName()).append("')");
      assert cause != null && (cause instanceof IOException || cause instanceof ClassNotFoundException);
      throw new ForbiddenApiException(msg.toString(), cause);
    }
    final List<ForbiddenViolation> violations = scanner.getSortedViolations();
    final Pattern splitter = Pattern.compile(Pattern.quote(ForbiddenViolation.SEPARATOR));
    for (final ForbiddenViolation v : violations) {
      for (final String line : splitter.split(v.format(className, scanner.getSourceFile()))) {
        logger.error(line);
      }
    }
    return violations.size();
  }
44982
protected void parseHeaderElements(Element actionElement, AbstractMessageContentBuilder messageBuilder, List<ValidationContext> validationContexts) {
        Element headerElement = DomUtils.getChildElementByTagName(actionElement, "header");
        Map<String, Object> messageHeaders = new LinkedHashMap<>();

        if (headerElement != null) {
            List<?> elements = DomUtils.getChildElementsByTagName(headerElement, "element");
            for (Iterator<?> iter = elements.iterator(); iter.hasNext();) {
                Element headerValue = (Element) iter.next();
                
                String name = headerValue.getAttribute("name");
                String value = headerValue.getAttribute("value");
                String type = headerValue.getAttribute("type");

                if (StringUtils.hasText(type)) {
                    value = MessageHeaderType.createTypedValue(type, value);
                }
                
                messageHeaders.put(name, value);
            }
            
            List<Element> headerDataElements = DomUtils.getChildElementsByTagName(headerElement, "data");
            for (Element headerDataElement : headerDataElements) {
                messageBuilder.getHeaderData().add(DomUtils.getTextValue(headerDataElement).trim());
            }

            List<Element> headerResourceElements = DomUtils.getChildElementsByTagName(headerElement, "resource");
            for (Element headerResourceElement : headerResourceElements) {
                String charset = headerResourceElement.getAttribute("charset");
                messageBuilder.getHeaderResources().add(headerResourceElement.getAttribute("file") + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : ""));
            }

            // parse fragment with xs-any element
            List<Element> headerFragmentElements = DomUtils.getChildElementsByTagName(headerElement, "fragment");
            for (Element headerFragmentElement : headerFragmentElements) {
                List<Element> fragment = DomUtils.getChildElements(headerFragmentElement);
                if (!CollectionUtils.isEmpty(fragment)) {
                    messageBuilder.getHeaderData().add(PayloadElementParser.parseMessagePayload(fragment.get(0)));
                }
            }

            messageBuilder.setMessageHeaders(messageHeaders);

            if (headerElement.hasAttribute("ignore-case")) {
                boolean ignoreCase = Boolean.valueOf(headerElement.getAttribute("ignore-case"));
                validationContexts.stream().filter(context -> context instanceof HeaderValidationContext)
                                            .map(context -> (HeaderValidationContext) context)
                                            .forEach(context -> context.setHeaderNameIgnoreCase(ignoreCase));
            }
        }
    }