<commit_before>/*************************************************************************************
 * Copyright (c) 2004 Actuate Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Actuate Corporation - Initial implementation.
 ************************************************************************************/

package org.eclipse.birt.report.viewer.utilities;

import java.io.IOException;
import java.net.URL;

import org.eclipse.birt.report.viewer.ViewerPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.help.internal.appserver.IWebappServer;
import org.eclipse.help.internal.appserver.PluginClassLoaderWrapper;
import org.osgi.framework.Bundle;

/**
 * Singleton class for web application.
 * <p>
 */
public class WebappAccessor
{
	private static final String WORKSPACE_CLASSPATH_KEY = "workspace.projectclasspath";

	private static boolean applicationsStarted = false;

	/**
	 * Private constructor, so no instances can be created.
	 * 
	 * @see java.lang.Object#Object()
	 */
	private WebappAccessor( )
	{
	}

	/**
	 * Runs a webapp on the server. The webapp is defined in a plugin and the
	 * path is relative to the plugin directory.
	 * <p>
	 * It is assumed that webapp names are unique. It is suggested to create
	 * unique web app names by prefixing them with the plugin id.
	 * </p>
	 * 
	 * @param webappName
	 *            the name of the web app (also knowns as application context)
	 * @param pluginId
	 *            plugin that defines the webapp
	 * @param path
	 *            webapp relative path to the plugin directory
	 * @exception CoreException
	 */
	public synchronized static void start( String webappName, String pluginId,
			IPath path ) throws CoreException
	{
		if ( !applicationsStarted )
		{
			// Set the classpath property (used in Java scripting)
			String projectClassPaths = WorkspaceClasspathManager.getClassPath( );
			System.setProperty( WORKSPACE_CLASSPATH_KEY, projectClassPaths );

			IPath webappPath = getWebappPath( pluginId, path );
<commit_msg>- Summary: Bugzilla Bug 118573 Smoke Test: The class path search return null. But HashTable doesn't accept null value.<commit_after>/*************************************************************************************
 * Copyright (c) 2004 Actuate Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Actuate Corporation - Initial implementation.
 ************************************************************************************/

package org.eclipse.birt.report.viewer.utilities;

import java.io.IOException;
import java.net.URL;

import org.eclipse.birt.report.viewer.ViewerPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.help.internal.appserver.IWebappServer;
import org.eclipse.help.internal.appserver.PluginClassLoaderWrapper;
import org.osgi.framework.Bundle;

/**
 * Singleton class for web application.
 * <p>
 */
public class WebappAccessor
{
	private static final String WORKSPACE_CLASSPATH_KEY = "workspace.projectclasspath";

	private static boolean applicationsStarted = false;

	/**
	 * Private constructor, so no instances can be created.
	 * 
	 * @see java.lang.Object#Object()
	 */
	private WebappAccessor( )
	{
	}

	/**
	 * Runs a webapp on the server. The webapp is defined in a plugin and the
	 * path is relative to the plugin directory.
	 * <p>
	 * It is assumed that webapp names are unique. It is suggested to create
	 * unique web app names by prefixing them with the plugin id.
	 * </p>
	 * 
	 * @param webappName
	 *            the name of the web app (also knowns as application context)
	 * @param pluginId
	 *            plugin that defines the webapp
	 * @param path
	 *            webapp relative path to the plugin directory
	 * @exception CoreException
	 */
	public synchronized static void start( String webappName, String pluginId,
			IPath path ) throws CoreException
	{
		if ( !applicationsStarted )
		{
			// Set the classpath property (used in Java scripting)
			String projectClassPaths = WorkspaceClasspathManager.getClassPath( );
			
			//HashTable doesn't accept null value
			if(projectClassPaths == null)
			{
				projectClassPaths = ""; //$NON-NLS-1$
			}
			System.setProperty( WORKSPACE_CLASSPATH_KEY, projectClassPaths );

			IPath webappPath = getWebappPath( pluginId, path );

{'fraction_non_alphanumeric': 0.1455072463768116, 'fraction_numerical': 0.0044444444444444444, 'mean_word_length': 4.074509803921568, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6445651', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1362, 'n_words': 455}