This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 42020

Summary: I18N - JUnit Test can't run when NetBeans has been installed in the directory which name has white space
Product: java Reporter: Keiichi Oono <keiichio>
Component: JUnitAssignee: junit-issues@java <junit-issues>
Status: CLOSED FIXED    
Severity: blocker CC: jf4jbug, pkeegan
Priority: P2 Keywords: I18N, RELNOTE, SIMPLEFIX, SPACE_IN_PATH
Version: 3.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: The error message when this problem is caused.
one-line patch

Description Keiichi Oono 2004-04-15 13:35:32 UTC
3.6  Build 20040407

To reproduce:
- install NetBeans into the directory which name 
  has white space 
  (e.g. c:\Program Files\NetBeans36)

- Create JUnit test and run

The attached error is displayed in output window, 
and test can't be run.
When NetBeans is installed in the direcotry that 
name does not include white space, JUnit test can 
work correctly.

This problem is not caused in English environment.
Comment 1 Keiichi Oono 2004-04-15 13:36:42 UTC
Created attachment 14413 [details]
The error message when this problem is caused.
Comment 2 Keiichi Oono 2004-04-15 13:41:29 UTC
Is it possible to fix this problem by NetBeans 3.6 localized version 
is released? (The final qa needs to be finished by April/30). 
I would like to request to fix this before NetBeans 3.6 localized 
version is released.

Because the NetBeans default installation directory name has white 
space (c:\Program Files\NetBeans 3.6), The JUnit testing can not be 
run in default installed environment. I've not tested in Chinese or 
other environment, but I think the same problem is caused when 
NetBeans is installed into the default directory.
Comment 3 Marian Petras 2004-04-19 11:41:44 UTC
Confirmed.

The reason why it works with US locale but not with other locales is
that when running in other locale, the classpath is modified -
localized variants of JUnit testrunner library is added to it.

The code that manages the classpath modification is in method

 org.netbeans.modules.junit.JUnitExternalExecutor.prepareClassPath(...)

The method detects if the original (unmodified) classpath contained a
space and if full name of any of the localized libraries contains a
space. If necessary, quotes should be added to the beginning and to
the end of the modified classpath. It seems the method is buggy in
this part.
Comment 4 Marian Petras 2004-04-19 12:07:43 UTC
Created attachment 14454 [details]
one-line patch
Comment 5 Marian Petras 2004-04-19 12:13:22 UTC
The problem is that the method not only adds quotes to the beginning
and to the end of the whole modified classpath but it also quotes full
names of localized libraries being added to the classpath. The result
is that the classpath may contain multiple quote strings which means
that part of the resulting classpath is not quoted.

The suggested fix (attached) simple eliminates extra quoting of
individual parts of classpath. It is a very simple fix - one line is
replaced with another one.

I made the fix on Linux. It did not work before I had applied the
patch and it works now that the patch is applied.
Comment 6 Keiichi Oono 2004-04-19 14:05:57 UTC
Thank you very much quick fixing!
The attached path works in Japanese Winodws 2000.

I've tested the attached patch with release36 as follows:
  - checkout junit with '-r release36' option
  - apply patch and build
  - test the built junit.jar with NetBeans 3.6 in Japanese Windows 2000
    The tested NetBeans 3.6 was installed into
    'C:\Program Files\NetBeans36'

Is it possible to apply this patch to relase36 branch?
Comment 7 Patrick Keegan 2004-04-21 18:20:58 UTC
Proposed relnote:

Description: JUnit tests can not run in the IDE. This occurs on
Microsoft Windows systems in all locales other than en_US when there
is a space in the path name of the IDE's installation.

Workaround: Re-install the IDE into a folder that does not have a
space in its path name.
Comment 8 Marian Petras 2004-04-22 08:21:51 UTC
Correction:

This happens also on Linux and probably on all other operating systems.
Comment 9 Patrick Keegan 2004-04-22 13:54:55 UTC
proposed relnote fix:

Description: JUnit tests can not run in the IDE. This occurs in all
locales other than en_US when there
is a space in the path name of the IDE's installation.

Workaround: Re-install the IDE into a folder that does not have a
space in its path name.
Comment 10 Marian Petras 2004-04-22 14:00:22 UTC
The release note seems to be correct now. Thank you.
Comment 11 Marian Petras 2004-06-16 17:12:12 UTC
Fixed together with adaptation of JUnit for the new build system.

The testrunner library is not used any more, so there is no need for
modification of classpath, so there is no problem with classpath and
execution.

One problem that needs to be solved is how to make the messages
localized again.
Comment 12 dmladek 2004-09-02 15:27:20 UTC
I'm clossing it since Keichii confirm it as working.
Please reopen it, if you find regresion