UI-Component Sets

CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

File Line
org/apache/myfaces/config/annotation/ResourceAnnotationLifecycleProvider.java 49
org/apache/myfaces/spi/impl/ResourceAnnotationInjectionProvider.java 49
    public ResourceAnnotationInjectionProvider(Context context)
    {
        this.context = context;
    }

    private static Map<Class,Field[]> getDeclaredFieldBeansMap()
    {
        ClassLoader cl = ClassUtils.getContextClassLoader();
        
        Map<Class,Field[]> metadata = (Map<Class,Field[]>)
                declaredFieldBeans.get(cl);

        if (metadata == null)
        {
            // Ensure thread-safe put over _metadata, and only create one map
            // per classloader to hold metadata.
            synchronized (declaredFieldBeans)
            {
                metadata = createDeclaredFieldBeansMap(cl, metadata);
            }
        }

        return metadata;
    }
    
    private static Map<Class,Field[]> createDeclaredFieldBeansMap(
            ClassLoader cl, Map<Class,Field[]> metadata)
    {
        metadata = (Map<Class,Field[]>) declaredFieldBeans.get(cl);
        if (metadata == null)
        {
            metadata = new HashMap<Class,Field[]>();
            declaredFieldBeans.put(cl, metadata);
        }
        return metadata;
    }

    /**
     * Inject resources in specified instance.
     */
    @Override
    protected void processAnnotations(Object instance)
            throws IllegalAccessException, InvocationTargetException, NamingException
    {

        if (context == null)
        {
            // No resource injection
            return;
        }

        checkAnnotation(instance.getClass(), instance);

        /* 
         * May be only check non private fields and methods
         * for @Resource (JSR 250), if used all superclasses MUST be examined
         * to discover all uses of this annotation.
         */

        Class superclass = instance.getClass().getSuperclass();
        while (superclass != null && (!superclass.equals(Object.class)))
        {
            checkAnnotation(superclass, instance);
            superclass = superclass.getSuperclass();
        } 
    }
    
    Field[] getDeclaredFieldBeans(Class clazz)
    {
        Map<Class,Field[]> declaredFieldBeansMap = getDeclaredFieldBeansMap();
        Field[] fields = declaredFieldBeansMap.get(clazz);
        if (fields == null)
        {
            fields = clazz.getDeclaredFields();
            synchronized(declaredFieldBeansMap)
            {
                declaredFieldBeansMap.put(clazz, fields);
            }
        }
        return fields;
    }

    private void checkAnnotation(Class<?> clazz, Object instance)
            throws NamingException, IllegalAccessException, InvocationTargetException
    {
        // Initialize fields annotations
        Field[] fields = getDeclaredFieldBeans(clazz);
        for (int i = 0; i < fields.length; i++)
        {
            Field field = fields[i];
            checkFieldAnnotation(field, instance);
        }

        // Initialize methods annotations
        Method[] methods = getDeclaredMethods(clazz);
        for (int i = 0; i < methods.length; i++)
        {
            Method method = methods[i];
            checkMethodAnnotation(method, instance);
        }
    }

    protected void checkMethodAnnotation(Method method, Object instance)
            throws NamingException, IllegalAccessException, InvocationTargetException
    {
        if (method.isAnnotationPresent(Resource.class))
        {
            Resource annotation = method.getAnnotation(Resource.class);
            lookupMethodResource(context, instance, method, annotation.name());
        }
    }

    protected void checkFieldAnnotation(Field field, Object instance)
            throws NamingException, IllegalAccessException
    {
        if (field.isAnnotationPresent(Resource.class))
        {
            Resource annotation = field.getAnnotation(Resource.class);
            lookupFieldResource(context, instance, field, annotation.name());
        }
    }

    /**
     * Inject resources in specified field.
     */
    protected static void lookupFieldResource(javax.naming.Context context,
            Object instance, Field field, String name)
            throws NamingException, IllegalAccessException
    {

        Object lookedupResource;

        if ((name != null) && (name.length() > 0))
        {
            // TODO local or global JNDI
            lookedupResource = context.lookup(JAVA_COMP_ENV + name);
        }
        else
        {
            // TODO local or global JNDI 
            lookedupResource = context.lookup(JAVA_COMP_ENV + instance.getClass().getName() + "/" + field.getName());
        }

        boolean accessibility = field.isAccessible();
        field.setAccessible(true);
        field.set(instance, lookedupResource);
        field.setAccessible(accessibility);
    }


    /**
     * Inject resources in specified method.
     */
    protected static void lookupMethodResource(javax.naming.Context context,
            Object instance, Method method, String name)
            throws NamingException, IllegalAccessException, InvocationTargetException
    {

        if (!method.getName().startsWith("set")
                || method.getParameterTypes().length != 1
                || !method.getReturnType().getName().equals("void"))
        {
            throw new IllegalArgumentException("Invalid method resource injection annotation");
        }

        Object lookedupResource;

        if ((name != null) && (name.length() > 0))
        {
            // TODO local or global JNDI
            lookedupResource = context.lookup(JAVA_COMP_ENV + name);
        }
        else
        {
            // TODO local or global JNDI
            lookedupResource =
                    context.lookup(JAVA_COMP_ENV + instance.getClass().getName() + "/" + getFieldName(method));
        }

        boolean accessibility = method.isAccessible();
        method.setAccessible(true);
        method.invoke(instance, lookedupResource);
        method.setAccessible(accessibility);
    }

    /**
     * Returns the field name for the given Method.
     * E.g. setName() will be "name". 
     *
     * @param setter the setter method
     * @return the field name of the given setter method
     */
    protected static String getFieldName(Method setter)
    {
        StringBuilder name = new StringBuilder(setter.getName());

        // remove 'set'
        name.delete(0, 3);

        // lowercase first char
        name.setCharAt(0, Character.toLowerCase(name.charAt(0)));

        return name.toString();
    }

}
File Line
org/apache/myfaces/application/viewstate/SessionIdGenerator.java 34
org/apache/myfaces/push/cdi/SessionIdGenerator.java 34
class SessionIdGenerator
{

    private static Logger log = Logger.getLogger(SessionIdGenerator.class.getName());

    /**
     * Queue of random number generator objects to be used when creating session
     * identifiers. If the queue is empty when a random number generator is
     * required, a new random number generator object is created. This is
     * designed this way since random number generators use a sync to make them
     * thread-safe and the sync makes using a a single object slow(er).
     */
    private Queue<SecureRandom> randoms =
            new ConcurrentLinkedQueue<SecureRandom>();
    /**
     * The Java class name of the secure random number generator class to be
     * used when generating session identifiers. The random number generator
     * class must be self-seeding and have a zero-argument constructor. If not
     * specified, an instance of {@link SecureRandom} will be generated.
     */
    private String secureRandomClass = null;
    /**
     * The name of the algorithm to use to create instances of
     * {@link SecureRandom} which are used to generate session IDs. If no
     * algorithm is specified, SHA1PRNG is used. To use the platform default
     * (which may be SHA1PRNG), specify the empty string. If an invalid
     * algorithm and/or provider is specified the {@link SecureRandom} instances
     * will be created using the defaults. If that fails, the {@link
     * SecureRandom} instances will be created using platform defaults.
     */
    private String secureRandomAlgorithm = "SHA1PRNG";
    /**
     * The name of the provider to use to create instances of
     * {@link SecureRandom} which are used to generate session IDs. If no
     * algorithm is specified the of SHA1PRNG default is used. If an invalid
     * algorithm and/or provider is specified the {@link SecureRandom} instances
     * will be created using the defaults. If that fails, the {@link
     * SecureRandom} instances will be created using platform defaults.
     */
    private String secureRandomProvider = null;
    /**
     * Node identifier when in a cluster. Defaults to the empty string.
     */
    private String jvmRoute = "";
    /**
     * Number of bytes in a session ID. Defaults to 16.
     */
    private int sessionIdLength = 16;

    /**
     * Specify a non-default @{link {@link SecureRandom} implementation to use.
     *
     * @param secureRandomClass The fully-qualified class name
     */
    public void setSecureRandomClass(String secureRandomClass)
    {
        this.secureRandomClass = secureRandomClass;
    }

    /**
     * Specify a non-default algorithm to use to generate random numbers.
     *
     * @param secureRandomAlgorithm The name of the algorithm
     */
    public void setSecureRandomAlgorithm(String secureRandomAlgorithm)
    {
        this.secureRandomAlgorithm = secureRandomAlgorithm;
    }

    /**
     * Specify a non-default provider to use to generate random numbers.
     *
     * @param secureRandomProvider The name of the provider
     */
    public void setSecureRandomProvider(String secureRandomProvider)
    {
        this.secureRandomProvider = secureRandomProvider;
    }

    /**
     * Specify the node identifier associated with this node which will be
     * included in the generated session ID.
     *
     * @param jvmRoute The node identifier
     */
    public void setJvmRoute(String jvmRoute)
    {
        this.jvmRoute = jvmRoute;
    }

    /**
     * Specify the number of bytes for a session ID
     *
     * @param sessionIdLength Number of bytes
     */
    public void setSessionIdLength(int sessionIdLength)
    {
        this.sessionIdLength = sessionIdLength;
    }

    /**
     * Generate and return a new session identifier.
     */
    public String generateSessionId()
    {

        byte random[] = new byte[16];

        // Render the result as a String of hexadecimal digits
        StringBuilder buffer = new StringBuilder();

        int resultLenBytes = 0;

        while (resultLenBytes < sessionIdLength)
        {
            getRandomBytes(random);
            for (int j = 0;
                    j < random.length && resultLenBytes < sessionIdLength;
                    j++)
            {
                byte b1 = (byte) ((random[j] & 0xf0) >> 4);
                byte b2 = (byte) (random[j] & 0x0f);
                if (b1 < 10)
                {
                    buffer.append((char) ('0' + b1));
                }
                else
                {
                    buffer.append((char) ('A' + (b1 - 10)));
                }
                if (b2 < 10)
                {
                    buffer.append((char) ('0' + b2));
                }
                else
                {
                    buffer.append((char) ('A' + (b2 - 10)));
                }
                resultLenBytes++;
            }
        }

        if (jvmRoute != null && jvmRoute.length() > 0)
        {
            buffer.append('.').append(jvmRoute);
        }

        return buffer.toString();
    }

    public void getRandomBytes(byte bytes[])
    {
        SecureRandom random = randoms.poll();
        if (random == null)
        {
            random = createSecureRandom();
        }
        random.nextBytes(bytes);
        randoms.add(random);
    }

    /**
     * Create a new random number generator instance we should use for
     * generating session identifiers.
     */
    private SecureRandom createSecureRandom()
    {

        SecureRandom result = null;

        long t1 = System.currentTimeMillis();
        if (secureRandomClass != null)
        {
            try
            {
                // Construct and seed a new random number generator
                Class<?> clazz = Class.forName(secureRandomClass);
                result = (SecureRandom) clazz.newInstance();
            }
            catch (Exception e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator of class "+ 
                        secureRandomClass + ". Falling back to java.secure.SecureRandom", e);
            }
        }

        if (result == null)
        {
            // No secureRandomClass or creation failed. Use SecureRandom.
            try
            {
                if (secureRandomProvider != null
                        && secureRandomProvider.length() > 0)
                {
                    result = SecureRandom.getInstance(secureRandomAlgorithm,
                            secureRandomProvider);
                }
                else
                {
                    if (secureRandomAlgorithm != null
                            && secureRandomAlgorithm.length() > 0)
                    {
                        result = SecureRandom.getInstance(secureRandomAlgorithm);
                    }
                }
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using algorithm: "+
                        secureRandomAlgorithm, e);
            }
            catch (NoSuchProviderException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using provider: " + 
                        secureRandomProvider, e);
            }
        }

        if (result == null)
        {
            // Invalid provider / algorithm
            try
            {
                result = SecureRandom.getInstance("SHA1PRNG");
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Invalid provider / algoritm SHA1PRNG for generate secure random token", e);
            }
        }

        if (result == null)
        {
            // Nothing works - use platform default
            result = new SecureRandom();
        }

        // Force seeding to take place
        result.nextInt();

        long t2 = System.currentTimeMillis();
        if ((t2 - t1) > 100)
        {
            if (log.isLoggable(Level.FINEST))
            {
                log.info("Creation of SecureRandom instance for session ID generation using ["
                        +result.getAlgorithm()+"] took ["+Long.valueOf(t2 - t1)+"] milliseconds.");
            }
        }
        return result;
    }
}
File Line
org/apache/myfaces/application/ResourceHandlerImpl.java 1179
org/apache/myfaces/application/ResourceHandlerImpl.java 1354
            String resourceId, String contractName)
    {
        ResourceMeta resourceMeta = null;
        String token = null;
        String localePrefix = null;
        String libraryName = null;
        String libraryVersion = null;
        String resourceName = null;
        String resourceVersion = null;
        
        // Check if resource exists. It avoids additional 
        // checks and it can be done very quickly because the 
        // loader always uses the resourceId structure to
        // organize resources. But decompose the resourceId is
        // even faster.
        //if (resourceLoader.resourceIdExists(resourceId))
        //{
        int lastSlash = resourceId.lastIndexOf('/');
        if (lastSlash < 0)
        {
            //no slashes, so it is just a plain resource.
            resourceName = resourceId;
        }
        else
        {
            token = resourceId.substring(lastSlash+1);
            if (RESOURCE_VERSION_CHECKER.matcher(token).matches())
            {
                int secondLastSlash = resourceId.lastIndexOf('/', lastSlash-1);
                if (secondLastSlash < 0)
                {
                    secondLastSlash = 0;
                }

                String rnToken = resourceId.substring(secondLastSlash+1, lastSlash);
                int lastPoint = rnToken.lastIndexOf('.');
                // lastPoint < 0 means it does not match, the token is not a resource version
                if (lastPoint >= 0)
                {
                    String ext = rnToken.substring(lastPoint);
                    if (token.endsWith(ext))
                    {
                        //It match a versioned resource
                        resourceVersion = token.substring(0,token.length()-ext.length());
                    }
                }
            }

            // 1. Extract the library path and locale prefix if necessary
            int start = 0;
            int firstSlash = resourceId.indexOf('/');

            // At least one slash, check if the start is locale prefix.
            String bundleName = context.getApplication().getMessageBundle();
            //If no bundle set, it can't be localePrefix
            if (null != bundleName)
            {
                token = resourceId.substring(start, firstSlash);
                //Try to derive a locale object
                Locale locale = _LocaleUtils.deriveLocale(token);

                // If the locale was derived and it is available, 
                // assume that portion of the resourceId it as a locale prefix.
                if (locale != null && _LocaleUtils.isAvailableLocale(locale))
                {
                    localePrefix = token;
                    start = firstSlash+1;
                }
            }

            //Check slash again from start
            firstSlash = resourceId.indexOf('/', start);
            if (firstSlash < 0)
            {
                //no slashes.
                resourceName = resourceId.substring(start);
            }
            else
            {
                //check libraryName
                token = resourceId.substring(start, firstSlash);
                int minResourceNameSlash = (resourceVersion != null) ?
                    resourceId.lastIndexOf('/', lastSlash-1) : lastSlash;
                //if (resourceLoader.libraryExists(token))
                if (start < minResourceNameSlash)
                {
                    libraryName = token;
                    start = firstSlash+1;

                    //Now that libraryName exists, check libraryVersion
                    firstSlash = resourceId.indexOf('/', start);
                    if (firstSlash >= 0)
                    {
                        token = resourceId.substring(start, firstSlash);
                        if (LIBRARY_VERSION_CHECKER.matcher(token).matches())
                        {
                            libraryVersion = token;
                            start = firstSlash+1;
                        }
                    }
                }

                firstSlash = resourceId.indexOf('/', start);
                if (firstSlash < 0)
                {
                    //no slashes.
                    resourceName = resourceId.substring(start);
                }
                else
                {
                    // Check resource version. 
                    if (resourceVersion != null)
                    {
                        resourceName = resourceId.substring(start,lastSlash);
                    }
                    else
                    {
                        //no resource version, assume the remaining to be resource name
                        resourceName = resourceId.substring(start);
                    }
                }
            }
        }

        //Check libraryName and resourceName
        if (resourceName == null)
        {
            return null;
        }
        if (!ResourceValidationUtils.isValidResourceName(resourceName))
        {
            return null;
        }

        if (libraryName != null && !ResourceValidationUtils.isValidLibraryName(
                libraryName, isAllowSlashesLibraryName()))
        {
            return null;
        }

        // If some variable is "" set it as null.
        if (localePrefix != null && localePrefix.length() == 0)
        {
            localePrefix = null;
        }
        if (libraryName != null && libraryName.length() == 0)
        {
            libraryName = null;
        }
        if (libraryVersion != null && libraryVersion.length() == 0)
        {
            libraryVersion = null;
        }
        if (resourceName != null && resourceName.length() == 0)
        {
            resourceName = null;
        }
        if (resourceVersion != null && resourceVersion.length() == 0)
        {
            resourceVersion = null;
        }

        resourceMeta = resourceLoader.createResourceMeta(
            localePrefix, libraryName, libraryVersion, resourceName, resourceVersion, contractName);
File Line
org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java 137
org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java 167
                            RefreshDynamicComponentListener(taglibURI, tagName, attributes, baseKey));
                    }
                }
            }
            finally
            {
                if (facetName != null)
                {
                    parent.getAttributes().remove(org.apache.myfaces.view.facelets.tag.jsf.core.FacetHandler.KEY);
                }
            }
        }
        catch (IOException e)
        {
            throw new FacesException(e);
        }
        finally
        {
            facesContext.getAttributes().remove(
                FaceletViewDeclarationLanguage.REFRESHING_TRANSIENT_BUILD);
        }
    }

    public Object saveState(FacesContext context)
    {
        RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(
            context.getExternalContext());
        Object[] values = new Object[4];
        Integer tagId = runtimeConfig.getIdByNamespace().get(taglibURI);
        if (tagId != null)
        {
            values[0] = tagId;
        }
        else if (taglibURI.startsWith(CompositeResourceLibrary.NAMESPACE_PREFIX))
        {
            values[0] = new Object[]{0, taglibURI.substring(35)};
        }
        else if(taglibURI.startsWith(CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX))
        {
            values[0] = new Object[]{1, taglibURI.substring(34)};
        }
        else
        {
            values[0] = taglibURI;
        }
        values[1] = tagName;
        values[2] = attributes;
        values[3] = baseKey;
        return values;
    }

    public void restoreState(FacesContext context, Object state)
    {
        Object[] values = (Object[]) state;
        if (values[0] instanceof String)
        {
            taglibURI = (String) values[0];
        }
        else if (values[0] instanceof Integer)
        {
            RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(
                context.getExternalContext());
            taglibURI = runtimeConfig.getNamespaceById().get((Integer)values[0]);
        }
        else if (values[0] instanceof Object[])
        {
            Object[] def = (Object[])values[0];
            String ns = ( ((Integer)def[0]).intValue() == 0) ? 
                CompositeResourceLibrary.NAMESPACE_PREFIX :
                CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX;
            taglibURI = ns + (String)(((Object[])values[0])[1]);
        }
        tagName = (String)values[1];
        attributes = (Map<String,Object>) values[2];
        baseKey = (String)values[3];
    }

    public boolean isTransient()
    {
        return false;
    }

    public void setTransient(boolean newTransientValue)
    {
    }

}
File Line
org/apache/myfaces/resource/TempDirFileCacheContractResourceLoader.java 74
org/apache/myfaces/resource/TempDirFileCacheResourceLoader.java 114
    }
    
    protected void initialize()
    {
        //Get startup FacesContext
        FacesContext facesContext = FacesContext.getCurrentInstance();
    
        //1. Create temporal directory for temporal resources
        Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
        File tempdir = (File) applicationMap.get("javax.servlet.context.tempdir");
        File imagesDir = new File(tempdir, TEMP_FOLDER_BASE_DIR);
        if (!imagesDir.exists())
        {
            imagesDir.mkdirs();
        }
        else
        {
            //Clear the cache
            deleteDir(imagesDir);
            imagesDir.mkdirs();
        }
        _tempDir = imagesDir;

        //2. Create map for register temporal resources
        Map<String, FileProducer> temporalFilesLockMap = new ConcurrentHashMap<String, FileProducer>();
        facesContext.getExternalContext().getApplicationMap().put(TEMP_FILES_LOCK_MAP, temporalFilesLockMap);
    }

    private static boolean deleteDir(File dir)
    {
        if (dir.isDirectory())
        {
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++)
            {
                boolean success = deleteDir(new File(dir, children[i]));
                if (!success)
                {
                    return false;
                }
            }
        }
        return dir.delete();
    }
    
    @Override
    public URL getResourceURL(ResourceMeta resourceMeta)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        if (resourceExists(resourceMeta))
        {
            File file = createOrGetTempFile(facesContext, resourceMeta);
            
            try
            {
                return file.toURL();
            }
            catch (MalformedURLException e)
            {
                throw new FacesException(e);
            }
        }
        else
        {
            return null;
        }
    }    
    
    public InputStream getResourceInputStream(ResourceMeta resourceMeta, Resource resource)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        if (resourceExists(resourceMeta))
        {
            File file = createOrGetTempFile(facesContext, resourceMeta);
            
            try
            {
                return new BufferedInputStream(new FileInputStream(file));
            }
            catch (FileNotFoundException e)
            {
                throw new FacesException(e);
            }
        }
        else
        {
            return null;
        }
    }

    @Override
    public InputStream getResourceInputStream(ResourceMeta resourceMeta)
    {
        return getResourceInputStream(resourceMeta, null);
    }
    
    @Override
    public boolean resourceExists(ResourceMeta resourceMeta)
    {
        return super.resourceExists(resourceMeta);
    }

    @SuppressWarnings("unchecked")
    private File createOrGetTempFile(FacesContext facesContext, ResourceMeta resourceMeta)
    {
        String identifier = resourceMeta.getResourceIdentifier();
File Line
org/apache/myfaces/view/facelets/el/ELText.java 485
org/apache/myfaces/view/facelets/el/ELText.java 570
    public static ELText[] parseAsArray(ExpressionFactory fact, ELContext ctx, String in) throws ELException
    {
        char[] ca = in.toCharArray();
        int i = 0;
        char c = 0;
        int len = ca.length;
        int end = len - 1;
        boolean esc = false;
        int vlen = 0;

        StringBuffer buff = new StringBuffer(128);
        List<ELText> text = new ArrayList<ELText>();
        ELText t = null;
        ValueExpression ve = null;

        while (i < len)
        {
            c = ca[i];
            if ('\\' == c)
            {
                esc = !esc;
                if (esc && i < end && (ca[i + 1] == '$' || ca[i + 1] == '#'))
                {
                    i++;
                    continue;
                }
            }
            else if (!esc && ('$' == c || '#' == c))
            {
                if (i < end)
                {
                    if ('{' == ca[i + 1])
                    {
                        if (buff.length() > 0)
                        {
                            text.add(new ELText(buff.toString()));
                            buff.setLength(0);
                        }
                        vlen = findVarLength(ca, i);
                        if (ctx != null && fact != null)
                        {
                            ve = fact.createValueExpression(ctx, new String(ca, i, vlen), String.class);
                            t = new ELCacheableTextVariable(ve);
                        }
                        else
                        {
                            t = new ELCacheableTextVariable(new LiteralValueExpression(new String(ca, i, vlen)));
                        }
                        text.add(t);
                        i += vlen;
                        continue;
                    }
                }
            }
            esc = false;
            buff.append(c);
            i++;
        }

        if (buff.length() > 0)
        {
            text.add(new ELText(buff.toString()));
            buff.setLength(0);
        }

        if (text.isEmpty())
        {
            return null;
        }
        else if (text.size() == 1)
        {
            return new ELText[]{text.get(0)};
File Line
org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java 133
org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java 125
            String restoredPath = (String) ComponentSupport.restoreInitialTagState(ctx, fcc, parent, uniqueId);
            if (restoredPath != null)
            {
                // If is not restore view phase, the path value should be
                // evaluated and if is not equals, trigger markInitialState stuff.
                if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                {
                    path = this.src.getValue(ctx);
                    if (path == null || path.length() == 0)
                    {
                        return;
                    }
                    if (!path.equals(restoredPath))
                    {
                        markInitialState = true;
                    }
                }
                else
                {
                    path = restoredPath;
                }
            }
            else
            {
                //No state restored, calculate path
                path = this.src.getValue(ctx);
            }
            ComponentSupport.saveInitialTagState(ctx, fcc, parent, uniqueId, path);
        }
        else
        {
            path = this.src.getValue(ctx);
        }
        try
        {
            if (path == null || path.length() == 0)
            {
                return;
            }
            VariableMapper orig = ctx.getVariableMapper();
            ctx.setVariableMapper(new VariableMapperWrapper(orig));
            try
            {
                //Only ui:param could be inside ui:include.
                //this.nextHandler.apply(ctx, null);
                
                URL url = null;
                boolean oldMarkInitialState = false;
                Boolean isBuildingInitialState = null;
                // if we are in ProjectStage Development and the path equals "javax.faces.error.xhtml"
                // we should include the default error page
                if (ctx.getFacesContext().isProjectStage(ProjectStage.Development) 
                        && ERROR_PAGE_INCLUDE_PATH.equals(path))
                {
                    url =ClassUtils.getResource(ERROR_FACELET);
                }
                if (markInitialState)
                {
                    //set markInitialState flag
                    oldMarkInitialState = fcc.isMarkInitialState();
                    fcc.setMarkInitialState(true);
                    isBuildingInitialState = (Boolean) ctx.getFacesContext().getAttributes().put(
                            StateManager.IS_BUILDING_INITIAL_STATE, Boolean.TRUE);
                }
                try
                {
                    if (_params != null)
                    {
                        // ui:include defines a new TemplateContext, but ui:param EL expressions
                        // defined inside should be built before the new context is setup, to
                        // apply then after. The final effect is EL expressions will be resolved
                        // correctly when nested ui:params with the same name or based on other
                        // ui:params are used.
                        
                        String[] names = new String[_params.length];
                        ValueExpression[] values = new ValueExpression[_params.length];
                        
                        for (int i = 0; i < _params.length; i++)
                        {
                            names[i] = _params[i].getName(ctx);
                            values[i] = _params[i].getValue(ctx);
                        }
File Line
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java 85
org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java 67
        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
        
        _acceptPatterns = loadAcceptPattern(externalContext);

        _extension = loadFaceletExtension(externalContext);
        
        String defaultSuffixes = WebConfigParamUtils.getStringInitParameter(externalContext,
                ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ViewHandler.DEFAULT_SUFFIX );
        
        _defaultSuffixesArray = StringUtils.splitShortString(defaultSuffixes, ' ');
        
        boolean faceletsExtensionFound = false;
        for (String ext : _defaultSuffixesArray)
        {
            if (_extension.equals(ext))
            {
                faceletsExtensionFound = true;
                break;
            }
        }
        if (!faceletsExtensionFound)
        {
            _defaultSuffixesArray = (String[]) ArrayUtils.concat(_defaultSuffixesArray, new String[]{_extension});
        }
    }
    
    /**
     * Load and compile a regular expression pattern built from the Facelet view mapping parameters.
     * 
     * @param context
     *            the application's external context
     * 
     * @return the compiled regular expression
     */
    private Pattern loadAcceptPattern(ExternalContext context)
    {
        assert context != null;

        String mappings = context.getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
        if (mappings == null)
        {
            return null;
        }

        // Make sure the mappings contain something
        mappings = mappings.trim();
        if (mappings.length() == 0)
        {
            return null;
        }

        return Pattern.compile(toRegex(mappings));
    }

    private String loadFaceletExtension(ExternalContext context)
    {
        assert context != null;

        String suffix = context.getInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME);
        if (suffix == null)
        {
            suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
        }
        else
        {
            suffix = suffix.trim();
            if (suffix.length() == 0)
            {
                suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
            }
        }

        return suffix;
    }
    
    /**
     * Convert the specified mapping string to an equivalent regular expression.
     * 
     * @param mappings
     *            le mapping string
     * 
     * @return an uncompiled regular expression representing the mappings
     */
    private String toRegex(String mappings)
    {
        assert mappings != null;

        // Get rid of spaces
        mappings = mappings.replaceAll("\\s", "");

        // Escape '.'
        mappings = mappings.replaceAll("\\.", "\\\\.");

        // Change '*' to '.*' to represent any match
        mappings = mappings.replaceAll("\\*", ".*");

        // Split the mappings by changing ';' to '|'
        mappings = mappings.replaceAll(";", "|");

        return mappings;
    }
    
    public boolean handles(String resourceName)
    {
        if (resourceName == null)
        {
            return false;
        }
        // Check extension first as it's faster than mappings
        if (resourceName.endsWith(_extension))
        {
            // If the extension matches, it's a Facelet viewId.
            return true;
        }

        // Otherwise, try to match the view identifier with the facelet mappings
        return _acceptPatterns != null && _acceptPatterns.matcher(resourceName).matches();
    }
File Line
org/apache/myfaces/config/annotation/AllAnnotationLifecycleProvider.java 37
org/apache/myfaces/spi/impl/AllAnnotationInjectionProvider.java 37
    public AllAnnotationInjectionProvider(Context context)
    {
        super(context);
    }

    @Override
    protected void checkMethodAnnotation(Method method, Object instance)
            throws NamingException, IllegalAccessException, InvocationTargetException
    {
        super.checkMethodAnnotation(method, instance);
        if (method.isAnnotationPresent(Resource.class))
        {
            Resource annotation =  method.getAnnotation(Resource.class);
            lookupMethodResource(context, instance, method, annotation.name());
        }
        if (method.isAnnotationPresent(EJB.class))
        {
            EJB annotation =  method.getAnnotation(EJB.class);
            lookupMethodResource(context, instance, method, annotation.name());
        }
        // TODO where i find WebServiceRef?
        /*if (method.isAnnotationPresent(WebServiceRef.class)) {
            WebServiceRef annotation =
                (WebServiceRef) method.getAnnotation(WebServiceRef.class);
            lookupMethodResource(context, instance, methods, annotation.name());
        }*/
        if (method.isAnnotationPresent(PersistenceContext.class))
        {
            PersistenceContext annotation = method.getAnnotation(PersistenceContext.class);
            lookupMethodResource(context, instance, method, annotation.name());
        }
        if (method.isAnnotationPresent(PersistenceUnit.class))
        {
            PersistenceUnit annotation = method.getAnnotation(PersistenceUnit.class);
            lookupMethodResource(context, instance, method, annotation.name());
        }
    }

    @Override
    protected void checkFieldAnnotation(Field field, Object instance)
            throws NamingException, IllegalAccessException
    {
        super.checkFieldAnnotation(field, instance);
        if (field.isAnnotationPresent(EJB.class))
        {
            EJB annotation = field.getAnnotation(EJB.class);
            lookupFieldResource(context, instance, field, annotation.name());
        }
        /*if (field.isAnnotationPresent(WebServiceRef.class)) {
            WebServiceRef annotation =
                (WebServiceRef) field.getAnnotation(WebServiceRef.class);
            lookupFieldResource(context, instance, field, annotation.name());
        }*/
        if (field.isAnnotationPresent(PersistenceContext.class))
        {
            PersistenceContext annotation = field.getAnnotation(PersistenceContext.class);
            lookupFieldResource(context, instance, field, annotation.name());
        }
        if (field.isAnnotationPresent(PersistenceUnit.class))
        {
            PersistenceUnit annotation = field.getAnnotation(PersistenceUnit.class);
            lookupFieldResource(context, instance, field, annotation.name());
        }
    }
}
File Line
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java 1004
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java 1252
                    registerOnAddRemoveList(facesContext, target.getClientId(facesContext));
                    target.getAttributes().put(COMPONENT_ADDED_AFTER_BUILD_VIEW, ComponentState.ADDED);
                }
                else if (ComponentState.ADD.equals(componentAddedAfterBuildView))
                {
                    registerOnAddList(facesContext, target.getClientId(facesContext));
                    target.getAttributes().put(COMPONENT_ADDED_AFTER_BUILD_VIEW, ComponentState.ADDED);
                }
                else if (ComponentState.ADDED.equals(componentAddedAfterBuildView))
                {
                    // Later on the check of removed components we'll see if the view
                    // is resetable or not.
                    registerOnAddList(facesContext, target.getClientId(facesContext));
                }
                ensureClearInitialState(target);
                //Save all required info to restore the subtree.
                //This includes position, structure and state of subtree

                int childIndex = target.getParent().getChildren().indexOf(target);
                if (childIndex >= 0)
                {
                    states.put(target.getClientId(facesContext), new AttachedFullStateWrapper( 
                            new Object[]{
                                target.getParent().getClientId(facesContext),
                                null,
                                childIndex,
                                internalBuildTreeStructureToSave(target),
                                target.processSaveState(facesContext)}));
                }
                else
                {
                    String facetName = null;
                    if (target.getParent().getFacetCount() > 0)
                    {
                        for (Map.Entry<String, UIComponent> entry : target.getParent().getFacets().entrySet()) 
                        {
                            if (target.equals(entry.getValue()))
                            {
                                facetName = entry.getKey();
                                break;
                            }
                        }
                    }
                    states.put(target.getClientId(facesContext),new AttachedFullStateWrapper(new Object[]{
                            target.getParent().getClientId(facesContext),
                            facetName,
                            null,
                            internalBuildTreeStructureToSave(target),
                            target.processSaveState(facesContext)}));
                }
                return VisitResult.REJECT;
            }
            else if (target.getParent() != null)
            {
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/LegacySetHandler.java 89
org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java 89
    public SetHandler(TagConfig config)
    {
        super(config);
        this.value = this.getAttribute("value");
        this.var = this.getAttribute("var");
        this.scope = this.getAttribute("scope");
        this.target = this.getAttribute("target");
        this.property = this.getAttribute("property");
    }

    @Override
    public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        ValueExpression veObj = this.value.getValueExpression(ctx, Object.class);

        if (this.var != null)
        {
            // Get variable name
            String varStr = this.var.getValue(ctx);

            if (this.scope != null)
            {
                String scopeStr = this.scope.getValue(ctx);

                // Check scope string
                if (scopeStr == null || scopeStr.length() == 0)
                {
                    throw new TagException(tag, "scope must not be empty");
                }
                if ("page".equals(scopeStr))
                {
                    throw new TagException(tag, "page scope is not allowed");
                }

                // Build value expression string to set variable
                StringBuilder expStr = new StringBuilder().append("#{").append(scopeStr);
                if ("request".equals(scopeStr) || "view".equals(scopeStr) || "session".equals(scopeStr)
                        || "application".equals(scopeStr))
                {
                    expStr.append("Scope");
                }
                expStr.append(".").append(varStr).append("}");
                ELContext elCtx = ctx.getFacesContext().getELContext();
                ValueExpression expr = ctx.getExpressionFactory().createValueExpression(
                        elCtx, expStr.toString(), Object.class);
                expr.setValue(elCtx, veObj.getValue(elCtx));
            }
            else
            {
File Line
org/apache/myfaces/view/facelets/component/UIRepeat.java 568
org/apache/myfaces/view/facelets/component/UIRepeat.java 649
                UIComponent child = parent.getChildren().get(i);
                if (!child.isTransient())
                {
                    // Add an entry to the collection, being an array of two
                    // elements. The first element is the state of the children
                    // of this component; the second is the state of the current
                    // child itself.

                    if (child instanceof EditableValueHolder)
                    {
                        if (childStates == null)
                        {
                            childStates = new ArrayList<Object[]>(
                                    parent.getFacetCount()
                                    + parent.getChildCount()
                                    - totalChildCount
                                    + childEmptyIndex);
                            for (int ci = 0; ci < childEmptyIndex; ci++)
                            {
                                childStates.add(LEAF_NO_STATE);
                            }
                        }
                    
                        childStates.add(child.getChildCount() > 0 ? 
                                new Object[]{new SavedState((EditableValueHolder) child),
                                    saveDescendantComponentStates(child, saveChildFacets, true)} :
                                new Object[]{new SavedState((EditableValueHolder) child),
                                    null});
                    }
                    else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0))
                    {
                        Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true);
                        
                        if (descendantSavedState == null)
                        {
                            if (childStates == null)
                            {
                                childEmptyIndex++;
                            }
                            else
                            {
                                childStates.add(LEAF_NO_STATE);
                            }
                        }
                        else
                        {
                            if (childStates == null)
                            {
                                childStates = new ArrayList<Object[]>(
                                        parent.getFacetCount()
                                        + parent.getChildCount()
                                        - totalChildCount
                                        + childEmptyIndex);
                                for (int ci = 0; ci < childEmptyIndex; ci++)
                                {
                                    childStates.add(LEAF_NO_STATE);
                                }
                            }
                            childStates.add(new Object[]{null, descendantSavedState});
                        }
                    }
                    else
                    {
                        if (childStates == null)
                        {
                            childEmptyIndex++;
                        }
                        else
                        {
                            childStates.add(LEAF_NO_STATE);
                        }
                    }
                }
                totalChildCount++;
            }
        }
File Line
org/apache/myfaces/cdi/scope/FacesScopedContextImpl.java 131
org/apache/myfaces/cdi/scope/ViewTransientScopedContextImpl.java 133
    public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        
        checkActive(facesContext);

        if (!(bean instanceof PassivationCapable))
        {
            throw new IllegalStateException(bean.toString() +
                    " doesn't implement " + PassivationCapable.class.getName());
        }

        ContextualStorage storage = getContextualStorage(true, facesContext);

        Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
        ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

        if (contextualInstanceInfo != null)
        {
            @SuppressWarnings("unchecked")
            final T instance =  (T) contextualInstanceInfo.getContextualInstance();

            if (instance != null)
            {
                return instance;
            }
        }

        return storage.createContextualInstance(bean, creationalContext);
    }

    /**
     * Destroy the Contextual Instance of the given Bean.
     * @param bean dictates which bean shall get cleaned up
     * @return <code>true</code> if the bean was destroyed, <code>false</code> if there was no such bean.
     */
    public boolean destroy(Contextual bean)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ContextualStorage storage = getContextualStorage(false, facesContext);
        if (storage == null)
        {
            return false;
        }
        ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));

        if (contextualInstanceInfo == null)
        {
            return false;
        }

        bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());
        return true;
    }

    /**
     * Destroys all the Contextual Instances in the specified ContextualStorage.
     * This is a static method to allow various holder objects to cleanup
     * properly in &#064;PreDestroy.
     */
    public static void destroyAllActive(ContextualStorage storage)
    {
        Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
        for (Map.Entry<Object, ContextualInstanceInfo<?>> entry : contextMap.entrySet())
        {
            if (!ViewTransientScopeBeanHolder.VIEW_TRANSIENT_SCOPE_MAP_INFO.equals(entry.getKey()))
File Line
org/apache/myfaces/application/TreeStructureManager.java 48
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java 1556
    private static TreeStructComponent internalBuildTreeStructureToSave(UIComponent component)
    {
        TreeStructComponent structComp = new TreeStructComponent(component.getClass().getName(),
                                                                 component.getId());

        //children
        if (component.getChildCount() > 0)
        {
            List<TreeStructComponent> structChildList = new ArrayList<TreeStructComponent>();
            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
            {
                UIComponent child = component.getChildren().get(i);     
                if (!child.isTransient())
                {
                    TreeStructComponent structChild = internalBuildTreeStructureToSave(child);
                    structChildList.add(structChild);
                }
            }
            
            TreeStructComponent[] childArray = structChildList.toArray(new TreeStructComponent[structChildList.size()]);
            structComp.setChildren(childArray);
        }

        //facets
        
        if (component.getFacetCount() > 0)
        {
            Map<String, UIComponent> facetMap = component.getFacets();
            List<Object[]> structFacetList = new ArrayList<Object[]>();
            for (Map.Entry<String, UIComponent> entry : facetMap.entrySet())
            {
                UIComponent child = entry.getValue();
                if (!child.isTransient())
                {
                    String facetName = entry.getKey();
                    TreeStructComponent structChild = internalBuildTreeStructureToSave(child);
                    structFacetList.add(new Object[] {facetName, structChild});
                }
            }
            
            Object[] facetArray = structFacetList.toArray(new Object[structFacetList.size()]);
            structComp.setFacets(facetArray);
        }

        return structComp;
    }
File Line
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java 171
org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java 708
    public static UIComponent findComponentChildOrFacetFrom(UIComponent parent, String id, String innerExpr)
    {
        if (parent.getFacetCount() > 0)
        {
            for (UIComponent facet : parent.getFacets().values())
            {
                if (id.equals(facet.getId()))
                {
                    if (innerExpr == null)
                    {
                        return facet;
                    }
                    else if (facet instanceof NamingContainer)
                    {
                        UIComponent find = facet.findComponent(innerExpr);
                        if (find != null)
                        {
                            return find;
                        }
                    }
                }
                else if (!(facet instanceof NamingContainer))
                {
                    UIComponent find = findComponentChildOrFacetFrom(facet, id, innerExpr);
                    if (find != null)
                    {
                        return find;
                    }
                }
            }
        }
        if (parent.getChildCount() > 0)
        {
            for (int i = 0, childCount = parent.getChildCount(); i < childCount; i++)
            {
                UIComponent child = parent.getChildren().get(i);
                if (id.equals(child.getId()))
                {
                    if (innerExpr == null)
                    {
                        return child;
                    }
                    else if (child instanceof NamingContainer)
                    {
                        UIComponent find = child.findComponent(innerExpr);
                        if (find != null)
                        {
                            return find;
                        }
                    }
                }
                else if (!(child instanceof NamingContainer))
                {
                    UIComponent find = findComponentChildOrFacetFrom(child, id, innerExpr);
                    if (find != null)
                    {
                        return find;
                    }
                }
            }
        }
        return null;
    }
File Line
org/apache/myfaces/application/viewstate/RandomCsrfSessionTokenFactory.java 35
org/apache/myfaces/push/cdi/RandomCsrfSessionTokenFactory.java 34
class RandomCsrfSessionTokenFactory extends CsrfSessionTokenFactory
{
    private final Random random;
    private final int length;

    public RandomCsrfSessionTokenFactory(FacesContext facesContext)
    {
        length = WebConfigParamUtils.getIntegerInitParameter(
            facesContext.getExternalContext(), 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM, 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM_DEFAULT);
        random = new Random(((int) System.nanoTime()) + this.hashCode());
    }

    public Integer generateCounterKey(FacesContext facesContext)
    {
        ExternalContext externalContext = facesContext.getExternalContext();
        Object sessionObj = externalContext.getSession(true);
        Integer sequence;
        synchronized (sessionObj) // are handled at the same time for the session
        {
            Map<String, Object> map = externalContext.getSessionMap();
            sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
            if (sequence == null || sequence.intValue() == Integer.MAX_VALUE)
            {
                sequence = Integer.valueOf(1);
            }
            else
            {
                sequence = Integer.valueOf(sequence.intValue() + 1);
            }
            map.put(RendererUtils.SEQUENCE_PARAM, sequence);
        }
        return sequence;
    }

    public byte[] generateKey(FacesContext facesContext)
    {
        byte[] array = new byte[length];
        random.nextBytes(array);
        return array;
    }

    @Override
    public String createCryptographicallyStrongTokenFromSession(FacesContext context)
    {
        byte[] key = generateKey(context);
        return DatatypeConverter.printHexBinary(key);
    }
}
File Line
org/apache/myfaces/resource/TempDirFileCacheContractResourceLoader.java 215
org/apache/myfaces/resource/TempDirFileCacheResourceLoader.java 254
        return new File(_tempDir, resourceMeta.getResourceIdentifier() + TEMP_FILE_SUFFIX);
    }

    /*
    private boolean couldResourceContainValueExpressions(ResourceMeta resourceMeta)
    {
        return resourceMeta.couldResourceContainValueExpressions() || resourceMeta.getResourceName().endsWith(".css");
    }*/
    
    protected void createTemporalFileVersion(FacesContext facesContext, ResourceMeta resourceMeta, File target)
    {
        target.mkdirs();  // ensure necessary directories exist
        target.delete();  // remove any existing file

        InputStream inputStream = null;
        FileOutputStream fileOutputStream;
        try
        {
            /*
            if (couldResourceContainValueExpressions(resourceMeta))
            {
                inputStream = new ValueExpressionFilterInputStream(
                        getWrapped().getResourceInputStream(resourceMeta),
                        resourceMeta.getLibraryName(), 
                        resourceMeta.getResourceName());
            }
            else
            {*/
                inputStream = getWrapped().getResourceInputStream(resourceMeta);
            /*}*/
            fileOutputStream = new FileOutputStream(target);
            byte[] buffer = new byte[this.getResourceBufferSize()];

            pipeBytes(inputStream, fileOutputStream, buffer);
        }
        catch (FileNotFoundException e)
        {
            throw new FacesException("Unexpected exception while create file:", e);
        }
        catch (IOException e)
        {
            throw new FacesException("Unexpected exception while create file:", e);
        }
        finally
        {
            if (inputStream != null)
            {
                try
                {
                    inputStream.close();
                }
                catch (IOException e)
                {
                    // Ignore
                }
            }
        }
    }
    
    /**
     * Reads the specified input stream into the provided byte array storage and
     * writes it to the output stream.
     */
    private static void pipeBytes(InputStream in, OutputStream out, byte[] buffer) throws IOException
    {
        int length;

        while ((length = (in.read(buffer))) >= 0)
        {
            out.write(buffer, 0, length);
        }
    }
    
    public static class FileProducer 
    {
        
        public volatile boolean created = false;
        
        public FileProducer()
        {
            super();
        }

        public boolean isCreated()
        {
            return created;
        }

        public synchronized void createFile(FacesContext facesContext, 
            ResourceMeta resourceMeta, File file, TempDirFileCacheResourceLoader loader)
File Line
org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java 531
org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java 242
            return new javax.faces.view.facelets.ComponentHandler(ccfg);
        }
    }

    private static class UserComponentHandlerFactory implements TagHandlerFactory
    {

        private final static Class<?>[] CONS_SIG = new Class[] { ComponentConfig.class };

        protected final String componentType;

        protected final String renderType;

        protected final Class<? extends TagHandler> type;

        protected final Constructor<? extends TagHandler> constructor;

        /**
         * @param handlerType
         */
        public UserComponentHandlerFactory(String componentType, String renderType, Class<? extends TagHandler> type)
        {
            this.componentType = componentType;
            this.renderType = renderType;
            this.type = type;
            try
            {
                this.constructor = this.type.getConstructor(CONS_SIG);
            }
            catch (Exception e)
            {
                throw new FaceletException("Must have a Constructor that takes in a ComponentConfig", e);
            }
        }

        public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException
        {
            try
            {
                ComponentConfig ccfg = new ComponentConfigWrapper(cfg, componentType, renderType);
                return constructor.newInstance(new Object[] { ccfg });
            }
            catch (InvocationTargetException e)
            {
                throw new FaceletException(e.getCause().getMessage(), e.getCause().getCause());
            }
            catch (Exception e)
            {
                throw new FaceletException("Error Instantiating ComponentHandler: " + this.type.getName(), e);
            }
        }
    }
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 240
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 227
            _currentKey = _i.next();
            return getValue(_currentKey);
        }

        protected abstract E getValue(String attributeName);
    }

    private final class KeyIterator extends AbstractAttributeIterator<String>
    {
        @Override
        protected String getValue(final String attributeName)
        {
            return attributeName;
        }
    }

    private class Values extends AbstractAttributeSet<V>
    {
        @Override
        public Iterator<V> iterator()
        {
            return new ValuesIterator();
        }

        @Override
        public boolean contains(final Object o)
        {
            if (o == null)
            {
                return false;
            }

            for (final Iterator<V> it = iterator(); it.hasNext();)
            {
                if (o.equals(it.next()))
                {
                    return true;
                }
            }

            return false;
        }

        @Override
        public boolean remove(final Object o)
        {
            if (o == null)
            {
                return false;
            }

            for (final Iterator<V> it = iterator(); it.hasNext();)
            {
                if (o.equals(it.next()))
                {
                    it.remove();
                    return true;
                }
            }

            return false;
        }
    }

    private class ValuesIterator extends AbstractAttributeIterator<V>
    {
        @Override
        protected V getValue(final String attributeName)
        {
            return AbstractThreadSafeAttributeMap.this.get(attributeName);
File Line
org/apache/myfaces/push/cdi/WebsocketApplicationBean.java 51
org/apache/myfaces/push/cdi/WebsocketSessionBean.java 93
    }
    
    /**
     * Indicate if the channel mentioned is valid for view scope.
     * 
     * A channel is valid if there is at least one token that represents a valid connection to this channel.
     * 
     * @param channel
     * @return 
     */
    public boolean isChannelAvailable(String channel)
    {
        return channelTokenListMap.containsKey(channel);
    }
    
    public List<String> getChannelTokensFor(String channel)
    {
        List<WebsocketChannel> list = channelTokenListMap.get(channel);
        if (list != null && !list.isEmpty())
        {
            List<String> value = new ArrayList<String>(list.size());
            for (WebsocketChannel md : list)
            {
                value.add(md.getChannelToken());
            }
            return value;
        }
        return Collections.emptyList();
    }
    
    public <S extends Serializable> List<String> getChannelTokensFor(String channel, S user)
    {
        List<WebsocketChannel> list = channelTokenListMap.get(channel);
        if (list != null && !list.isEmpty())
        {
            List<String> value = new ArrayList<String>(list.size());
            for (WebsocketChannel md : list)
            {
                if (user.equals(md.getUser()))
                {
                    value.add(md.getChannelToken());
                }
            }
            return value;
        }
        return null;
    }
File Line
org/apache/myfaces/application/viewstate/SecureRandomCsrfSessionTokenFactory.java 35
org/apache/myfaces/push/cdi/SecureRandomCsrfSessionTokenFactory.java 34
class SecureRandomCsrfSessionTokenFactory extends CsrfSessionTokenFactory
{
    private final SessionIdGenerator sessionIdGenerator;
    private final int length;

    public SecureRandomCsrfSessionTokenFactory(FacesContext facesContext)
    {
        length = WebConfigParamUtils.getIntegerInitParameter(
            facesContext.getExternalContext(), 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM, 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM_DEFAULT);
        sessionIdGenerator = new SessionIdGenerator();
        sessionIdGenerator.setSessionIdLength(length);
        String secureRandomClass = WebConfigParamUtils.getStringInitParameter(
            facesContext.getExternalContext(), 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_CLASS_PARAM);
        if (secureRandomClass != null)
        {
            sessionIdGenerator.setSecureRandomClass(secureRandomClass);
        }
        String secureRandomProvider = WebConfigParamUtils.getStringInitParameter(
            facesContext.getExternalContext(), 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_PROVIDER_PARAM);
        if (secureRandomProvider != null)
        {
            sessionIdGenerator.setSecureRandomProvider(secureRandomProvider);
        }
        String secureRandomAlgorithm = WebConfigParamUtils.getStringInitParameter(
            facesContext.getExternalContext(), 
            StateCache.RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_ALGORITM_PARAM);
        if (secureRandomAlgorithm != null)
        {
            sessionIdGenerator.setSecureRandomAlgorithm(secureRandomAlgorithm);
        }
    }

    public byte[] generateKey(FacesContext facesContext)
    {
        byte[] array = new byte[length];
        sessionIdGenerator.getRandomBytes(array);
        return array;
    }

    @Override
    public String createCryptographicallyStrongTokenFromSession(FacesContext context)
    {
        byte[] key = generateKey(context);
        return DatatypeConverter.printHexBinary(key);
    }
}
File Line
org/apache/myfaces/renderkit/html/HtmlAjaxBehaviorRenderer.java 273
org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java 338
        retVal.append(",window.event,myfaces._impl._util._Lang.mixMaps(");
        
        Collection<ClientBehaviorContext.Parameter> params = context.getParameters();
        int paramSize = (params != null) ? params.size() : 0;

        List<String> parameterList = new ArrayList<>(paramSize + 2);
        if (executes != null)
        {
            parameterList.add(executes);
        }
        if (render != null)
        {
            parameterList.add(render);
        }
        if (onError != null)
        {
            parameterList.add(onError);
        }
        if (onEvent != null)
        {
            parameterList.add(onEvent);
        }
        if (delay != null)
        {
            parameterList.add(delay);
        }
        if (resetValues != null)
        {
            parameterList.add(resetValues);
        }
        if (paramSize > 0)
        {
            /**
             * see ClientBehaviorContext.html of the spec
             * the param list has to be added in the post back
             */
            // params are in 99% RamdonAccess instace created in
            // HtmlRendererUtils.getClientBehaviorContextParameters(Map<String, String>)
            if (params instanceof RandomAccess)
            {
                List<ClientBehaviorContext.Parameter> list = (List<ClientBehaviorContext.Parameter>) params;
                for (int i = 0, size = list.size(); i < size; i++)
                {
                    ClientBehaviorContext.Parameter param = list.get(i);
                    append(paramBuffer, parameterList, param.getName(), param.getValue());
File Line
org/apache/myfaces/view/facelets/compiler/TextUnit.java 464
org/apache/myfaces/view/facelets/compiler/TextUnit.java 598
            if (text != null && text.length() > 0)
            {
                int firstCharLocation = -1;
                int leftChar = 0; // 0=first char on left 1=\n 2=\r 3=\r\n
                int lenght = text.length();
                String leftText = null;
                for (int j = 0; j < lenght; j++)
                {
                    char c = text.charAt(j);
                    if (leftChar == 0)
                    {
                        if (c == '\r')
                        {
                            leftChar = 2;
                            if (j+1 < lenght)
                            {
                                if (text.charAt(j+1) == '\n')
                                {
                                    leftChar = 3;
                                }
                            }
                        }
                        if (c == '\n')
                        {
                            leftChar = 1;
                        }
                    }
                    if (Character.isWhitespace(c))
                    {
                        continue;
                    }
                    else
                    {
                        firstCharLocation = j;
                        break;
                    }
                }
                if (firstCharLocation == -1)
                {
                    firstCharLocation = lenght;
                }
                // Define the character on the left
                if (firstCharLocation > 0)
                {
                    switch (leftChar)
                    {
                        case 1:
                            leftText = "\n";
                            break;
                        case 2:
                            leftText = "\r";
                            break;
                        case 3:
                            leftText = "\r\n";
                            break;
                        default:
                            leftText = (lenght > 1) ? text.substring(0,1) : text;
                            break;
                    }                
                }
                else
                {
                    leftText = "";
                }
File Line
org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java 96
org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java 108
            facesContext.getAttributes().put(FaceletViewDeclarationLanguage.REFRESHING_TRANSIENT_BUILD,
                Boolean.TRUE);
            
            // Detect the relationship between parent and child, to ensure the component is properly created
            // and refreshed. In facelets this is usually done by core.FacetHandler, but since it is a 
            // dynamic component, we need to do it here before apply the handler
            UIComponent parent = component.getParent();
            String facetName = null;
            if (parent.getFacetCount() > 0 && !parent.getChildren().contains(component))
            {
                facetName = ComponentSupport.findFacetNameByComponentInstance(parent, component);
            }
            
            
            try
            {
                if (facetName != null)
                {
                    parent.getAttributes().put(org.apache.myfaces.view.facelets.tag.jsf.core.FacetHandler.KEY, 
                            facetName);
                }
                // The trick here is restore MARK_CREATED, just to allow ComponentTagHandlerDelegate to
                // find the component. Then we reset it to exclude it from facelets refresh algorithm.
                String markId = (String) component.getAttributes().get("oam.vf.GEN_MARK_ID");
                if (markId == null)
                {
                    ((AbstractFacelet)componentFacelet).applyDynamicComponentHandler(
                        facesContext, component, baseKey);
                }
                else
                {
                    try
                    {
                        component.getAttributes().put(ComponentSupport.MARK_CREATED, markId);
                        ((AbstractFacelet)componentFacelet).applyDynamicComponentHandler(
                            facesContext, component.getParent(), baseKey);
                    }
                    finally
                    {
                        component.getAttributes().put(ComponentSupport.MARK_CREATED, null);
                    }
                }
File Line
org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java 225
org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java 307
                if (Boolean.TRUE.equals(facet.getAttributes()
                             .get(FACET_CREATED_UIPANEL_MARKER)))
                {
                    // only check the children and facets of the panel
                    if (facet.getChildCount() > 0)
                    {
                        for (int i = 0, childCount = facet.getChildCount(); i < childCount; i ++)
                        {
                            UIComponent child = facet.getChildren().get(i);
                            if (id.equals(child.getAttributes().get(MARK_CREATED)))
                            {
                                return child;
                            }
                        }
                    }
                    if (facet.getFacetCount() > 0)
                    {
                        Iterator<UIComponent> itr2 = facet.getFacets().values().iterator();
                        while (itr2.hasNext())
                        {
                            UIComponent child = itr2.next();
                            if (id.equals(child.getAttributes().get(MARK_CREATED)))
                            {
                                return child;
                            }
                        }
                    }
                }
                else if (id.equals(facet.getAttributes().get(MARK_CREATED)))
                {
                    return facet;
                }
            }
        }

        return null;
    }
    
    public static String findChildInFacetsByTagId(UIComponent parent, String id)
File Line
org/apache/myfaces/taglib/core/ValidatorImplTag.java 116
org/apache/myfaces/taglib/core/ValidatorTag.java 72
    protected Validator createValidator() throws javax.servlet.jsp.JspException
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ELContext elContext = facesContext.getELContext();
        if (null != _binding)
        {
            Object validator;
            try
            {
                validator = _binding.getValue(elContext);
            }
            catch (Exception e)
            {
                throw new JspException("Error while creating the Validator", e);
            }
            if (validator instanceof Validator)
            {
                return (Validator)validator;
            }
        }
        Application application = facesContext.getApplication();
        Validator validator = null;
        try
        {
            // first check if an ValidatorId was set by a method
            if (null != _validatorIdString)
            {
                validator = application.createValidator(_validatorIdString);
            }
            else if (null != _validatorId)
            {
                String validatorId = (String)_validatorId.getValue(elContext);
                validator = application.createValidator(validatorId);
            }
        }
        catch (Exception e)
        {
            throw new JspException("Error while creating the Validator", e);
        }

        if (null != validator)
        {
            if (null != _binding)
            {
                _binding.setValue(elContext, validator);
            }
            return validator;
        }
        throw new JspException("validatorId and/or binding must be specified");
    }

}
File Line
org/apache/myfaces/config/annotation/NoInjectionAnnotationLifecycleProvider.java 41
org/apache/myfaces/spi/impl/NoInjectionAnnotationInjectionProvider.java 43
{
     /**
     * Cache the Method instances per ClassLoader using the Class-Name.
     * NOTE that we do it this way, because the only other valid way in order to support a shared
     * classloader scenario would be to use a WeakHashMap<Class<?>, Method[]>, but this
     * creates a cyclic reference between the key and the value of the WeakHashMap which will
     * most certainly cause a memory leak! Furthermore we can manually cleanup the Map when
     * the webapp is undeployed just by removing the Map for the current ClassLoader. 
     */
    private volatile static WeakHashMap<ClassLoader, Map<Class,Method[]> > declaredMethodBeans = 
            new WeakHashMap<ClassLoader, Map<Class, Method[]>>();

    private static Map<Class,Method[]> getDeclaredMethodBeansMap()
    {
        ClassLoader cl = ClassUtils.getContextClassLoader();
        
        Map<Class,Method[]> metadata = (Map<Class,Method[]>)
                declaredMethodBeans.get(cl);

        if (metadata == null)
        {
            // Ensure thread-safe put over _metadata, and only create one map
            // per classloader to hold metadata.
            synchronized (declaredMethodBeans)
            {
                metadata = createDeclaredMethodBeansMap(cl, metadata);
            }
        }

        return metadata;
    }
    
    private static Map<Class,Method[]> createDeclaredMethodBeansMap(
            ClassLoader cl, Map<Class,Method[]> metadata)
    {
        metadata = (Map<Class,Method[]>) declaredMethodBeans.get(cl);
        if (metadata == null)
        {
            metadata = new HashMap<Class,Method[]>();
            declaredMethodBeans.put(cl, metadata);
        }
        return metadata;
    }
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 114
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 102
        return _keySet;
    }

    @Override
    public final V put(final String key, final V value)
    {
        final V retval = getAttribute(key);
        setAttribute(key, value);
        return retval;
    }

    @Override
    public void putAll(final Map<? extends String, ? extends V> t)
    {
        for (final Entry<? extends String, ? extends V> entry : t.entrySet())
        {
            setAttribute(entry.getKey(), entry.getValue());
        }
    }

    @Override
    public final V remove(final Object key)
    {
        final String keyString = key.toString();
        final V retval = getAttribute(keyString);
        removeAttribute(keyString);
        return retval;
    }

    @Override
    public int size()
    {
        int size = 0;
        for (final Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
        {
            size++;
            e.nextElement();
        }
        return size;
    }

    @Override
    public Collection<V> values()
    {
File Line
org/apache/myfaces/config/impl/digester/elements/AttributeImpl.java 43
org/apache/myfaces/config/impl/digester/elements/PropertyImpl.java 52
    public void addDescription(String value)
    {
        if(_description == null)
        {
            _description = new ArrayList<String>();
        }

        _description.add(value);
    }

    public Collection<? extends String> getDescriptions()
    {
        if(_description == null)
        {
            return Collections.emptyList();
        }

        return _description;
    }

    public void addDisplayName(String value)
    {
        if(_displayName == null)
        {
            _displayName = new ArrayList<String>();
        }

        _displayName.add(value);
    }

    public Collection<? extends String> getDisplayNames()
    {
        if(_displayName==null)
        {
            return Collections.emptyList();
        }

        return _displayName;
    }

    public void addIcon(String value)
    {
        if(_icon == null)
        {
            _icon = new ArrayList<String>();
        }

        _icon.add(value);
    }

    public Collection<? extends String> getIcons()
    {
        if(_icon == null)
        {
            return Collections.emptyList();
        }

        return _icon;
    }

    public void setPropertyName(String propertyName)
File Line
org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java 239
org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java 220
                actx.popClient(this);
            }
        }
        finally
        {
            if (!_template.isLiteral())
            {
                fcc.endComponentUniqueIdSection();
            }
        }
        if (!_template.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS() &&
            !fcc.isRefreshingTransientBuild())
        {
            //Mark the parent component to be saved and restored fully.
            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
        }
        if (!_template.isLiteral() && fcc.isDynamicComponentSection())
        {
            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
        }
    }

    @Override
    public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
            FaceletException, ELException
    {
        if (name != null)
        {
            DefineHandler handler = _handlers.get(name);
            if (handler != null)
            {
                handler.applyDefinition(ctx, parent);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            this.nextHandler.apply(ctx, parent);
            return true;
        }
    }
}
File Line
org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java 87
org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java 115
            (_default == null || _default.isLiteral() ))
        {
            _cacheable = true;
        }
        else
        {
            _cacheable = false;
        }
    }

    @SuppressWarnings("unchecked")
    public void apply(FaceletContext ctx, UIComponent parent)
            throws IOException
    {
        UIComponent compositeBaseParent
                = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();

        CompositeComponentBeanInfo beanInfo = 
            (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
            .get(UIComponent.BEANINFO_KEY);
        
        if (beanInfo == null)
        {
            if (log.isLoggable(Level.SEVERE))
            {
                log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
            }
            return;
        }
        
        BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); 
        
        //1. Obtain the list mentioned as "targetList" on ViewDeclarationLanguage.retargetAttachedObjects
        List<AttachedObjectTarget> targetList = (List<AttachedObjectTarget>)
            beanDescriptor.getValue(
                    AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY);
        
        if (targetList == null)
        {
            //2. If not found create it and set
            targetList = new ArrayList<AttachedObjectTarget>();
            beanDescriptor.setValue(
                    AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY,
                    targetList);
        }
        
        //3. Create the instance of AttachedObjectTarget
        if (isCacheable())
        {
            if (_target == null)
            {
                _target = createAttachedObjectTarget(ctx);
            }
            targetList.add(_target);
        }
        else
        {
File Line
org/apache/myfaces/taglib/core/ConverterImplTag.java 106
org/apache/myfaces/taglib/core/ConverterTag.java 77
    protected Converter createConverter() throws JspException
    {
        Converter converter = null;

        FacesContext facesContext = FacesContext.getCurrentInstance();
        ELContext elContext = facesContext.getELContext();

        // try to create the converter from the binding expression first, and then from
        // the converterId
        if (_binding != null)
        {
            try
            {
                converter = (Converter)_binding.getValue(elContext);

                if (converter != null)
                {
                    return converter;
                }
            }
            catch (Exception e)
            {
                throw new JspException("Exception creating converter using binding", e);
            }
        }

        if ((_converterId != null) || (_converterIdString != null))
        {
            try
            {
                if (null != _converterIdString)
                {
                    converter = facesContext.getApplication().createConverter(_converterIdString);
                }
                else
                {
                    String converterId = (String)_converterId.getValue(elContext);
                    converter = facesContext.getApplication().createConverter(converterId);
                }

                // with binding no converter was created, set its value with the converter
                // created using the converterId
                if (converter != null && _binding != null)
                {
                    _binding.setValue(elContext, converter);
                }
            }
            catch (Exception e)
            {
                throw new JspException("Exception creating converter with converterId: " + _converterId, e);
            }
        }
File Line
org/apache/myfaces/config/annotation/NoInjectionAnnotationLifecycleProvider.java 117
org/apache/myfaces/spi/impl/NoInjectionAnnotationInjectionProvider.java 130
    {
        // TODO the servlet spec is not clear about searching in superclass??
        Class clazz = instance.getClass();
        Method[] methods = getDeclaredMethods(clazz);
        if (methods == null)
        {
            methods = clazz.getDeclaredMethods();
            Map<Class,Method[]> declaredMethodBeansMap = getDeclaredMethodBeansMap();
            synchronized(declaredMethodBeansMap)
            {
                declaredMethodBeansMap.put(clazz, methods);
            }
        }
        Method postConstruct = null;
        for (int i = 0; i < methods.length; i++)
        {
            Method method = methods[i];
            if (method.isAnnotationPresent(PostConstruct.class))
            {
                // a method that does not take any arguments
                // the method must not be static
                // must not throw any checked expections
                // the return value must be void
                // the method may be public, protected, package private or private

                if ((postConstruct != null)
                        || (method.getParameterTypes().length != 0)
                        || (Modifier.isStatic(method.getModifiers()))
                        || (method.getExceptionTypes().length > 0)
                        || (!method.getReturnType().getName().equals("void")))
                {
                    throw new IllegalArgumentException("Invalid PostConstruct annotation");
                }
                postConstruct = method;
            }
        }
File Line
org/apache/myfaces/renderkit/html/HtmlAjaxBehaviorRenderer.java 217
org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java 286
            paramBuffer.append(':');
            paramBuffer.append(resetValues);
            resetValues = paramBuffer.toString();
        }
        else
        {
            resetValues = null;
        }

        String sourceId = null;
        if (context.getSourceId() == null)
        {
            sourceId = AJAX_VAL_THIS;
        }
        else
        {
            paramBuffer.setLength(0);
            paramBuffer.append('\'');
            paramBuffer.append(context.getSourceId());
            paramBuffer.append('\'');
            sourceId = paramBuffer.toString();

            if (!context.getSourceId().trim().equals(
                context.getComponent().getClientId(context.getFacesContext())))
            {
                // Check if sourceId is not a clientId and there is no execute set
                UIComponent ref = context.getComponent();
                ref = (ref.getParent() == null) ? ref : ref.getParent();
                UIComponent instance = null;
                try
                {
                    instance = ref.findComponent(context.getSourceId());
                }
                catch (IllegalArgumentException e)
                {
                    // No Op
                }
                if (instance == null && executes == null)
                {
File Line
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java 145
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java 199
                {
                    tempBeanInfo = _createCompositeComponentMetadata(compositeBaseParent);
                    compositeBaseParent.getAttributes().put(
                            UIComponent.BEANINFO_KEY, tempBeanInfo);
                    
                    try
                    {
                        mctx.pushCompositeComponentToStack(compositeBaseParent);
                        
                        // Store the ccLevel key here
                        if (!compositeBaseParent.getAttributes().containsKey(CompositeComponentELUtils.LEVEL_KEY))
                        {
                            compositeBaseParent.getAttributes()
                                .put(CompositeComponentELUtils.LEVEL_KEY, mctx.getCompositeComponentLevel());
                        }
                    
                        _nextHandler.apply(ctx, parent);
                        
                        Collection<String> declaredDefaultValues = null;
                        
                        for (PropertyDescriptor pd : tempBeanInfo.getPropertyDescriptors())
                        {
                            if (pd.getValue("default") != null)
                            {
                                if (declaredDefaultValues  == null)
                                {
                                    declaredDefaultValues = new ArrayList<String>();
                                }
                                declaredDefaultValues.add(pd.getName());
                            }
                        }
                        if (declaredDefaultValues == null)
                        {
                            declaredDefaultValues = Collections.emptyList();
                        }
                        tempBeanInfo.getBeanDescriptor().
                                setValue(UIComponent.ATTRS_WITH_DECLARED_DEFAULT_VALUES, declaredDefaultValues);
                    }
                    finally
                    {
                        mctx.popCompositeComponentToStack();
File Line
org/apache/myfaces/config/annotation/DefaultLifecycleProviderFactory.java 211
org/apache/myfaces/spi/impl/DefaultInjectionProviderFactory.java 215
                                                               discoverableInjectionProvider);
                            return (Boolean) true;
                        }
                    }
                }
            }
        }
        catch (ClassNotFoundException e)
        {
            // ignore
        }
        catch (NoClassDefFoundError e)
        {
            // ignore
        }
        catch (InstantiationException e)
        {
            log.log(Level.SEVERE, "", e);
        }
        catch (IllegalAccessException e)
        {
            log.log(Level.SEVERE, "", e);
        }
        catch (InvocationTargetException e)
        {
            log.log(Level.SEVERE, "", e);
        }
        catch (PrivilegedActionException e)
        {
            throw new FacesException(e);
        }
        return returnValue;
    }

    private Object createClass(String className, ExternalContext externalContext)
            throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
    {
        Class<?> clazz = ClassUtils.classForName(className);

        try
        {
            return ClassUtils.newInstance(clazz, new Class<?>[]{ ExternalContext.class }, externalContext);
        }
        catch (NoSuchMethodException e)
        {
            return ClassUtils.newInstance(clazz);
        }
    }

    private InjectionProvider resolveFallbackInjectionProvider()
File Line
org/apache/myfaces/view/facelets/component/UIRepeat.java 414
org/apache/myfaces/view/facelets/component/UIRepeat.java 457
                UIComponent component = parent.getChildren().get(i);

                // reset the client id (see spec 3.1.6)
                component.setId(component.getId());
                if (!component.isTransient())
                {
                    if (descendantStateIndex == -1)
                    {
                        stateCollection = ((List<? extends Object[]>) state);
                        descendantStateIndex = stateCollection.isEmpty() ? -1 : 0;
                    }
                    
                    if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size())
                    {
                        Object[] object = stateCollection.get(descendantStateIndex);
                        if (object[0] != null && component instanceof EditableValueHolder)
                        {
                            ((SavedState) object[0]).restoreState((EditableValueHolder) component);
                        }
                        // If there is descendant state to restore, call it recursively, otherwise
                        // it is safe to skip iteration.
                        if (object[1] != null)
                        {
                            restoreDescendantComponentStates(component, restoreChildFacets, object[1], true);
                        }
                        else
                        {
                            restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
                        }
                    }
                    else
                    {
                        restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
                    }
                    descendantStateIndex++;
                }
            }
        }
File Line
org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java 153
org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java 132
                if (!facesContext.isProjectStage(ProjectStage.Production))
                {
                    facesContext.addMessage(component.getClientId(facesContext), 
                            new FacesMessage("Component with no name and no body content, so nothing rendered."));
                }
            }            
        }
    }
    
    @Override
    public void encodeEnd(FacesContext facesContext, UIComponent component)
            throws IOException
    {
        super.encodeEnd(facesContext, component); //check for NP
        
        Map<String, Object> componentAttributesMap = component.getAttributes();
        String resourceName = (String) componentAttributesMap.get(JSFAttr.NAME_ATTR);
        String libraryName = (String) componentAttributesMap.get(JSFAttr.LIBRARY_ATTR);

        if (resourceName == null)
        {
            //log.warn("Trying to encode resource represented by component" + 
            //        component.getClientId() + " without resourceName."+
            //        " It will be silenty ignored.");
            return;
        }
        if ("".equals(resourceName))
        {
            return;
        }
        
        String additionalQueryParams = null;
        int index = resourceName.indexOf('?');
        if (index >= 0)
        {
            additionalQueryParams = resourceName.substring(index + 1);
            resourceName = resourceName.substring(0, index);
        }
        
        Resource resource;
        if (libraryName == null)
        {
            if (ResourceUtils.isRenderedStylesheet(facesContext, libraryName, resourceName))
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 324
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 559
            if (inDocument && inCompositeInterface && 
                    !unit.getFaceletsProcessingInstructions().isConsumeXMLComments())
            {
                this.unit.writeComment(new String(ch, start, length));
            }
        }

        protected TagAttributes createAttributes(Attributes attrs)
        {
            int len = attrs.getLength();
            TagAttribute[] ta = new TagAttribute[len];
            for (int i = 0; i < len; i++)
            {
                ta[i] = new TagAttributeImpl(this.createLocation(), attrs.getURI(i), attrs.getLocalName(i), attrs
                        .getQName(i), attrs.getValue(i));
            }
            return new TagAttributesImpl(ta);
        }

        protected Location createLocation()
        {
            return new Location(this.alias, this.locator.getLineNumber(), this.locator.getColumnNumber());
        }

        public void endCDATA() throws SAXException
        {
            if (this.inDocument && inCompositeInterface)
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 116
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 324
            if (this.inDocument && inMetadata && !unit.getFaceletsProcessingInstructions().isConsumeXMLComments())
            {
                this.unit.writeComment(new String(ch, start, length));
            }
        }

        protected TagAttributes createAttributes(Attributes attrs)
        {
            int len = attrs.getLength();
            TagAttribute[] ta = new TagAttribute[len];
            for (int i = 0; i < len; i++)
            {
                ta[i] = new TagAttributeImpl(this.createLocation(), attrs.getURI(i), attrs.getLocalName(i), attrs
                        .getQName(i), attrs.getValue(i));
            }
            return new TagAttributesImpl(ta);
        }

        protected Location createLocation()
        {
            return new Location(this.alias, this.locator.getLineNumber(), this.locator.getColumnNumber());
        }

        public void endCDATA() throws SAXException
        {
            if (this.inDocument && inMetadata)
File Line
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageStrategy.java 100
org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java 106
            if (mappings == null)
            {
                return null;
            }

            // Make sure the mappings contain something
            mappings = mappings.trim();
            if (mappings.length() == 0)
            {
                return null;
            }

            return Pattern.compile(toRegex(mappings));
        }

        private String loadFaceletExtension(ExternalContext context)
        {
            assert context != null;

            String suffix = context.getInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME);
            if (suffix == null)
            {
                suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
            }
            else
            {
                suffix = suffix.trim();
                if (suffix.length() == 0)
                {
                    suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
                }
            }

            return suffix;
        }
        
        /**
         * Convert the specified mapping string to an equivalent regular expression.
         * 
         * @param mappings
         *            le mapping string
         * 
         * @return an uncompiled regular expression representing the mappings
         */
        private String toRegex(String mappings)
        {
            assert mappings != null;

            // Get rid of spaces
            mappings = mappings.replaceAll("\\s", "");

            // Escape '.'
            mappings = mappings.replaceAll("\\.", "\\\\.");

            // Change '*' to '.*' to represent any match
            mappings = mappings.replaceAll("\\*", ".*");

            // Split the mappings by changing ';' to '|'
            mappings = mappings.replaceAll(";", "|");

            return mappings;
        }
File Line
org/apache/myfaces/application/viewstate/RandomKeyFactory.java 75
org/apache/myfaces/application/viewstate/SecureRandomKeyFactory.java 97
        sessionIdGenerator.getRandomBytes(array);
        for (int i = 0; i < array.length; i++)
        {
            key[i] = array[i];
        }
        int value = generateCounterKey(facesContext);
        key[array.length] = (byte) (value >>> 24);
        key[array.length + 1] = (byte) (value >>> 16);
        key[array.length + 2] = (byte) (value >>> 8);
        key[array.length + 3] = (byte) (value);
        return key;
    }

    @Override
    public String encode(byte[] key)
    {
        return DatatypeConverter.printHexBinary(key);
    }

    @Override
    public byte[] decode(String value)
    {
        try
        {
            return DatatypeConverter.parseHexBinary(value);
        }
        catch (IllegalArgumentException ex)
        {
            // Cannot decode, ignore silently, later it will be handled as
            // ViewExpiredException
        }
        return null;
    }
    
}
File Line
org/apache/myfaces/config/annotation/DefaultAnnotationProvider.java 682
org/apache/myfaces/config/util/JarUtils.java 34
    public static JarFile getJarFile(URL url) throws IOException
    {
        URLConnection conn = url.openConnection();
        conn.setUseCaches(false);
        conn.setDefaultUseCaches(false);

        JarFile jarFile;
        if (conn instanceof JarURLConnection)
        {
            jarFile = ((JarURLConnection) conn).getJarFile();
        }
        else
        {
            jarFile = _getAlternativeJarFile(url);
        }
        return jarFile;
    }
    
    /**
     * taken from org.apache.myfaces.view.facelets.util.Classpath
     * 
     * For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile
     * object all the same. Known servlet engines that function like this include Weblogic and OC4J. This is not a full
     * solution, since an unpacked WAR or EAR will not have JAR "files" as such.
     */
    private static JarFile _getAlternativeJarFile(URL url) throws IOException
    {
        String urlFile = url.getFile();

        // Trim off any suffix - which is prefixed by "!/" on Weblogic
        int separatorIndex = urlFile.indexOf("!/");

        // OK, didn't find that. Try the less safe "!", used on OC4J
        if (separatorIndex == -1)
        {
            separatorIndex = urlFile.indexOf('!');
        }

        if (separatorIndex != -1)
        {
            String jarFileUrl = urlFile.substring(0, separatorIndex);
            // And trim off any "file:" prefix.
            if (jarFileUrl.startsWith("file:"))
            {
                jarFileUrl = jarFileUrl.substring("file:".length());
            }

            return new JarFile(jarFileUrl);
        }

        return null;
    }
File Line
org/apache/myfaces/cdi/behavior/FacesBehaviorCDIWrapper.java 61
org/apache/myfaces/cdi/behavior/FacesClientBehaviorCDIWrapper.java 83
                    ClientBehavior.class, true, new FacesBehaviorAnnotationLiteral(behaviorId, true));
        }
        return delegate;
    }
    
    @Override
    public Object saveState(FacesContext context)
    {
        if (!initialStateMarked())
        {
            Object values[] = new Object[1];
            values[0] = behaviorId;
            return values;
        }
        return null;
    }

    @Override
    public void restoreState(FacesContext context, Object state)
    {
        if (state != null)
        {
            Object values[] = (Object[])state;
            behaviorId = (String)values[0];
        }
    }

    @Override
    public boolean isTransient()
    {
        return _transient;
    }

    @Override
    public void setTransient(boolean newTransientValue)
    {
        _transient = newTransientValue;
    }

    private boolean _initialStateMarked = false;

    public void clearInitialState()
    {
        _initialStateMarked = false;
    }

    public boolean initialStateMarked()
    {
        return _initialStateMarked;
    }

    public void markInitialState()
    {
        _initialStateMarked = true;
    }

}
File Line
org/apache/myfaces/application/ApplicationImpl.java 1888
org/apache/myfaces/application/ApplicationImpl.java 2480
        }
        
        if(dependencyList == null)  //not in production or the class hasn't been inspected yet
        {   
            ResourceDependency dependency = inspectedClass.getAnnotation(ResourceDependency.class);
            ResourceDependencies dependencies = inspectedClass.getAnnotation(ResourceDependencies.class);
            if(dependency != null || dependencies != null)
            {
                //resource dependencies were found using one or both annotations, create and build a new list
                dependencyList = new ArrayList<ResourceDependency>();
                
                if(dependency != null)
                {
                    dependencyList.add(dependency);
                }
                
                if(dependencies != null)
                {
                    dependencyList.addAll(Arrays.asList(dependencies.value()));
                }
            }
            else
            {
                dependencyList = Collections.emptyList();
            }
        }        
 
        // resource dependencies were found through inspection or from cache, handle them
        if (dependencyList != null && !dependencyList.isEmpty()) 
        {
            for (int i = 0, size = dependencyList.size(); i < size; i++)
            {
                ResourceDependency dependency = dependencyList.get(i);
                if (!rvc.isResourceDependencyAlreadyProcessed(dependency))
                {
File Line
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionActionListener.java 54
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionValueChangeListener.java 55
        getMethodExpression().invoke(FacesContext.getCurrentInstance().getELContext(), new Object[]{event});
    }

    private MethodExpression getMethodExpression()
    {
        return getMethodExpression(FacesContext.getCurrentInstance().getELContext());
    }
    
    private MethodExpression getMethodExpression(ELContext context)
    {
        Object meOrVe = valueExpression.getValue(context);
        if (meOrVe instanceof MethodExpression)
        {
            return (MethodExpression) meOrVe;
        }
        else if (meOrVe instanceof ValueExpression)
        {
            while (meOrVe != null && meOrVe instanceof ValueExpression)
            {
                meOrVe = ((ValueExpression)meOrVe).getValue(context);
            }
            return (MethodExpression) meOrVe;
        }
        else
        {
            return null;
        }
    }

    public ValueExpression getWrapped()
    {
        return valueExpression;
    }
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    {
        this.valueExpression = (ValueExpression) in.readObject();
    }

    public void writeExternal(ObjectOutput out) throws IOException
    {
        out.writeObject(this.valueExpression);
    }

}
File Line
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionActionListener.java 54
org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java 128
        return valueExpression.isLiteralText();
    }
    
    private MethodExpression getMethodExpression()
    {
        return getMethodExpression(FacesContext.getCurrentInstance().getELContext());
    }
    
    private MethodExpression getMethodExpression(ELContext context)
    {
        Object meOrVe = valueExpression.getValue(context);
        if (meOrVe instanceof MethodExpression)
        {
            return (MethodExpression) meOrVe;
        }
        else if (meOrVe instanceof ValueExpression)
        {
            while (meOrVe != null && meOrVe instanceof ValueExpression)
            {
                meOrVe = ((ValueExpression)meOrVe).getValue(context);
            }
            return (MethodExpression) meOrVe;
        }
        else
        {
            return null;
        }
    }

    public ValueExpression getWrapped()
    {
        return valueExpression;
    }
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    {
        this.valueExpression = (ValueExpression) in.readObject();
    }

    public void writeExternal(ObjectOutput out) throws IOException
    {
        out.writeObject(this.valueExpression);
    }
}
File Line
org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java 103
org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java 86
        }
    }
    
    @Override
    public boolean getRendersChildren()
    {
        return true;
    }

    @Override
    public void encodeChildren(FacesContext facesContext, UIComponent component)
            throws IOException
    {
        if (facesContext == null)
        {
            throw new NullPointerException("context");
        }
        if (component == null)
        {
            throw new NullPointerException("component");
        }

        Map<String, Object> componentAttributesMap = component.getAttributes();
        String resourceName = (String) componentAttributesMap.get(JSFAttr.NAME_ATTR);
        boolean hasChildren = component.getChildCount() > 0;
        
        if (resourceName != null && (!"".equals(resourceName)) )
        {
            if (hasChildren)
            {
                log.info("Component with resourceName "+ resourceName + 
                        " and child components found. Child components will be ignored.");
            }
        }
        else
        {
            if (hasChildren)
            {
                ResponseWriter writer = facesContext.getResponseWriter();
                writer.startElement(HTML.STYLE_ELEM, component);
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 398
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 385
            return AbstractThreadSafeAttributeMap.this.put(_currentKey, value);
        }

        @Override
        public int hashCode()
        {
            int result = 1;
            result = 31 * result + ((_currentKey == null) ? 0 : _currentKey.hashCode());
            return result;
        }

        @Override
        public boolean equals(final Object obj)
        {
            if (this == obj)
            {
                return true;
            }
            if (obj == null)
            {
                return false;
            }
            if (getClass() != obj.getClass())
            {
                return false;
            }
            final EntrySetEntry other = (EntrySetEntry)obj;
            if (_currentKey == null)
            {
                if (other._currentKey != null)
                {
                    return false;
                }
            }
            else if (!_currentKey.equals(other._currentKey))
            {
                return false;
            }
            return true;
        }

    }
}
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 157
org/apache/myfaces/view/facelets/tag/jstl/core/LegacyForEachHandler.java 155
    public LegacyForEachHandler(TagConfig config)
    {
        super(config);
        this.items = this.getAttribute("items");
        this.var = this.getAttribute("var");
        this.begin = this.getAttribute("begin");
        this.end = this.getAttribute("end");
        this.step = this.getAttribute("step");
        this.varStatus = this.getAttribute("varStatus");
        this.tranzient = this.getAttribute("transient");

        if (this.items == null && this.begin != null && this.end == null)
        {
            throw new TagAttributeException(this.tag, this.begin,
                                            "If the 'items' attribute is not specified, but the 'begin' attribute is, "
                                            + "then the 'end' attribute is required");
        }
    }

    @Override
    public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {

        int s = this.getBegin(ctx);
File Line
org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java 234
org/apache/myfaces/view/facelets/tag/composite/CompositeMetaRulesetImpl.java 152
            MetadataTarget target = this._getMetadataTarget();
            int ruleEnd = _rules.size() - 1;

            // now iterate over attributes
            for (Map.Entry<String, TagAttribute> entry : _attributes.entrySet())
            {
                Metadata data = null;

                int i = ruleEnd;

                // First loop is always safe
                do
                {
                    MetaRule rule = _rules.get(i);
                    data = rule.applyRule(entry.getKey(), entry.getValue(), target);
                    i--;
                } while (data == null && i >= 0);

                if (data == null)
                {
                    if (log.isLoggable(Level.SEVERE))
                    {
                        log.severe(entry.getValue() + " Unhandled by MetaTagHandler for type " + _type.getName());
                    }
                }
                else
                {
                    _mappers.add(data);
                }
            }
        }

        if (_mappers.isEmpty())
File Line
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 379
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 564
                sortedList.add(resource);
            }
        }

        //Check
        for (int i = 0; i < sortedList.size(); i++)
        {
            FacesConfig resource = sortedList.get(i);

            if (resource.getOrdering() != null)
            {
                for (OrderSlot slot : resource.getOrdering().getBeforeList())
                {
                    if (slot instanceof FacesConfigNameSlot)
                    {
                        String name = ((FacesConfigNameSlot) slot).getName();
                        if (name != null && !"".equals(name))
                        {
                            boolean founded = false;
                            for (int j = i-1; j >= 0; j--)
                            {
                                if (name.equals(sortedList.get(j).getName()))
                                {
                                    founded=true;
                                    break;
                                }
                            }
                            if (founded)
                            {
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 346
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 562
                    }

                    try
                    {
                        fcc.startComponentUniqueIdSection(base);

                        setVar(ctx, parent, uniqueId, base, t, src, srcVE, value, v, i);

                        boolean last = !itr.hasNext();
                        // set the varStatus
                        if (vs != null)
                        {
                            IterationStatus itrS = new IterationStatus(first, last, i, sO, eO, mO, value);
                            ValueExpression ve;
                            if (t || srcVE == null)
                            {
                                if (srcVE == null)
                                {
                                    ve = null;
                                }
                                else
                                {
                                    ve = ctx.getExpressionFactory().createValueExpression(
                                                itrS, Object.class);
                                }
                            }
                            else
                            {
                                ve = new IterationStatusExpression(itrS);
                            }
                            setVar(ctx, parent, uniqueId, base+"_vs", vs, ve, srcVE);
                        }
File Line
org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java 168
org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java 147
            String restoredPath = (String) ComponentSupport.restoreInitialTagState(ctx, fcc, parent, uniqueId);
            if (restoredPath != null)
            {
                // If is not restore view phase, the path value should be
                // evaluated and if is not equals, trigger markInitialState stuff.
                if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                {
                    path = this._template.getValue(ctx);
                    if (path == null || path.length() == 0)
                    {
                        return;
                    }
                    if (!path.equals(restoredPath))
                    {
                        markInitialState = true;
                    }
                }
                else
                {
                    path = restoredPath;
                }
            }
            else
            {
                //No state restored, calculate path
                path = this._template.getValue(ctx);
            }
            ComponentSupport.saveInitialTagState(ctx, fcc, parent, uniqueId, path);
        }
        else
        {
            path = _template.getValue(ctx);
        }
        try
        {
File Line
org/apache/myfaces/push/cdi/PushContextImpl.java 59
org/apache/myfaces/push/cdi/PushContextImpl.java 145
    public <S extends Serializable> Map<S, Set<Future<Void>>> send(Object message, Collection<S> users)
    {
        //1. locate the channel and define the context
        String channel = getChannel();
        BeanManager beanManager = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null)
        {
            beanManager = CDIUtils.getBeanManager(facesContext.getExternalContext());
        }
        else
        {
            beanManager = CDI.current().getBeanManager();
        }
        
        WebsocketApplicationBean appTokenBean = CDIUtils.getInstance(beanManager, 
                WebsocketApplicationBean.class, false);
        WebsocketViewBean viewTokenBean = null;
        WebsocketSessionBean sessionTokenBean = null;
        
        if (CDIUtils.isSessionScopeActive(beanManager))
        {
            sessionTokenBean = CDIUtils.getInstance(beanManager, WebsocketSessionBean.class, false);
            if (CDIUtils.isViewScopeActive(beanManager))
            {
                viewTokenBean = CDIUtils.getInstance(beanManager, WebsocketViewBean.class, false);
            }
        }
        
        if (appTokenBean == null)
        {
            // No base bean to push message
            return Collections.emptyMap();
File Line
org/apache/myfaces/view/facelets/tag/ui/LegacyCompositionHandler.java 82
org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java 88
        _handlers = new HashMap<String, DefineHandler>();

        for (DefineHandler handler : TagHandlerUtils.findNextByType(nextHandler, DefineHandler.class))
        {
            _handlers.put(handler.getName(), handler);
            if (log.isLoggable(Level.FINE))
            {
                log.fine(tag + " found Define[" + handler.getName() + "]");
            }
        }

        Collection<LegacyParamHandler> params = TagHandlerUtils.findNextByType(nextHandler, 
                LegacyParamHandler.class);
        if (!params.isEmpty())
        {
            int i = 0;
            _params = new LegacyParamHandler[params.size()];
            for (LegacyParamHandler handler : params)
            {
                _params[i++] = handler;
            }
        }
        else
        {
            _params = null;
        }
    }
File Line
org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java 80
org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java 88
        _handlers = new HashMap<String, DefineHandler>();

        for (DefineHandler handler : TagHandlerUtils.findNextByType(nextHandler, DefineHandler.class))
        {
            _handlers.put(handler.getName(), handler);
            if (log.isLoggable(Level.FINE))
            {
                log.fine(tag + " found Define[" + handler.getName() + "]");
            }
        }

        Collection<ParamHandler> params = TagHandlerUtils.findNextByType(nextHandler, ParamHandler.class);
        if (!params.isEmpty())
        {
            int i = 0;
            _params = new ParamHandler[params.size()];
            for (ParamHandler handler : params)
            {
                _params[i++] = handler;
            }
        }
        else
        {
            _params = null;
        }
    }
File Line
org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java 175
org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java 236
        FlowReference reference = flowBeanReferences.get(((Bean)bean).getBeanClass());
        if (reference != null)
        {
            String flowMapKey = FlowUtils.getFlowMapKey(facesContext, reference);
            if (flowMapKey != null)
            {
                ContextualStorage storage = getContextualStorage(false, flowMapKey);
                if (storage != null)
                {
                    Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                    ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                    if (contextualInstanceInfo != null)
                    {
                        return (T) contextualInstanceInfo.getContextualInstance();
                    }
                }
            }
            else
            {
                throw new IllegalStateException("Flow "+ reference.getId()+
                    " cannot be found when resolving bean " + bean.toString());
            }
File Line
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 928
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 978
            for (OrderSlot slot : facesConfig.getOrdering().getAfterList())
            {
                if (slot instanceof FacesConfigNameSlot)
                {
                    FacesConfigNameSlot nameSlot = (FacesConfigNameSlot) slot;
                    //The resource pointed is not added yet?
                    boolean alreadyAdded = false;
                    for (FacesConfig res : postOrderedList)
                    {
                        if (nameSlot.getName().equals(res.getName()))
                        {
                            alreadyAdded = true;
                            break;
                        }
                    }
                    if (!alreadyAdded)
                    {
                        int indexSlot = -1;
                        //Find it
                        for (int i = 0; i < appConfigResources.size(); i++)
                        {
                            FacesConfig resource = appConfigResources.get(i);
                            if (resource.getName() != null && nameSlot.getName().equals(resource.getName()))
                            {
                                indexSlot = i;
                                break;
                            }
                        }

                        //Resource founded on appConfigResources
                        if (indexSlot != -1)
                        {
                            pointingResource = true;
File Line
org/apache/myfaces/config/annotation/NoInjectionAnnotationLifecycleProvider.java 160
org/apache/myfaces/spi/impl/NoInjectionAnnotationInjectionProvider.java 182
    {

        // TODO the servlet spec is not clear about searching in superclass??
        // May be only check non private fields and methods
        Class clazz = instance.getClass();
        Method[] methods = getDeclaredMethods(clazz);
        Method preDestroy = null;
        for (int i = 0; i < methods.length; i++)
        {
            Method method = methods[i];
            if (method.isAnnotationPresent(PreDestroy.class))
            {
                // must not throw any checked expections
                // the method must not be static
                // must not throw any checked expections
                // the return value must be void
                // the method may be public, protected, package private or private

                if ((preDestroy != null)
                        || (method.getParameterTypes().length != 0)
                        || (Modifier.isStatic(method.getModifiers()))
                        || (method.getExceptionTypes().length > 0)
                        || (!method.getReturnType().getName().equals("void")))
                {
                    throw new IllegalArgumentException("Invalid PreDestroy annotation");
                }
                preDestroy = method;
            }
        }
File Line
org/apache/myfaces/application/viewstate/RandomKeyFactory.java 45
org/apache/myfaces/application/viewstate/SecureRandomKeyFactory.java 68
    }

    public Integer generateCounterKey(FacesContext facesContext)
    {
        ExternalContext externalContext = facesContext.getExternalContext();
        Object sessionObj = externalContext.getSession(true);
        Integer sequence;
        synchronized (sessionObj) // are handled at the same time for the session
        {
            Map<String, Object> map = externalContext.getSessionMap();
            sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
            if (sequence == null || sequence == Integer.MAX_VALUE)
            {
                sequence = 1;
            }
            else
            {
                sequence = sequence + 1;
            }
            map.put(RendererUtils.SEQUENCE_PARAM, sequence);
        }
        return sequence;
    }

    @Override
    public byte[] generateKey(FacesContext facesContext)
    {
        byte[] array = new byte[length];
        byte[] key = new byte[length + 4];
File Line
org/apache/myfaces/cdi/scope/FacesScopedContextImpl.java 95
org/apache/myfaces/cdi/scope/ViewTransientScopedContextImpl.java 98
        else if (facesContext.getViewRoot() == null)
        {
            return false;
        }
        return true;
    }

    @Override
    public <T> T get(Contextual<T> bean)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        checkActive(facesContext);

        if (facesContext != null)
        {
            ContextualStorage storage = getContextualStorage(false, facesContext);
            if (storage != null)
            {
                Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                if (contextualInstanceInfo != null)
                {
                    return (T) contextualInstanceInfo.getContextualInstance();
                }
            }
        }
        else
        {
            throw new IllegalStateException("FacesContext cannot be found when resolving bean " +bean.toString());
        }
        return null;
    }
File Line
org/apache/myfaces/view/facelets/el/ELText.java 194
org/apache/myfaces/view/facelets/el/ELText.java 330
        }

        public void write(Writer out, ELContext ctx) throws ELException, IOException
        {
            Object v = this.ve.getValue(ctx);
            if (v != null)
            {
                out.write((String) v);
            }
        }

        public String toString(ELContext ctx) throws ELException
        {
            Object v = this.ve.getValue(ctx);
            if (v != null)
            {
                return v.toString();
            }

            return null;
        }

        public void writeText(ResponseWriter out, ELContext ctx) throws ELException, IOException
        {
            Object v = this.ve.getValue(ctx);
            if (v != null)
            {
                out.writeText((String) v, null);
            }
        }
    }
File Line
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java 1072
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java 1705
                    ValueExpression methodSignatureExpression
                            = (ValueExpression) propertyDescriptor.getValue("method-signature");
                    String methodSignature = null;
                    if (methodSignatureExpression != null)
                    {
                        // Check if the value expression holds a method signature
                        // Note that it could be null, so in that case we don't have to do anything
                        methodSignature = (String) methodSignatureExpression.getValue(elContext);
                    }

                    String targetAttributeName = null;
                    ValueExpression targetAttributeNameVE = (ValueExpression) 
                        propertyDescriptor.getValue("targetAttributeName");
                    if (targetAttributeNameVE != null)
                    {
                        targetAttributeName = (String) targetAttributeNameVE.getValue(context.getELContext());
                        if (targetAttributeName == null)
                        {
                            targetAttributeName = attributeName;
                        }
                    }
                    else
                    {
                        targetAttributeName = attributeName;
                    }

                    boolean isKnownTargetAttributeMethod = "action".equals(targetAttributeName)
                            || "actionListener".equals(targetAttributeName)
                            || "validator".equals(targetAttributeName)
                            || "valueChangeListener".equals(targetAttributeName);

                    // either the attributeName has to be a knownMethod or there has to be a method-signature
                    if (isKnownTargetAttributeMethod || methodSignature != null)
                    {
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 309
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 296
            return AbstractThreadSafeAttributeMap.this.get(attributeName);
        }
    }

    private final class EntrySet extends AbstractAttributeSet<Entry<String, V>>
    {
        @Override
        public Iterator<Entry<String, V>> iterator()
        {
            return new EntryIterator();
        }

        @SuppressWarnings("unchecked")
        @Override
        public boolean contains(final Object o)
        {
            if (!(o instanceof Entry))
            {
                return false;
            }

            final Entry<String, V> entry = (Entry<String, V>)o;
            final Object key = entry.getKey();
            final Object value = entry.getValue();
            if (key == null || value == null)
            {
                return false;
            }

            return value.equals(AbstractThreadSafeAttributeMap.this.get(key));
File Line
org/apache/myfaces/application/TreeStructureManager.java 142
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java 1632
                UIComponent child = internalRestoreTreeStructure(structChild);
                facetMap.put(facetName, child);
            }
        }

        return component;
    }

    public static class TreeStructComponent implements Serializable
    {
        private static final long serialVersionUID = 5069109074684737231L;
        private String _componentClass;
        private String _componentId;
        private TreeStructComponent[] _children = null; // Array of children
        private Object[] _facets = null; // Array of Array-tuples with Facetname and TreeStructComponent

        TreeStructComponent(String componentClass, String componentId)
        {
            _componentClass = componentClass;
            _componentId = componentId;
        }

        public String getComponentClass()
        {
            return _componentClass;
        }

        public String getComponentId()
        {
            return _componentId;
        }

        void setChildren(TreeStructComponent[] children)
        {
            _children = children;
        }

        TreeStructComponent[] getChildren()
        {
            return _children;
        }

        Object[] getFacets()
        {
            return _facets;
        }

        void setFacets(Object[] facets)
        {
            _facets = facets;
        }
    }
    
}
File Line
org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java 201
org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java 182
            try
            {
                boolean oldMarkInitialState = false;
                Boolean isBuildingInitialState = null;
                if (markInitialState)
                {
                    //set markInitialState flag
                    oldMarkInitialState = fcc.isMarkInitialState();
                    fcc.setMarkInitialState(true);
                    isBuildingInitialState = (Boolean) ctx.getFacesContext().getAttributes().put(
                            StateManager.IS_BUILDING_INITIAL_STATE, Boolean.TRUE);
                }
                try
                {
                    ctx.includeFacelet(parent, path);
                }
                finally
                {
                    if (markInitialState)
                    {
                        //unset markInitialState flag
                        if (isBuildingInitialState == null)
                        {
                            ctx.getFacesContext().getAttributes().remove(
                                    StateManager.IS_BUILDING_INITIAL_STATE);
                        }
                        else
                        {
                            ctx.getFacesContext().getAttributes().put(
                                    StateManager.IS_BUILDING_INITIAL_STATE, isBuildingInitialState);
                        }
                        fcc.setMarkInitialState(oldMarkInitialState);
                    }
                }
            }
            finally
            {
File Line
org/apache/myfaces/application/StateManagerImpl.java 346
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java 412
    }

    private static void getPathToComponent(UIComponent component, StringBuffer buf)
    {
        if (component == null)
        {
            return;
        }

        StringBuffer intBuf = new StringBuffer();

        intBuf.append("[Class: ");
        intBuf.append(component.getClass().getName());
        if (component instanceof UIViewRoot)
        {
            intBuf.append(",ViewId: ");
            intBuf.append(((UIViewRoot)component).getViewId());
        }
        else
        {
            intBuf.append(",Id: ");
            intBuf.append(component.getId());
        }
        intBuf.append("]");

        buf.insert(0, intBuf.toString());

        getPathToComponent(component.getParent(), buf);
    }
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/LegacySetHandler.java 142
org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java 157
            }
        }
        else
        {
            // Check attributes
            if (this.target == null || this.property == null || this.value == null)
            {
                throw new TagException(
                        tag, "either attributes var and value or target, property and value must be set");
            }
            if (this.target.isLiteral())
            {
                throw new TagException(tag, "attribute target must contain a value expression");
            }

            // Get target object and name of property to set
            ELContext elCtx = ctx.getFacesContext().getELContext();
            ValueExpression targetExpr = this.target.getValueExpression(ctx, Object.class);
            Object targetObj = targetExpr.getValue(elCtx);
            String propertyName = this.property.getValue(ctx);
            // Set property on target object
            ctx.getELResolver().setValue(elCtx, targetObj, propertyName, veObj.getValue(elCtx));
        }
    }
}
File Line
org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java 472
org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java 526
    public Facelet getCompositeComponentMetadataFacelet(FacesContext facesContext, String uri)
        throws IOException
    {
        URL url = (URL) _relativeLocations.get(uri);
        if (url == null)
        {
            url = resolveURL(facesContext, getBaseUrl(), uri);
            ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
                FaceletFactory.LAST_RESOURCE_RESOLVED);            
            if (url != null)
            {
                if (viewResource != null)
                {
                    // If a view resource has been used to resolve a resource, the cache is in
                    // the ResourceHandler implementation. No need to cache in _relativeLocations.
                }
                else
                {
                    Map<String, URL> newLoc = new HashMap<String, URL>(_relativeLocations);
                    newLoc.put(uri, url);
                    _relativeLocations = newLoc;
                }
            }
            else
            {
                throw new IOException("'" + uri + "' not found.");
            }
        }
        return this.getCompositeComponentMetadataFacelet(url);
File Line
org/apache/myfaces/view/facelets/compiler/TextUnit.java 167
org/apache/myfaces/view/facelets/compiler/TextUnit.java 219
                            ELText[] splitText = ELText.parseAsArray(s);
                            if (splitText.length > 1)
                            {
                                Instruction[] array = new Instruction[splitText.length];
                                for (int i = 0; i < splitText.length; i++)
                                {
                                    ELText selText = splitText[i];
                                    if (selText.isLiteral())
                                    {
                                        array[i] = new LiteralNonExcapedTextInstruction(selText.toString());
                                    }
                                    else
                                    {
                                        array[i] = new TextInstruction(this.alias, selText );
                                    }
                                }
                                this.instructionBuffer.add(new CompositeTextInstruction(array));
                            }
                            else
                            {
                                this.instructionBuffer.add(new TextInstruction(this.alias, ELText.parse(s)));
File Line
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java 403
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java 484
        protected void setAttribute(String key, Boolean value)
        {
            throw new UnsupportedOperationException();
        }

        @Override
        protected void removeAttribute(String key)
        {
            throw new UnsupportedOperationException();
        }

        @Override
        protected Enumeration<String> getAttributeNames()
        {
            Set<String> attributeNames = new HashSet<String>();
            TemplateManagerImpl client;
            for (int i = 0; i < _clients.size(); i++)
            {
                client = _clients.get(i);
                if (!client.isParametersMapEmpty())
                {
                    attributeNames.addAll(client.getParametersMap().keySet());
                }
            }
            
            return new ParameterNameEnumeration(attributeNames.toArray(new String[attributeNames.size()]));
        }
    }    
File Line
org/apache/myfaces/view/facelets/compiler/UILeaf.java 245
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java 414
    private static void getPathToComponent(UIComponent component, StringBuffer buf)
    {
        if (component == null)
        {
            return;
        }

        StringBuffer intBuf = new StringBuffer();

        intBuf.append("[Class: ");
        intBuf.append(component.getClass().getName());
        if (component instanceof UIViewRoot)
        {
            intBuf.append(",ViewId: ");
            intBuf.append(((UIViewRoot)component).getViewId());
        }
        else
        {
            intBuf.append(",Id: ");
            intBuf.append(component.getId());
        }
        intBuf.append("]");

        buf.insert(0, intBuf.toString());

        getPathToComponent(component.getParent(), buf);
    }
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 53
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 49
        for (String name : names)
        {
            removeAttribute(name);
        }
    }

    @Override
    public final boolean containsKey(final Object key)
    {
        return getAttribute(key.toString()) != null;
    }

    @Override
    public boolean containsValue(final Object findValue)
    {
        if (findValue == null)
        {
            return false;
        }

        for (final Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
        {
            final Object value = getAttribute(e.nextElement());
            if (findValue.equals(value))
            {
                return true;
            }
        }

        return false;
    }

    @Override
    public Set<Entry<String, V>> entrySet()
    {
File Line
org/apache/myfaces/application/StateManagerImpl.java 348
org/apache/myfaces/view/facelets/compiler/UILeaf.java 245
    private void getPathToComponent(UIComponent component, StringBuffer buf)
    {
        if (component == null)
        {
            return;
        }

        StringBuffer intBuf = new StringBuffer();

        intBuf.append("[Class: ");
        intBuf.append(component.getClass().getName());
        if (component instanceof UIViewRoot)
        {
            intBuf.append(",ViewId: ");
            intBuf.append(((UIViewRoot) component).getViewId());
        }
        else
        {
            intBuf.append(",Id: ");
            intBuf.append(component.getId());
        }
        intBuf.append("]");

        buf.insert(0, intBuf.toString());

        getPathToComponent(component.getParent(), buf);
    }
File Line
org/apache/myfaces/application/ApplicationImpl.java 2053
org/apache/myfaces/application/ApplicationImpl.java 2592
            }
            
            // Identify the resource as created by effect of a @ResourceDependency annotation.
            output.getAttributes().put(RequestViewMetadata.RESOURCE_DEPENDENCY_KEY, 
                new Object[]{annotation.library(), annotation.name()});

            // If target is the empty string, let target be null.
            String target = annotation.target();
            if (target != null && target.length() > 0)
            {
                target = ELText.parse(getExpressionFactory(),
                                      context.getELContext(), target).toString(context.getELContext());
                // If target is non-null, store it under the key "target".
                attributes.put("target", target);
                context.getViewRoot().addComponentResource(context, output, target);
            }
            else
            {
                // Otherwise, if target is null, call UIViewRoot.addComponentResource(javax.faces.context.FacesContext,
                // javax.faces.component.UIComponent), passing the UIOutput instance as the second argument.
                context.getViewRoot().addComponentResource(context, output);
            }
        }
    }
File Line
org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java 438
org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java 179
    }

    private static class ComponentConfigWrapper implements ComponentConfig
    {

        protected final TagConfig parent;

        protected final String componentType;

        protected final String rendererType;

        public ComponentConfigWrapper(TagConfig parent, String componentType, String rendererType)
        {
            this.parent = parent;
            this.componentType = componentType;
            this.rendererType = rendererType;
        }

        public String getComponentType()
        {
            return this.componentType;
        }

        public String getRendererType()
        {
            return this.rendererType;
        }

        public FaceletHandler getNextHandler()
        {
            return this.parent.getNextHandler();
        }

        public Tag getTag()
        {
            return this.parent.getTag();
        }

        public String getTagId()
        {
            return this.parent.getTagId();
        }
    }

    private static class ComponentHandlerFactory implements TagHandlerFactory
File Line
org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java 98
org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java 80
    public void apply(FaceletContext ctx, UIComponent parent)
            throws IOException
    {
        if (((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
        {
            String facetName = _name.getValue(ctx);
            
            UIComponent compositeBaseParent
                    = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
            
            CompositeComponentBeanInfo beanInfo = 
                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                .get(UIComponent.BEANINFO_KEY);
            
            if (beanInfo == null)
            {
                if (log.isLoggable(Level.SEVERE))
                {
                    log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
                }
                return;
            }
            
            BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); 

            List<String> facetList = (List<String>) beanDescriptor.getValue(RENDER_FACET_USED);
File Line
org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java 480
org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java 501
            else if (localCachedExpression[0] != null && localCachedExpression[0].equals(type))
            {
                // If #{cc} recalculate the composite component level
                if ((this.capabilities & EL_CC) != 0)
                {
                    UIComponent cc = actx.getFaceletCompositionContext().getCompositeComponentFromStack();
                    if (cc != null)
                    {
                        Location location = (Location) cc.getAttributes().get(
                                CompositeComponentELUtils.LOCATION_KEY);
                        if (location != null)
                        {
                            return ((LocationValueExpression)localCachedExpression[1]).apply(
                                    actx.getFaceletCompositionContext().getCompositeComponentLevel(), location);
                        }
                    }
                    return ((LocationValueExpression)localCachedExpression[1]).apply(
                            actx.getFaceletCompositionContext().getCompositeComponentLevel());
                }
                return (ValueExpression) localCachedExpression[1];
            }
File Line
org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java 132
org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java 312
                = lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
        
        if (matchingCompositeComponent != null)
        {
            return matchingCompositeComponent;
        }
        
        //2. Try to find it using UIComponent.getCurrentCompositeComponent(). 
        // This one will look the direct parent hierarchy of the component,
        // to see if the composite component can be found.
        if (currentCompositeComponent != null)
        {
            currentComponent = currentCompositeComponent;
        }
        else
        {
            //Try to find the composite component looking directly the parent
            //ancestor of the current component
            //currentComponent = UIComponent.getCurrentComponent(facesContext);
            boolean found = false;
            while (currentComponent != null && !found)
            {
                String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
                if (findComponentExpr != null)
                {
                    UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
                    if (foundComponent != null)
                    {
                        Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
                        if (foundComponentLocation != null 
                                && foundComponentLocation.getPath().equals(location.getPath()) &&
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 355
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 448
                    if (vs != null)
                    {
                        IterationStatus itrS = new IterationStatus(first, last, i, sO, eO, mO, value);
                        ValueExpression ve;
                        if (t || srcVE == null)
                        {
                            if (srcVE == null)
                            {
                                ve = null;
                            }
                            else
                            {
                                ve = ctx.getExpressionFactory().createValueExpression(
                                            itrS, Object.class);
                            }
                        }
                        else
                        {
                            ve = new IterationStatusExpression(itrS);
                        }
                        setVar(ctx, parent, uniqueId, base+"_vs", vs, ve, srcVE);
                    }

                    // execute body
                    this.nextHandler.apply(ctx, parent);
                }
                finally
                {
                    fcc.endComponentUniqueIdSection(base);
                }
File Line
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java 360
org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java 437
        }
    }

    private static class ComponentConfigWrapper implements ComponentConfig
    {

        protected final TagConfig parent;

        protected final String componentType;

        protected final String rendererType;

        public ComponentConfigWrapper(TagConfig parent, String componentType, String rendererType)
        {
            this.parent = parent;
            this.componentType = componentType;
            this.rendererType = rendererType;
        }

        public String getComponentType()
        {
            return this.componentType;
        }

        public String getRendererType()
        {
            return this.rendererType;
        }

        public FaceletHandler getNextHandler()
        {
            return this.parent.getNextHandler();
        }

        public Tag getTag()
        {
            return this.parent.getTag();
        }

        public String getTagId()
        {
            return this.parent.getTagId();
        }
    }
File Line
org/apache/myfaces/config/DefaultFacesConfigurationProvider.java 463
org/apache/myfaces/config/FacesConfigurator.java 629
        String configFiles = _externalContext.getInitParameter(FacesServlet.CONFIG_FILES_ATTR);
        List<String> configFilesList = new ArrayList<String>();
        if (configFiles != null)
        {
            StringTokenizer st = new StringTokenizer(configFiles, ",", false);
            while (st.hasMoreTokens())
            {
                String systemId = st.nextToken().trim();

                if (DEFAULT_FACES_CONFIG.equals(systemId))
                {
                    if (log.isLoggable(Level.WARNING))
                    {
                        log.warning(DEFAULT_FACES_CONFIG + " has been specified in the "
                                + FacesServlet.CONFIG_FILES_ATTR
                                + " context parameter of "
                                + "the deployment descriptor. This will automatically be removed, "
                                + "if we wouldn't do this, it would be loaded twice.  See JSF spec 1.1, 10.3.2");
                    }
                }
                else
                {
                    configFilesList.add(systemId);
                }
            }
        }
        return configFilesList;
    }

    private void configureFactories()
File Line
org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java 438
org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java 276
    }

    private static class ComponentConfigWrapper implements ComponentConfig
    {

        protected final TagConfig parent;

        protected final String componentType;

        protected final String rendererType;

        public ComponentConfigWrapper(TagConfig parent, String componentType,
                                      String rendererType)
        {
            this.parent = parent;
            this.componentType = componentType;
            this.rendererType = rendererType;
        }

        public String getComponentType()
        {
            return this.componentType;
        }

        public String getRendererType()
        {
            return this.rendererType;
        }

        public FaceletHandler getNextHandler()
        {
            return this.parent.getNextHandler();
        }

        public Tag getTag()
        {
            return this.parent.getTag();
        }

        public String getTagId()
        {
            return this.parent.getTagId();
        }
    }
File Line
org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java 308
org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java 130
    }

    /**
     * Template method for determining if the Facelet needs to be refreshed.
     * 
     * @param facelet
     *            Facelet that could have expired
     * @return true if it needs to be refreshed
     */
    protected boolean needsToBeRefreshed(DefaultFacelet facelet)
    {
        // if set to 0, constantly reload-- nocache
        if (_refreshPeriod == NO_CACHE_DELAY)
        {
            return true;
        }

        // if set to -1, never reload
        if (_refreshPeriod == INFINITE_DELAY)
        {
            return false;
        }

        long target = facelet.getCreateTime() + _refreshPeriod;
        if (System.currentTimeMillis() > target)
        {
            // Should check for file modification

            URLConnection conn = null;
            try
            {
                conn = facelet.getSource().openConnection();
                long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);

                return lastModified == 0 || lastModified > target;
            }
            catch (IOException e)
            {
                throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
            }
            finally
            {
                // finally close input stream when finished, if fails just continue.
                if (conn != null)
                {
                    try 
                    {
File Line
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java 361
org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java 179
    }

    private static class ComponentConfigWrapper implements ComponentConfig
    {

        protected final TagConfig parent;

        protected final String componentType;

        protected final String rendererType;

        public ComponentConfigWrapper(TagConfig parent, String componentType, String rendererType)
        {
            this.parent = parent;
            this.componentType = componentType;
            this.rendererType = rendererType;
        }

        public String getComponentType()
        {
            return this.componentType;
        }

        public String getRendererType()
        {
            return this.rendererType;
        }

        public FaceletHandler getNextHandler()
        {
            return this.parent.getNextHandler();
        }

        public Tag getTag()
        {
            return this.parent.getTag();
        }

        public String getTagId()
        {
            return this.parent.getTagId();
        }
    }
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 411
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 486
    private void applyOnRefresh(FaceletContext ctx, FaceletCompositionContext fcc, PageContext pctx, 
        UIComponent parent, String uniqueId, Object src, ValueExpression srcVE, IterationState restoredSavedOption)
        throws IOException
    {
        int s = this.getBegin(ctx);
        int e = this.getEnd(ctx);
        int m = this.getStep(ctx);
        Integer sO = this.begin != null ? Integer.valueOf(s) : null;
        Integer eO = this.end != null ? Integer.valueOf(e) : null;
        Integer mO = this.step != null ? Integer.valueOf(m) : null;
        boolean t = this.getTransient(ctx);
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 775
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 880
            CompositeComponentMetadataHandler handler = new CompositeComponentMetadataHandler(mngr, alias);
            SAXParser parser = this.createSAXParser(handler);
            parser.parse(is, handler);
        }
        catch (SAXException e)
        {
            throw new FaceletException("Error Parsing " + alias + ": " + e.getMessage(), e.getCause());
        }
        catch (ParserConfigurationException e)
        {
            throw new FaceletException("Error Configuring Parser " + alias + ": " + e.getMessage(), e.getCause());
        }
        finally
        {
            if (is != null)
            {
                is.close();
            }
        }
        return new EncodingHandler(mngr.createFaceletHandler(), encoding);
    }
    
    @Override
    protected FaceletHandler doCompileComponent(
File Line
org/apache/myfaces/context/RequestViewMetadata.java 130
org/apache/myfaces/context/RequestViewMetadata.java 153
            for (ResourceDependency annotation : addedResources.keySet())
            {
                String target = annotation.target();
                if (target != null && target.length() > 0)
                {
                    target = ELText.parse(context.getApplication().getExpressionFactory(),
                                          context.getELContext(), target).toString(context.getELContext());
                }
                else
                {
                    target = "head";
                }
                List<ResourceDependency> list = map.get(target);
                if (list == null)
                {
                    list = new ArrayList<ResourceDependency>();
                    map.put(target, list);
                }
                list.add(annotation);
            }
        }
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 760
org/apache/myfaces/view/facelets/tag/jstl/core/LegacyForEachHandler.java 419
    private final Iterator<?> toIterator(Object src)
    {
        if (src == null)
        {
            return null;
        }
        else if (src instanceof Collection)
        {
            return ((Collection<?>) src).iterator();
        }
        else if (src instanceof Map)
        {
            return ((Map<?, ?>) src).entrySet().iterator();
        }
        else if (src.getClass().isArray())
        {
            return new ArrayIterator(src);
        }
        else
        {
            throw new TagAttributeException(this.tag, this.items,
                    "Must evaluate to a Collection, Map, Array, or null.");
        }
    }

}
File Line
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java 359
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java 799
        Map<String, PropertyDescriptor> facetPropertyDescriptorMap = (Map<String, PropertyDescriptor>)
            beanDescriptor.getValue(UIComponent.FACETS_KEY);
        
        if (facetPropertyDescriptorMap != null)
        {
            List<String> facetsRequiredNotFound = null;
            for (Map.Entry<String, PropertyDescriptor> entry : facetPropertyDescriptorMap.entrySet())
            {
                ValueExpression requiredExpr = (ValueExpression) entry.getValue().getValue("required");
                if (requiredExpr != null)
                {
                    Boolean required = (Boolean) requiredExpr.getValue(ctx.getFacesContext().getELContext());
                    if (Boolean.TRUE.equals(required))
                    {
File Line
org/apache/myfaces/push/cdi/WebsocketSessionBean.java 121
org/apache/myfaces/push/cdi/WebsocketViewBean.java 134
    }
    
    public <S extends Serializable> List<String> getChannelTokensFor(String channel, S user)
    {
        List<WebsocketChannel> list = channelTokenListMap.get(channel);
        if (list != null && !list.isEmpty())
        {
            List<String> value = new ArrayList<String>(list.size());
            for (WebsocketChannel md : list)
            {
                if (user.equals(md.getUser()))
                {
                    value.add(md.getChannelToken());
                }
            }
            return value;
        }
        return null;
    }
    
    @PreDestroy
    public void destroy()
    {
File Line
org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java 698
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java 185
                this._names.add(testName);
                boolean found = false;
                AbstractFaceletContext actx = new DefaultFaceletContext(
                        (DefaultFaceletContext) ctx, this._owner, false);
                ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, actx);
                try
                {
                    actx.pushPageContext(this._pageContext);
                    found = this._target
                            .apply(actx,
                                    parent, name);
                }
                finally
                {
                    actx.popPageContext();
                }
                ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx);
                this._names.remove(testName);
                return found;
            }
        }
        
        public Map<String, ValueExpression> getParametersMap()
File Line
org/apache/myfaces/taglib/core/DelegateActionListener.java 61
org/apache/myfaces/taglib/core/DelegateValueChangeListener.java 57
    public DelegateValueChangeListener(ValueExpression type, ValueExpression binding)
    {
        super();
        _type = type;
        _binding = binding;
    }

    public boolean isTransient()
    {
        return false;
    }

    public void restoreState(FacesContext facesContext, Object state)
    {
        Object[] values = (Object[]) state;
        _type = (ValueExpression) values[0];
        _binding = (ValueExpression) values[1];
    }

    public Object saveState(FacesContext facesContext)
    {
        Object[] values = new Object[2];
        values[0] = _type;
        values[1] = _binding;
        return values;
    }

    public void setTransient(boolean arg0)
    {
        // Do nothing
    }

    private ValueChangeListener _getDelegate()
File Line
org/apache/myfaces/webapp/AbstractFacesInitializer.java 158
org/apache/myfaces/webapp/AbstractFacesInitializer.java 378
        if (!WebConfigParamUtils.getBooleanInitParameter(facesContext.getExternalContext(),
                                                         INITIALIZE_ALWAYS_STANDALONE, false))
        {
            //We need to check if the current application was initialized by myfaces
            WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                    facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());

            if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty())
            {
                // check to see if the FacesServlet was found by MyFacesContainerInitializer
                Boolean mappingAdded = (Boolean) servletContext.getAttribute(
                    MyFacesContainerInitializer.FACES_SERVLET_FOUND);

                if (mappingAdded == null || !mappingAdded)
                {
                    // check if the FacesServlet has been added dynamically
                    // in a Servlet 3.0 environment by MyFacesContainerInitializer
                    mappingAdded = (Boolean) servletContext.getAttribute(
                        MyFacesContainerInitializer.FACES_SERVLET_ADDED_ATTRIBUTE);

                    if (mappingAdded == null || !mappingAdded)
                    {
                        if (log.isLoggable(Level.WARNING))
                        {
                            log.warning("No mappings of FacesServlet found. Abort destroy MyFaces.");
File Line
org/apache/myfaces/view/facelets/tag/jsf/core/ResetValuesActionListenerHandler.java 249
org/apache/myfaces/view/facelets/tag/jsf/core/ResetValuesActionListenerHandler.java 310
            }
            
            // Calculate the final clientIds
            UIComponent contextComponent = null;
            if (topCompositeComponentReference != null)
            {
                contextComponent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(
                    faces, event.getComponent(), topCompositeComponentReference);
                if (contextComponent == null)
                {
                    contextComponent = event.getComponent();
                }
                else
                {
                    contextComponent = contextComponent.getParent();
                }
            }
            else
            {
                contextComponent = event.getComponent();
            }
            List<String> list = new ArrayList<String>();
            for (String id : clientIds)
            {
                list.add(getComponentId(faces, contextComponent, id));
            }
            
            root.resetValues(faces, list);
        }
    }
    
    private static final String getComponentId(FacesContext facesContext, 
File Line
org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java 109
org/apache/myfaces/spi/impl/Tomcat7AnnotationInjectionProvider.java 156
            return true;
        }
        catch (Exception e)
        {
            // ignore
        }
        return false;
    }

    private InstanceManager initManager()
    {
        FacesContext context = FacesContext.getCurrentInstance();
        if (context == null)
        {
            return null;
        }

        ExternalContext extCtx = context.getExternalContext();
        if (extCtx == null)
        {
            return null;
        }

        // get application map to access ServletContext attributes
        Map<String, Object> applicationMap = extCtx.getApplicationMap();

        InstanceManager instanceManager = (InstanceManager)
                applicationMap.get(InstanceManager.class.getName());
        if (instanceManager != null)
        {
            instanceManagers.put(ClassUtils.getContextClassLoader(),
                    instanceManager);
        }

        return instanceManager;
    }

}
File Line
org/apache/myfaces/config/annotation/AnnotationConfigurator.java 249
org/apache/myfaces/config/annotation/AnnotationConfigurator.java 524
                               + facesBehaviorRenderer.rendererType() + ", "
                               + clazz.getName() + ")");
                }

                org.apache.myfaces.config.impl.digester.elements.RenderKitImpl renderKit =
                        (org.apache.myfaces.config.impl.digester.elements.RenderKitImpl)
                                facesConfig.getRenderKit(renderKitId);
                if (renderKit == null)
                {
                    renderKit = new org.apache.myfaces.config.impl.digester.elements.RenderKitImpl();
                    renderKit.setId(renderKitId);
                    facesConfig.addRenderKit(renderKit);
                }

                org.apache.myfaces.config.impl.digester.elements.ClientBehaviorRendererImpl cbr =
File Line
org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java 62
org/apache/myfaces/view/facelets/tag/jstl/core/LegacyForEachHandler.java 60
public final class LegacyForEachHandler extends TagHandler implements ComponentContainerHandler
{

    private static class ArrayIterator implements Iterator<Object>
    {

        protected final Object array;

        protected int i;

        protected final int len;

        public ArrayIterator(Object src)
        {
            this.i = 0;
            this.array = src;
            this.len = Array.getLength(src);
        }

        @Override
        public boolean hasNext()
        {
            return this.i < this.len;
        }

        @Override
        public Object next()
        {
            return Array.get(this.array, this.i++);
        }

        @Override
        public void remove()
        {
            throw new UnsupportedOperationException();
        }
    }
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 443
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 682
            if (this.inDocument && inCompositeInterface)
            {
                if (!this.unit.getFaceletsProcessingInstructions().isConsumeCDataSections())
                {
                    this.unit.writeInstruction("<![CDATA[");
                }
                else
                {
                    this.consumingCDATA = true;
                    this.swallowCDATAContent = this.unit.getFaceletsProcessingInstructions().isSwallowCDataContent();
                }
            }
        }

        public void startDocument() throws SAXException
        {
            this.inDocument = true;
        }

        public void startDTD(String name, String publicId, String systemId) throws SAXException
        {
            // metadata does not require output doctype
            this.inDocument = false;
        }

        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
        {
            if (CompositeLibrary.NAMESPACE.equals(uri) || CompositeLibrary.ALIAS_NAMESPACE.equals(uri))
File Line
org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java 154
org/apache/myfaces/view/facelets/tag/ui/LegacyCompositionHandler.java 147
                ctx.setVariableMapper(orig);
            }
        }
        else
        {
            this.nextHandler.apply(ctx, parent);
        }
    }

    @Override
    public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
            FaceletException, ELException
    {
        if (name != null)
        {
            if (_handlers == null)
            {
                return false;
            }
            
            DefineHandler handler = _handlers.get(name);
            if (handler != null)
            {
                handler.applyDefinition(ctx, parent);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            this.nextHandler.apply(ctx, parent);
            return true;
        }
    }

}
File Line
org/apache/myfaces/util/AbstractAttributeMap.java 358
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java 345
            return AbstractThreadSafeAttributeMap.this.remove(((Entry<String, V>)o).getKey()) != null;
        }
    }

    /**
     * Not very efficient since it generates a new instance of <code>Entry</code> for each element and still internaly
     * uses the <code>KeyIterator</code>. It is more efficient to use the <code>KeyIterator</code> directly.
     */
    private final class EntryIterator extends AbstractAttributeIterator<Entry<String, V>>
    {
        @Override
        protected Entry<String, V> getValue(final String attributeName)
        {
            // Must create new Entry every time--value of the entry must stay
            // linked to the same attribute name
            return new EntrySetEntry(attributeName);
        }
    }

    private final class EntrySetEntry implements Entry<String, V>
    {
        private final String _currentKey;

        public EntrySetEntry(final String currentKey)
        {
            _currentKey = currentKey;
        }

        public String getKey()
        {
            return _currentKey;
        }

        public V getValue()
        {
            return AbstractThreadSafeAttributeMap.this.get(_currentKey);
File Line
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 412
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java 595
                            }
                        }
                    }
                }
                for (OrderSlot slot : resource.getOrdering().getAfterList())
                {
                    if (slot instanceof FacesConfigNameSlot)
                    {
                        String name = ((FacesConfigNameSlot) slot).getName();
                        if (name != null && !"".equals(name))
                        {
                            boolean founded = false;
                            for (int j = i+1; j < sortedList.size(); j++)
                            {
                                if (name.equals(sortedList.get(j).getName()))
                                {
                                    founded=true;
                                    break;
                                }
                            }
                            if (founded)
                            {
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 392
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 631
                }
            }
        }

        public void endEntity(String name) throws SAXException
        {
        }

        public void endPrefixMapping(String prefix) throws SAXException
        {
            this.unit.popNamespace(prefix);
        }

        public void fatalError(SAXParseException e) throws SAXException
        {
            if (this.locator != null)
            {
                throw new SAXException("Error Traced[line: " + this.locator.getLineNumber() + "] " + e.getMessage());
            }
            else
            {
                throw e;
            }
        }

        public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
        {
            if (this.inDocument && inCompositeInterface)
File Line
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java 1217
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java 1619
        UIComponent topLevelComponentBase = topLevelComponent.getFacet(
                UIComponent.COMPOSITE_FACET_NAME);

        for (String target : targetsArray)
        {
            UIComponent innerComponent = ComponentSupport.findComponentChildOrFacetFrom(context, 
                    topLevelComponentBase, target);

            if (innerComponent == null)
            {
                continue;
            }

            // If a component is found, that means the expression should be retarget to the
            // components related
            if (isCompositeComponentRetarget(context, innerComponent, targetAttributeName))
            {
                innerComponent.getAttributes().put(targetAttributeName, attributeNameValueExpression);

                mctx.clearMethodExpressionAttribute(innerComponent, targetAttributeName);

                retargetMethodExpressions(context, innerComponent);
                
                if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
                {
                    //retargetMethodExpression occur on build view time, so it is safe to call markInitiaState here
                    innerComponent.markInitialState();
                }
            }
            else
            {
                //Put the retarget
                if (ccAttrMeRedirection)
File Line
org/apache/myfaces/el/unified/ResolverBuilderBase.java 95
org/apache/myfaces/el/unified/ResolverBuilderBase.java 118
                facesContext.getExternalContext()).isSupportJSPAndFacesEL())
        {
            if (_config.getVariableResolver() != null)
            {
                resolvers.add(createELResolver(_config.getVariableResolver()));
            }
            else if (_config.getVariableResolverChainHead() != null)
            {
                resolvers.add(createELResolver(_config.getVariableResolverChainHead()));
            }

            if (_config.getPropertyResolver() != null)
            {
                resolvers.add(createELResolver(_config.getPropertyResolver()));
            }
            else if (_config.getPropertyResolverChainHead() != null)
            {
                resolvers.add(createELResolver(_config.getPropertyResolverChainHead()));
            }
        }
File Line
org/apache/myfaces/push/cdi/WebsocketApplicationBean.java 79
org/apache/myfaces/push/cdi/WebsocketViewBean.java 134
    }
    
    public <S extends Serializable> List<String> getChannelTokensFor(String channel, S user)
    {
        List<WebsocketChannel> list = channelTokenListMap.get(channel);
        if (list != null && !list.isEmpty())
        {
            List<String> value = new ArrayList<String>(list.size());
            for (WebsocketChannel md : list)
            {
                if (user.equals(md.getUser()))
                {
                    value.add(md.getChannelToken());
                }
            }
            return value;
        }
        return null;
    }
File Line
org/apache/myfaces/resource/ClassLoaderContractResourceLoader.java 154
org/apache/myfaces/resource/InternalClassLoaderResourceLoader.java 254
                url = this.getClass().getClassLoader().getResource(libraryName);
            }
            if (url != null)
            {
                return true;
            }
        }
        return false;
    }

    @Override
    public Iterator<String> iterator(FacesContext facesContext, String path, 
            int maxDepth, ResourceVisitOption... options)
    {
        String basePath = path;
        
        if (getPrefix() != null)
        {
            basePath = getPrefix() + '/' + (path.startsWith("/") ? path.substring(1) : path);
        }

        URL url = getClassLoader().getResource(basePath);

        return new ClassLoaderResourceLoaderIterator(url, basePath, maxDepth, options);
    }
}
File Line
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 163
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java 394
        }

        public void endEntity(String name) throws SAXException
        {
        }

        public void endPrefixMapping(String prefix) throws SAXException
        {
            this.unit.popNamespace(prefix);
        }

        public void fatalError(SAXParseException e) throws SAXException
        {
            if (this.locator != null)
            {
                throw new SAXException("Error Traced[line: " + this.locator.getLineNumber() + "] " + e.getMessage());
            }
            else
            {
                throw e;
            }
        }

        public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
        {
            if (this.inDocument && inMetadata)
File Line
org/apache/myfaces/push/cdi/WebsocketApplicationBean.java 51
org/apache/myfaces/push/cdi/WebsocketViewBean.java 87
    }
    
    /**
     * Indicate if the channel mentioned is valid for view scope.
     * 
     * A channel is valid if there is at least one token that represents a valid connection to this channel.
     * 
     * @param channel
     * @return 
     */
    public boolean isChannelAvailable(String channel)
    {
        return channelTokenListMap.containsKey(channel);
    }
    
    public List<String> getChannelTokensFor(String channel)
    {
        List<WebsocketChannel> list = channelTokenListMap.get(channel);
        if (list != null && !list.isEmpty())
        {
            List<String> value = new ArrayList<String>(list.size());
            for (WebsocketChannel md : list)
            {
                value.add(md.getChannelToken());
            }
            return value;
        }
        return Collections.emptyList();
    }
    
    public String getChannelToken(WebsocketChannelMetadata metadata)
File Line
org/apache/myfaces/lifecycle/CODIClientSideWindow.java 415
org/apache/myfaces/lifecycle/UrlClientWindow.java 78
    }

    @Override
    public String getId()
    {
        return windowId;
    }
    
    public void setId(String id)
    {
        windowId = id;
        queryParamsMap = null;
    }

    @Override
    public Map<String, String> getQueryURLParameters(FacesContext context)
    {
        if (queryParamsMap == null)
        {
            String id = context.getExternalContext().getClientWindow().getId();
            if (id != null)
            {
                queryParamsMap = new HashMap<String, String>(2,1);
                queryParamsMap.put(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, id);
            }
        }
        return queryParamsMap;
    }
    
}
File Line
org/apache/myfaces/view/facelets/tag/ui/LegacyParamHandler.java 68
org/apache/myfaces/view/facelets/tag/ui/ParamHandler.java 70
    public ParamHandler(TagConfig config)
    {
        super(config);
        this.name = this.getRequiredAttribute("name");
        this.value = this.getRequiredAttribute("value");
    }

    /*
     * (non-Javadoc)
     * 
     * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext,
     *        javax.faces.component.UIComponent)
     */
    @Override
    public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        String nameStr = getName(ctx);
        ValueExpression valueVE = getValue(ctx);
        //ctx.getVariableMapper().setVariable(nameStr, valueVE);
        apply(ctx, parent, nameStr, valueVE);
    }
    
    public void apply(FaceletContext ctx, UIComponent parent, String nameStr, ValueExpression valueVE)
            throws IOException, FacesException, FaceletException, ELException
    {
File Line
org/apache/myfaces/view/facelets/el/CacheableValueExpressionWrapper.java 77
org/apache/myfaces/view/facelets/el/LocationValueExpression.java 176
    }

    @Override
    public boolean equals(Object obj)
    {
        return delegate.equals(obj);
    }

    @Override
    public String getExpressionString()
    {
        return delegate.getExpressionString();
    }

    @Override
    public int hashCode()
    {
        return delegate.hashCode();
    }

    @Override
    public boolean isLiteralText()
    {
        return delegate.isLiteralText();
    }

    @Override
    public ValueExpression getWrapped()
    {
        return delegate;
    }
    
    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    {
        this.delegate = (ValueExpression) in.readObject();
File Line
org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java 209
org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java 74
                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                .get(UIComponent.BEANINFO_KEY);
            
            if (beanInfo == null)
            {
                if (log.isLoggable(Level.SEVERE))
                {
                    log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
                }
                return;
            }
            
            BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
            
            Map<String, PropertyDescriptor> facetPropertyDescriptorMap = 
                (Map<String, PropertyDescriptor>) beanDescriptor.getValue(UIComponent.FACETS_KEY);
        
            if (facetPropertyDescriptorMap == null)
            {
                facetPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>();
                beanDescriptor.setValue(UIComponent.FACETS_KEY, facetPropertyDescriptorMap);
            }
File Line
org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java 96
org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java 85
    @JSFFaceletAttribute(name="displayName",
            className="javax.el.ValueExpression",
            deferredValueType="java.lang.String")
    private final TagAttribute _displayName;

    /**
     * Indicate if the attribute is required or not
     * <p>
     * Myfaces specific feature: this attribute is checked only if project stage is
     * not ProjectStage.Production when a composite component is created.
     * </p>
     */
    @JSFFaceletAttribute(name="required",
            className="javax.el.ValueExpression",
            deferredValueType="boolean")
    private final TagAttribute _required;

    /**
     * Only available if ProjectStage is Development.
     */
    @JSFFaceletAttribute(name="preferred",
            className="javax.el.ValueExpression",
            deferredValueType="boolean")
    private final TagAttribute _preferred;

    /**
     * Only available if ProjectStage is Development.
     */
    @JSFFaceletAttribute(name="expert",
            className="javax.el.ValueExpression",
            deferredValueType="boolean")
    private final TagAttribute _expert;

    /**
     * Only available if ProjectStage is Development.
     */
    @JSFFaceletAttribute(name="shortDescription",
            className="javax.el.ValueExpression",
            deferredValueType="java.lang.String")
    private final TagAttribute _shortDescription;
    
    /**
     * The "hidden" flag is used to identify features that are intended only 
     * for tool use, and which should not be exposed to humans.
     * Only available if ProjectStage is Development.
     */
    @JSFFaceletAttribute(name="hidden",
File Line
org/apache/myfaces/view/facelets/tag/LegacyUserTagHandler.java 97
org/apache/myfaces/view/facelets/tag/UserTagHandler.java 103
        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
        // eval include
        try
        {
            String[] names = null;
            ValueExpression[] values = null;
            if (this._vars.length > 0)
            {
                names = new String[_vars.length];
                values = new ValueExpression[_vars.length];
                for (int i = 0; i < _vars.length; i++)
                {
                    names[i] = _vars[i].getLocalName();
                    values[i] = _vars[i].getValueExpression(ctx, Object.class);
                }
            }
            actx.pushTemplateContext(new TemplateContextImpl());
File Line
org/apache/myfaces/taglib/core/ConverterImplTag.java 128
org/apache/myfaces/taglib/core/DelegateConverter.java 132
                throw new ConverterException("Exception creating converter using binding", e);
            }
        }

        if ((_converterId != null) || (_converterIdString != null))
        {
            try
            {
                if (null != _converterIdString)
                {
                    converter = facesContext.getApplication().createConverter(_converterIdString);
                }
                else
                {
                    String converterId = (String) _converterId.getValue(elContext);
                    converter = facesContext.getApplication().createConverter(converterId);
                }

                // with binding no converter was created, set its value with the converter
                // created using the converterId
                if (converter != null && _binding != null)
                {
                    _binding.setValue(elContext, converter);
                }
            }
            catch (Exception e)
            {
                throw new ConverterException("Exception creating converter with converterId: " + _converterId, e);
File Line
org/apache/myfaces/spi/impl/DefaultInjectionProviderFactory.java 174
org/apache/myfaces/spi/impl/DefaultInjectionProviderFactory.java 200
            {
                List<String> classList = ServiceProviderFinderFactory.getServiceProviderFinder(extContext).
                        getServiceProviderList(INJECTION_PROVIDER);
                Iterator<String> iter = classList.iterator();
                while (iter.hasNext())
                {
                    String className = iter.next();
                    Object obj = createClass(className,extContext);
                    if (InjectionProvider.class.isAssignableFrom(obj.getClass()))
                    {
                        InjectionProvider discoverableInjectionProvider
                                = (InjectionProvider) obj;
                        if (discoverableInjectionProvider.isAvailable())
                        {
                            extContext.getApplicationMap().put(INJECTION_PROVIDER_INSTANCE_KEY,
                                                               discoverableInjectionProvider);
                            return (Boolean) true;
File Line
org/apache/myfaces/config/annotation/DefaultLifecycleProviderFactory.java 170
org/apache/myfaces/config/annotation/DefaultLifecycleProviderFactory.java 196
            {
                List<String> classList = ServiceProviderFinderFactory.getServiceProviderFinder(extContext).
                        getServiceProviderList(LIFECYCLE_PROVIDER);
                Iterator<String> iter = classList.iterator();
                while (iter.hasNext())
                {
                    String className = iter.next();
                    Object obj = createClass(className,extContext);
                    if (DiscoverableLifecycleProvider.class.isAssignableFrom(obj.getClass()))
                    {
                        DiscoverableLifecycleProvider discoverableLifecycleProvider
                                = (DiscoverableLifecycleProvider) obj;
                        if (discoverableLifecycleProvider.isAvailable())
                        {
                            extContext.getApplicationMap().put(LIFECYCLE_PROVIDER_INSTANCE_KEY,
                                                               discoverableLifecycleProvider);
                            return (Boolean) true;