Commit 32f7b006 authored by Adrien's avatar Adrien Committed by Romain Bioteau
Browse files

fix(workspace) spaces on workspace name (#354)

* possibility to work in a workspace with spaces in its name without
errors (like not possible to open H2 console)

closes[BS-16339](https://bonitasoft.atlassian.net/browse/BS-16339)
parent f0929850
......@@ -110,8 +110,8 @@ public class OpenH2ConsoleHandlerTest {
verify(workingCopy).setAttribute(IExternalToolConstants.ATTR_LOCATION, "/usr/bin/java");
final ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
verify(workingCopy).setAttribute(eq(IExternalToolConstants.ATTR_TOOL_ARGUMENTS), captor.capture());
assertThat(captor.getValue()).contains("-jar h2.jar -browser -webPort",
"-tcp -user sa -url jdbc:h2:file:/test/h2_db/business_data.db;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE;IGNORECASE=TRUE;AUTO_SERVER=TRUE; -driver org.h2.Driver");
assertThat(captor.getValue()).contains("-jar \"h2.jar\" -browser -webPort",
"-tcp -user sa -url \"jdbc:h2:file:/test/h2_db/business_data.db;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE;IGNORECASE=TRUE;AUTO_SERVER=TRUE;\" -driver org.h2.Driver");
verify(workingCopy).launch("run", Repository.NULL_PROGRESS_MONITOR);
}
......
......@@ -28,7 +28,6 @@ import java.util.List;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.Repository;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
......@@ -49,13 +48,13 @@ import com.google.common.base.Predicate;
public class OpenH2ConsoleHandler {
private static final String URL = "jdbc:h2:file:%s/business_data.db;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE;IGNORECASE=TRUE;AUTO_SERVER=TRUE;";
private static final String URL = "\"jdbc:h2:file:%s/business_data.db;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE;IGNORECASE=TRUE;AUTO_SERVER=TRUE;\"";
private static final String DRIVER = "org.h2.Driver";
private static final String USER = "sa";
private static final int PORT = SocketUtil.findFreePort();
@Execute
public void execute(final RepositoryAccessor repositoryAccessor) throws ExecutionException {
public void execute(final RepositoryAccessor repositoryAccessor) {
final ILaunchManager manager = getLaunchManager();
final ILaunchConfigurationType ltype = manager
.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
......@@ -85,7 +84,7 @@ public class OpenH2ConsoleHandler {
protected List<String> buildCommand(final RepositoryAccessor repositoryAccessor) throws IOException {
return Arrays.asList(
"-jar",
locateH2jar(repositoryAccessor),
"\"" + locateH2jar(repositoryAccessor) + "\"",
"-browser",
"-webPort",
String.valueOf(PORT),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment