private void validateInterceptorBindings() throws EJBConfigurationException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.entry(tc, "validateInterceptorBindings");
        }

        // d630872 - Build a list of methods that can be the target of an
        // interceptor.  This includes all business methods (AroundInvoke) and
        // all timer methods (AroundTimeout).
        List<Method> interceptableMethods = new ArrayList<Method>(ivEJBMethodInfoMap.keySet());
        if (ivBmd.timedMethodInfos != null) // d630872.1
        {
            for (EJBMethodInfoImpl info : ivBmd.timedMethodInfos)
            {
                interceptableMethods.add(info.getMethod());
            }
        }

        // For each InterceptorBinding from WCCM.
        for (EJBInterceptorBinding binding : ivInterceptorBinding)
        {
            String ejbName = binding.getEJBName();
            EJBInterceptorBinding.BindingStyle bindingStyle = binding.getBindingStyle();
            if (ejbName.equals("*"))
            {
                // Style 1 binding. Is this the first style 1 InterceptorBinding?
                if (ivModuleInterceptorBinding == null)
                {
                    // Save reference to module-level binding for future use.
                    ivModuleInterceptorBinding = binding;
                }
                else
                {
                    // CNTR0245E: The {0} module of the {1) application has more than one style 1 interceptor-binding
                    // in the deployment descriptor. Only one style 1 interceptor-binding is allowed.

                    J2EEName j2eeName = ivEJBModuleMetaDataImpl.getJ2EEName();
                    String message = "The " + j2eeName.getModule() + " module of the " + j2eeName.getApplication()
                                     + " application has more than one style 1 interceptor-binding in the deployment"
                                     + " deployment descriptor. Only one style 1 interceptor-binding is allowed";
                    Tr.error(tc, "DUPLICATE_STYLE_1_INTERCEPTOR_BINDING_CNTR0245E"
                             , new Object[] { j2eeName.getModule(), j2eeName.getApplication() }); //d472939
                    throw new EJBConfigurationException(message); // d463727
                }
            }
            else
            {
                // Binding not for the module, so only process those interceptor bindings that are
                // for the EJB class specified by the caller.
                if (ejbName.equals(ivEjbName))
                {
                    if (bindingStyle == EJBInterceptorBinding.BindingStyle.STYLE2)
                    {
                        // This is a style 2 interceptor-binding that applies to the class.
                        // Is this the first style 2 interceptor binding for this EJB?
                        if (ivClassInterceptorBinding == null)
                        {
                            // Yep, save reference style 2 for future use.
                            ivClassInterceptorBinding = binding;
                        }
                        else
                        {
                            // Nope, then we need to validate and merge second style 2
                            // with the first style 2 interceptor binding.
                            EJBInterceptorBinding binding1 = ivClassInterceptorBinding; // d457352
                            ivClassInterceptorBinding = validateAndMergeStyle2Bindings(binding1, binding); // d457352
                        }
                    }
                    else if (bindingStyle == EJBInterceptorBinding.BindingStyle.STYLE3)
                    {
                        // This is a style 3 interceptor-binding that applies to all business
                        // methods with the method name specified by method-name element.
                        // Put style 3 interceptor binding into the map.
                        String methodName = binding.getMethodName();
                        EJBInterceptorBinding oldBinding = ivStyle3InterceptorBindingMap.put(methodName, binding);

                        // Did the put replace an existing map entry?
                        if (oldBinding != null)
                        {
                            // Yep, tthis was NOT the first style 3 binding for this EJB.  We need to validate and
                            // merge second style 3 with the first style 3 interceptor binding.
                            EJBInterceptorBinding merged;
                            merged = validateAndMergeStyle3Or4Bindings(methodName, null, oldBinding, binding); // d457352

                            // No exception was thrown, so merger is valid. Replace map entry with the merged binding.
                            ivStyle3InterceptorBindingMap.put(methodName, merged); // d457352
                        }
                        else
                        {
                            // Nope, this must be the first style 3 binding for this EJB. We must
                            // verify there is at least 1 business method exist by this method name.
                            boolean notFound = true;
                            for (Method m : interceptableMethods) // d630872
                            {
                                // Does method name match?
                                if (m.getName().equals(methodName))
                                {
                                    // Yep, indicate we found a business method and exit the loop.
                                    notFound = false;
                                    break;
                                }
                            }

                            // Log error and throw exception if business method was not found.
                            if (notFound)
                            {
                                if (isTraceOn && tc.isDebugEnabled())
                                {
                                    Tr.debug(tc, "method not found for interceptor binding");
                                    binding.dump();
                                }

                                // CNTR0244E: The {0} method name is not found in one of the business interfaces
                                // of the {1} enterprise bean. A style {2} interceptor-binding element requires
                                // the method to be a business method of the enterprise bean.
                                String j2eeName = ivJ2EEName.toString();
                                Tr.error(tc, "BUSINESS_METHOD_NOT_FOUND_FOR_INTERCEPTOR_BINDING_CNTR0244E"
                                         , new Object[] { methodName, j2eeName, "3" }); //d472939

                                String message = "The " + methodName + " method name is not found "
                                                 + " in one of the business interfaces of the " + j2eeName
                                                 + " enterprise bean. A style 3 interceptor-binding element requires"
                                                 + " the method to be a business method of the enterprise bean";
                                throw new EJBConfigurationException(message); // d463727
                            }
                        }
                    }
                    else if (bindingStyle == EJBInterceptorBinding.BindingStyle.STYLE4)
                    {
                        // This is a style 4 interceptor-binding that applies to a business method
                        // with a specific method signature. Verify it does not duplicate a style 3 binding.
                        String methodName = binding.getMethodName();
                        List<String> methodParms = binding.getMethodParms();
                        String signature = methodSignature(methodName, methodParms);
                        signature = normalizeSignature(signature.trim());

                        // d472972 start
                        // Put style 4 interceptor binding into the map.
                        EJBInterceptorBinding oldBinding = ivStyle4InterceptorBindingMap.put(signature, binding);

                        // Did the put replace an existing map entry?
                        if (oldBinding != null)
                        {
                            // Yep, this was NOT the first style 4 binding for this EJB method.  We need to validate and
                            // merge second style 4 with the first style 4 interceptor binding.
                            EJBInterceptorBinding merged;
                            merged = validateAndMergeStyle3Or4Bindings(methodName, signature, oldBinding, binding); // d457352

                            // No exception was thrown, so merger is valid. Replace map entry with the merged binding.
                            if (isTraceOn && tc.isDebugEnabled())
                            {
                                Tr.debug(tc, "replaced style 4 for method signature: " + signature);
                            }
                            ivStyle4InterceptorBindingMap.put(signature, merged);
                        }
                        else
                        {
                            // This is first style 4 binding for this EJB method.
                            // Verify there is a business method by this method name and signature.
                            if (isTraceOn && tc.isDebugEnabled())
                            {
                                Tr.debug(tc, "added style 4 for method signature: " + signature);
                            }
                            boolean notFound = true;
                            for (Method m : interceptableMethods) // d630872
                            {
                                // Does method name and signature match?
                                if (m.getName().equals(methodName))
                                {
                                    String methodSignature = MethodAttribUtils.methodSignature(m);
                                    if (signature.equals(methodSignature))
                                    {
                                        // Yep, indicate we found the business method and exit the loop.
                                        notFound = false;
                                        break;
                                    }
                                }
                            }

                            // Log error and throw exception if business method was not found.
                            if (notFound)
                            {
                                if (isTraceOn && tc.isDebugEnabled())
                                {
                                    Tr.debug(tc, "method not found for interceptor binding");
                                    binding.dump();
                                }

                                // CNTR0244E: The {0} method name is not found in one of the business interfaces
                                // of the {1} enterprise bean. A style {2} interceptor-binding element requires
                                // the method to be a business method of the enterprise bean.
                                String j2eeName = ivJ2EEName.toString();
                                Tr.error(tc, "BUSINESS_METHOD_NOT_FOUND_FOR_INTERCEPTOR_BINDING_CNTR0244E"
                                         , new Object[] { methodName, j2eeName, "4" }); //d472939

                                String message = "The " + methodName + " method name is not found "
                                                 + " in one of the business interfaces of the " + j2eeName
                                                 + " enterprise bean. A style 4 interceptor-binding element requires"
                                                 + " the method to be a business method of the enterprise bean";
                                throw new EJBConfigurationException(message); // d463727
                            }
                        } // d472972 end
                    }
                }
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.exit(tc, "validateInterceptorBindings");
        }
    }
private void validateInterceptorBindings ( ) throws EJBConfigurationException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "validateInterceptorBindings" ) ; } List < Method > interceptableMethods = new ArrayList < Method > ( ivEJBMethodInfoMap . keySet ( ) ) ; if ( ivBmd . timedMethodInfos != null ) { for ( EJBMethodInfoImpl info : ivBmd . timedMethodInfos ) { interceptableMethods . add ( info . getMethod ( ) ) ; } } for ( EJBInterceptorBinding binding : ivInterceptorBinding ) { String ejbName = binding . getEJBName ( ) ; EJBInterceptorBinding . BindingStyle bindingStyle = binding . getBindingStyle ( ) ; if ( ejbName . equals ( "*" ) ) { if ( ivModuleInterceptorBinding == null ) { ivModuleInterceptorBinding = binding ; } else { J2EEName j2eeName = ivEJBModuleMetaDataImpl . getJ2EEName ( ) ; String message = "The " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application has more than one style 1 interceptor-binding in the deployment" + " deployment descriptor. Only one style 1 interceptor-binding is allowed" ; Tr . error ( tc , "DUPLICATE_STYLE_1_INTERCEPTOR_BINDING_CNTR0245E" , new Object [ ] { j2eeName . getModule ( ) , j2eeName . getApplication ( ) } ) ; throw new EJBConfigurationException ( message ) ; } } else { if ( ejbName . equals ( ivEjbName ) ) { if ( bindingStyle == EJBInterceptorBinding . BindingStyle . STYLE2 ) { if ( ivClassInterceptorBinding == null ) { ivClassInterceptorBinding = binding ; } else { EJBInterceptorBinding binding1 = ivClassInterceptorBinding ; ivClassInterceptorBinding = validateAndMergeStyle2Bindings ( binding1 , binding ) ; } } else if ( bindingStyle == EJBInterceptorBinding . BindingStyle . STYLE3 ) { String methodName = binding . getMethodName ( ) ; EJBInterceptorBinding oldBinding = ivStyle3InterceptorBindingMap . put ( methodName , binding ) ; if ( oldBinding != null ) { EJBInterceptorBinding merged ; merged = validateAndMergeStyle3Or4Bindings ( methodName , null , oldBinding , binding ) ; ivStyle3InterceptorBindingMap . put ( methodName , merged ) ; } else { boolean notFound = true ; for ( Method m : interceptableMethods ) { if ( m . getName ( ) . equals ( methodName ) ) { notFound = false ; break ; } } if ( notFound ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "method not found for interceptor binding" ) ; binding . dump ( ) ; } String j2eeName = ivJ2EEName . toString ( ) ; Tr . error ( tc , "BUSINESS_METHOD_NOT_FOUND_FOR_INTERCEPTOR_BINDING_CNTR0244E" , new Object [ ] { methodName , j2eeName , "3" } ) ; String message = "The " + methodName + " method name is not found " + " in one of the business interfaces of the " + j2eeName + " enterprise bean. A style 3 interceptor-binding element requires" + " the method to be a business method of the enterprise bean" ; throw new EJBConfigurationException ( message ) ; } } } else if ( bindingStyle == EJBInterceptorBinding . BindingStyle . STYLE4 ) { String methodName = binding . getMethodName ( ) ; List < String > methodParms = binding . getMethodParms ( ) ; String signature = methodSignature ( methodName , methodParms ) ; signature = normalizeSignature ( signature . trim ( ) ) ; EJBInterceptorBinding oldBinding = ivStyle4InterceptorBindingMap . put ( signature , binding ) ; if ( oldBinding != null ) { EJBInterceptorBinding merged ; merged = validateAndMergeStyle3Or4Bindings ( methodName , signature , oldBinding , binding ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "replaced style 4 for method signature: " + signature ) ; } ivStyle4InterceptorBindingMap . put ( signature , merged ) ; } else { if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "added style 4 for method signature: " + signature ) ; } boolean notFound = true ; for ( Method m : interceptableMethods ) { if ( m . getName ( ) . equals ( methodName ) ) { String methodSignature = MethodAttribUtils . methodSignature ( m ) ; if ( signature . equals ( methodSignature ) ) { notFound = false ; break ; } } } if ( notFound ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "method not found for interceptor binding" ) ; binding . dump ( ) ; } String j2eeName = ivJ2EEName . toString ( ) ; Tr . error ( tc , "BUSINESS_METHOD_NOT_FOUND_FOR_INTERCEPTOR_BINDING_CNTR0244E" , new Object [ ] { methodName , j2eeName , "4" } ) ; String message = "The " + methodName + " method name is not found " + " in one of the business interfaces of the " + j2eeName + " enterprise bean. A style 4 interceptor-binding element requires" + " the method to be a business method of the enterprise bean" ; throw new EJBConfigurationException ( message ) ; } } } } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "validateInterceptorBindings" ) ; } }
d367572.9 update for xml processing.