<commit_before>/*
 *   Copyright 2006 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */
package org.apache.felix.framework;

import java.util.Enumeration;
import java.util.NoSuchElementException;

class GetEntryPathsEnumeration implements Enumeration
{
    private BundleImpl m_bundle = null;
    private Enumeration m_enumeration = null;
    private String m_path = null;
    private Object m_next = null;

    public GetEntryPathsEnumeration(BundleImpl bundle, String path)
    {
        m_bundle = bundle;
        m_path = path;
        m_enumeration = m_bundle.getInfo().getCurrentModule()
            .getContentLoader().getContent().getEntries();

        // Sanity check the parameters.
        if (m_path == null)
        {
            throw new IllegalArgumentException("The path for findEntries() cannot be null.");
        }
        // Strip leading '/' if present.
        if ((m_path.length() > 0) && (m_path.charAt(0) == '/'))
        {
            m_path = m_path.substring(1);
        }
        // Add a '/' to the end if not present.
        if ((m_path.length() > 0) && (m_path.charAt(path.length() - 1) != '/'))
        {
            m_path = m_path + "/";
        }

        m_next = findNext();
    }

    public boolean hasMoreElements()
    {<commit_msg>Fixed a bug in the getEntryPaths() enumeration that could lead to a string index out of bounds exception.<commit_after>/*
 *   Copyright 2006 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */
package org.apache.felix.framework;

import java.util.Enumeration;
import java.util.NoSuchElementException;

class GetEntryPathsEnumeration implements Enumeration
{
    private BundleImpl m_bundle = null;
    private Enumeration m_enumeration = null;
    private String m_path = null;
    private Object m_next = null;

    public GetEntryPathsEnumeration(BundleImpl bundle, String path)
    {
        m_bundle = bundle;
        m_path = path;
        m_enumeration = m_bundle.getInfo().getCurrentModule()
            .getContentLoader().getContent().getEntries();

        // Sanity check the parameters.
        if (m_path == null)
        {
            throw new IllegalArgumentException("The path for findEntries() cannot be null.");
        }
        // Strip leading '/' if present.
        if ((m_path.length() > 0) && (m_path.charAt(0) == '/'))
        {
            m_path = m_path.substring(1);
        }
        // Add a '/' to the end if not present.
        if ((m_path.length() > 0) && (m_path.charAt(m_path.length() - 1) != '/'))
        {
            m_path = m_path + "/";
        }

        m_next = findNext();
    }

    public boolean hasMoreElements()
    {
{'fraction_non_alphanumeric': 0.09878177966101695, 'fraction_numerical': 0.006885593220338983, 'mean_word_length': 2.5332086061739942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5456927', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1030, 'n_words': 357}