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 52834

Summary: javadoc-build target breaks when javac.classpath contains spaces
Product: javaee Reporter: ajenkins <ajenkins>
Component: Web ProjectAssignee: Radko Najman <rnajman>
Status: RESOLVED FIXED    
Severity: blocker Keywords: SPACE_IN_PATH
Priority: P3    
Version: 4.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description ajenkins 2004-12-31 20:22:50 UTC
This problem occurs with a Web Application project
created under Netbeans 4.0, when I run the
Generate Javadoc command for the project.  

If the compilation classpath for the project
contains any paths which contain spaces, then
error messages will be generated, like this:

javadoc-build:
javadoc: Illegal package name:
"Files\netbeans-4.0\ide4\modules\autoload\ext\servlet-api-2.4.jar;C:\Program"
javadoc: Illegal package name:
"Files\netbeans-4.0\ide4\modules\autoload\ext\jsp-api-2.0.jar;web/WEB-INF/lib/hibernate2.jar;web/WEB-INF/lib/hsqldb.jar;web/WEB-INF/lib/jsf-api.jar"

These errors were generated while running on
Windows XP, because some of the paths in the
classpath contain "C:\Program Files".  The problem
is not Windows-specific though; I verified that
the same problem occurs on Linux if I add a
directory with a space in it to the classpath. 
It's just that Windows systems much more commonly
contain directories with spaces in their name.

The problem occurs because the javadoc-build
target in the web project version of
build-impl.xml passes the value of the
javac.classpath property to javadoc command as a
commandline argument, without surrounding it in
quotes.  The fix is simple.  Find this code in the
javadoc-build target

<condition property="javadoc.classpath.opt"
value="-classpath ${javac.classpath}">
    <not>
        <equals arg1="${javac.classpath}" arg2=""/>
    </not>
</condition>

Change the first line to:

<condition property="javadoc.classpath.opt"
value="-classpath &quot;${javac.classpath}&quot;">

To be really correct you'd need to also handle the
possiblity of paths contains a double quote
character.  All of this could be avoided by not
passing the classpath as part of a <arg line=""/>
element.
Comment 1 Jesse Glick 2005-01-01 17:44:37 UTC
This is the exact analogue of issue #50548 for web projects. Fix
should be very easy; see diff in j2seproject.
Comment 2 Radko Najman 2005-02-23 13:44:49 UTC
Fixed.