You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/06/12 15:29:25 UTC

svn commit: r667079 - /directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java

Author: pamarcelot
Date: Thu Jun 12 06:29:25 2008
New Revision: 667079

URL: http://svn.apache.org/viewvc?rev=667079&view=rev
Log:
Fixed a bug with paths containing spaces (or any special character).

Modified:
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java

Modified: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java?rev=667079&r1=667078&r2=667079&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java (original)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java Thu Jun 12 06:29:25 2008
@@ -92,11 +92,11 @@
 
     /**
      * Creates a new instance of LaunchServerJob.
-     *
+     * 
      * @param server
-     *      the server
+     *            the server
      * @param configuration
-     *      the configuration
+     *            the configuration
      */
     public LaunchServerJob( Server server, ServerConfigurationV152 configuration )
     {
@@ -108,6 +108,7 @@
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
      */
     protected IStatus run( IProgressMonitor monitor )
@@ -181,15 +182,16 @@
                         server.setState( ServerStateEnum.STARTED );
                         writeToInfoConsoleMessageStream( "Server started.\n" );
 
-                        /// ... and we exit the thread
+                        // / ... and we exit the thread
                         return;
                     }
                     catch ( NamingException e )
                     {
-                        // If we get an exception when trying to create the 
+                        // If we get an exception when trying to create the
                         // context, it means the server is not yest started
 
-                        // We just wait one second before starting the test once again
+                        // We just wait one second before starting the test once
+                        // again
                         try
                         {
                             Thread.sleep( 1000 );
@@ -213,9 +215,9 @@
 
             /**
              * Creates a context on the server.
-             *
+             * 
              * @throws NamingException
-             *      if an error occurs when creating the context
+             *             if an error occurs when creating the context
              */
             private void createInitialDirContext() throws NamingException
             {
@@ -236,9 +238,9 @@
 
     /**
      * Writes the given message to the Info console message stream.
-     *
+     * 
      * @param message
-     *      the message
+     *            the message
      */
     private void writeToInfoConsoleMessageStream( final String message )
     {
@@ -284,7 +286,8 @@
                         // Looping on the debug events array
                         for ( DebugEvent debugEvent : events )
                         {
-                            // We only care of event with kind equals to 'terminate'
+                            // We only care of event with kind equals to
+                            // 'terminate'
                             if ( debugEvent.getKind() == DebugEvent.TERMINATE )
                             {
                                 // Getting the source of the debug event
@@ -297,7 +300,8 @@
                                     ILaunch debugEventLaunch = runtimeProcess.getLaunch();
                                     if ( debugEventLaunch.equals( launch ) )
                                     {
-                                        // The launch we had created is now terminated
+                                        // The launch we had created is now
+                                        // terminated
                                         // The server is now stopped
                                         server.setState( ServerStateEnum.STOPPED );
 
@@ -352,12 +356,12 @@
 
 
     /**
-     * Overwrites the log4j.properties file of the server with the
-     * given port number.
+     * Overwrites the log4j.properties file of the server with the given port
+     * number.
      * 
      * @param port
      *            the port
-     * @throws IOException 
+     * @throws IOException
      */
     private void overwriteServersLog4jPropertiesFile( int port ) throws IOException
     {
@@ -413,13 +417,13 @@
             IPath serverFolderPath = ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() );
 
             // Setting the program arguments attribute
-            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverFolderPath
-                .toOSString() );
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "\""
+                + serverFolderPath.toOSString() + "\"" );
 
             // Creating the VM arguments string
             StringBuffer vmArguments = new StringBuffer();
-            vmArguments.append( "-Dlog4j.configuration=file:"
-                + serverFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString() );
+            vmArguments.append( "-Dlog4j.configuration=file:\""
+                + serverFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString() + "\"" );
             vmArguments.append( " " );
             vmArguments.append( "-Dapacheds.var.dir=\"" + serverFolderPath.toOSString() + "\"" );
             vmArguments.append( " " );
@@ -436,7 +440,7 @@
             workingCopy.setAttribute( IDebugUIConstants.ATTR_PRIVATE, true );
 
             // Indicating that we don't want any console to show up
-            workingCopy.setAttribute( DebugPlugin.ATTR_CAPTURE_OUTPUT, false );
+            workingCopy.setAttribute( DebugPlugin.ATTR_CAPTURE_OUTPUT, true );
 
             // Saving the launch configuration
             ILaunchConfiguration configuration = workingCopy.doSave();
@@ -453,9 +457,8 @@
 
     /**
      * Gets the associated launch.
-     *
-     * @return
-     *      the associated launch
+     * 
+     * @return the associated launch
      */
     public ILaunch getLaunch()
     {
@@ -465,9 +468,9 @@
 
     /**
      * Sets the logs level.
-     *
+     * 
      * @param logsLevel
-     *      the logs level
+     *            the logs level
      */
     public void setLogsLevel( String logsLevel )
     {
@@ -477,9 +480,9 @@
 
     /**
      * Sets the logs pattern.
-     *
+     * 
      * @param logsPattern
-     *      the logs pattern
+     *            the logs pattern
      */
     public void setLogsPattern( String logsPattern )
     {