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 51253 - Running applet in directory with space fails
Summary: Running applet in directory with space fails
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 51433 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-08 09:17 UTC by zikmund
Modified: 2006-03-24 10:12 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch with workaround for JDK1.5 (2.37 KB, patch)
2004-11-10 15:03 UTC, Martin Adamek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zikmund 2004-11-08 09:17:09 UTC
Build 200411072021

1) Have a Java project in a directory with space
2) Have an applet
3) Run applet (use Run file action)
4) ERROR:
run-applet target fails with:
I/O exception while reading:
D:\NetBeans\...\A%20L\JavaLibrary2\build\ClickMe.html
(The system cannot find the path specified)
Comment 1 Martin Adamek 2004-11-08 17:14:51 UTC
Works on JDK 1.4.2 but not on JDK 5.0
Comment 2 _ rkubacki 2004-11-09 10:38:16 UTC
I can reproduce this. When running with verbose output from ant it is
visible that executed command is:
java -classpath "/usr/local/home/radim/Java Applet/build/classes
sun.applet.AppletViewer
file:/usr/local/home/radim/Java%20Applet/build/Main.html

Command that works is unescaped URL:

java -classpath "/usr/local/home/radim/Java Applet/build/classes"
sun.applet.AppletViewer "file:///usr/local/home/radim/Java
Applet/build/Main.html"

So it looks like regression in AppletViewer. Please file a bug with
decsription to Sun's bug tracking system. 

Possible workaround is to pass only file path (absolute). It works on
tiger and probably on JDK1.4.2 too.
Comment 3 zikmund 2004-11-10 11:00:37 UTC
Filed jdk bug 6193279.

Decoded URL passed to appletviewer works fine on JDK 1.4.2_06, 1.5.0
FCS and 1.5.0_01-ea-b04 - sounds like good workaround.
Comment 4 Martin Adamek 2004-11-10 15:03:01 UTC
Created attachment 18824 [details]
Patch with workaround for JDK1.5
Comment 5 Martin Adamek 2004-11-10 15:09:17 UTC
Provided patch needs to be applied as soon as possible to trunk and
later on QE request to release40 branch. Karle, please take care! It
is show-stopper for release40! Wrong assignment to (non-existing)
applet module changed to java module.
Comment 6 Tomas Zezula 2004-11-10 16:27:21 UTC
The attached patch should be changed. The logic of handling the URL
should be done in generateAppletHTML ()
Comment 7 Tomas Zezula 2004-11-10 19:37:59 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java,v
 <--  AppletSupport.java
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.41; previous revision: 1.40
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/applet/AppletSupportTest.java,v
done
Checking in
j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/applet/AppletSupportTest.java;
/cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/applet/AppletSupportTest.java,v
 <--  AppletSupportTest.java
initial revision: 1.1
done
Comment 9 Tomas Zezula 2004-11-10 19:59:37 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.42; previous revision: 1.41
done
Comment 11 Jesse Glick 2004-11-10 20:32:14 UTC
Two problems.

1. Still awaiting a clearer description in the JDK bug report.
Preferably with concrete steps to reproduce in 1.5 (but not in 1.4)
using a file with spaces in its path (but not without). The example
URL given in the bug report currently is bogus.

2. Checking for the JDK version in the action provider is incorrect.
The user may have configured a nondefault platform. The action
provider must check for the version of the project's target JDK.
Comment 12 Tomas Zezula 2004-11-10 20:43:07 UTC
The first, I don't know exactly what happend in appletviewer. But as I
tried it, it seems that the appletviewer on the jdk 1.5 does not
accept encoded URLs.

The second is easy to fix.
Comment 13 Tomas Zezula 2004-11-10 21:46:15 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java,v
 <--  J2SEActionProvider.java
new revision: 1.33; previous revision: 1.32
done
Processing log script arguments...
More commits to come...
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java,v
 <--  AppletSupport.java
new revision: 1.5; previous revision: 1.4
done
Processing log script arguments...
More commits to come...
Checking in
j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/applet/AppletSupportTest.java;
/cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/applet/AppletSupportTest.java,v
 <--  AppletSupportTest.java
new revision: 1.2; previous revision: 1.1
done
Comment 14 Tomas Zezula 2004-11-10 22:11:09 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java,v
 <--  AppletSupport.java
new revision: 1.6; previous revision: 1.5
done
Comment 16 Jesse Glick 2004-11-10 22:53:36 UTC
Those diffs look OK to me.
Comment 17 zikmund 2004-11-11 11:51:03 UTC
Fix is OK for applet running, but doesn't work for applet debugging
(Debug file action). Reopenening.
Comment 18 Tomas Zezula 2004-11-11 13:44:38 UTC
This is a bit different issue. But it should be fixed to.
The problem is that debug macro passes arguments as a line.
This causes that file with spaces is handled as more different args.
Comment 19 Tomas Zezula 2004-11-11 13:53:17 UTC
There are two solutions how to handle this.
Either change:
-<j2seproject:debug
xmlns:j2seproject="http://www.netbeans.org/ns/j2se-project/2"
args="${applet.url}" classname="sun.applet.AppletViewer"/>
+<j2seproject:debug
xmlns:j2seproject="http://www.netbeans.org/ns/j2se-project/2"
args='"${applet.url}"' classname="sun.applet.AppletViewer"/>
Ugly 

Or not use j2seproject:debug for applet debugging. Even worse.

have you any other ideas?
Comment 20 David Konecny 2004-11-11 15:14:47 UTC
Re. "args='"${applet.url}"'" - I tried that on Windows and it works
fine. I prefer this solution rather then duplicating body of the
-init-macrodef-debug target just for applet debugging.
Comment 21 Tomas Zezula 2004-11-11 19:01:23 UTC
The '""' escaping is ugly but probably better then to copy the whole
macro.
Comment 22 _ viendu 2004-11-11 19:22:59 UTC
*** Issue 51433 has been marked as a duplicate of this issue. ***
Comment 23 Tomas Zezula 2004-11-11 20:26:04 UTC
Fixing problem with applet debugging:
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.44; previous revision: 1.43
done
Comment 24 Tomas Zezula 2004-11-11 20:27:18 UTC
Additional patch for applet debugging.
It has to be applied in addition to patches above.
http://www.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl.diff?r1=1.43&r2=1.44
Comment 25 Jesse Glick 2004-11-11 20:36:22 UTC
I'm not comfortable with this fix.

Maybe I'm missing something obvious here, but why is the macro
<j2seproject:debug> using

<attribute name="args" default="${application.args}"/>
<!-- ... -->
<arg line="@{args}"/>

at all? <arg line="..."/> is inherently unsafe. <j2seproject:java> uses

<element name="customize" optional="true"/>
<!-- ... -->
<customize/>

and it works fine.

E.g. run-applet uses

<j2seproject:java classname="sun.applet.AppletViewer">
    <customize>
        <arg value="${applet.url}"/>
    </customize>
</j2seproject:java>

so to my mind -debug-start-debuggee-applet should just look like

<j2seproject:debug classname="sun.applet.AppletViewer">
    <customize>
        <arg value="${applet.url}"/>
    </customize>
</j2seproject:debug>

rather than the current

<j2seproject:debug classname="sun.applet.AppletViewer"
args="${applet.url}"/>

Why is it not done that way?
Comment 26 Jesse Glick 2004-11-11 20:38:30 UTC
BTW consider also whether <j2seproject:debug> and <j2seproject:java>
should even be independent macros. To my mind, debug should be a
derivative macro based on java and only

- adding the four JPDA VM args

- using a different default for the classpath

That is not critical for D, of course, but should be considered for E.
For example, it would let people simply override -init-macrodef-java
and have their changes apply also to debugging, if that is
appropriate; usually it will be. Currently they would need to override
both and essentially duplicate their modification.
Comment 27 Tomas Zezula 2004-11-11 20:50:50 UTC
I don't know, these macros were written by David. He probably had some
reason for it.
Rewriting the macros for D will be quite dangerous, since tomorrow is
the last day we can commit into D.
Comment 28 Tomas Zezula 2004-11-11 20:51:48 UTC
I agree that for E the debug macro should be changed.
Comment 29 Tomas Zezula 2004-11-11 20:59:42 UTC
The current debug macro does not support customize.
The fix is good enough for D, the change of the debug macro 24 hours
before freeze is too dangerous.

Comment 30 Jesse Glick 2004-11-11 21:16:46 UTC
I filed issue #51436 accordingly.
Comment 31 Tomas Zezula 2004-11-11 21:21:21 UTC
I've tried to rewrite the debug macro to use the customize element and
it seems that it does not hurt anything. But I am not sure what was
the reason not to use it.
I can get it even into D, if you will do me a review.
Comment 32 Jesse Glick 2004-11-11 21:25:37 UTC
I agree that it is probably too risky to put this into D now. Consider
that the semantics of targets and macros is a kind of user API which
we would be breaking - relative to 4.0b2, which though nominally was a
"beta" was akin to a public release (bundled with JDK). If we are to
cause incompatibilities (for users who have already overridden some
targets in build.xml), we need to document them carefully. So I would
probably not recommend trying to make such a change now, though I
don't have strong feelings about it.
Comment 33 Tomas Zezula 2004-11-11 21:35:45 UTC
In this case I will tomorrow integrate this into D and then resolve
the issue #51436 into E.
Ok?
Comment 34 Milan Kubec 2004-11-12 08:48:34 UTC
I'm not very convinced that we should integrate in the day of code
freeze something that breaks compatibility of project metadata from
Beta2. Beta2 was considered as "almost FCS" public release and FCS
cannot break compatibility of project metadata.

Please provide really compelling reason why should we integrate it.
There is no duplicate, there is not vote and it's workaround for JDK
issue.
Comment 35 David Konecny 2004-11-12 09:02:21 UTC
Milan, incompatibilities mentioned here are planned for E (issue
51436). For D the original simple fix will be applied.

Re. why <j2seproject:debug> macro does not have <customize> - good
point, I completely overlooked that. Macros evolved independently I guess.
Comment 36 Tomas Zezula 2004-11-12 09:03:32 UTC
The current hot fix, which is not very nice, does not break
compatibility of the project metadata. The project metadata
compatibility would be broken by the right solution (using configure
element in the debug macro, or even better make java and debug as a
single macro as Jesse proposed - issue #51436)
Comment 37 Milan Kubec 2004-11-12 09:08:00 UTC
OK then. I misunderstood Tomas's last comment (the one before my
comment). Then it's approved :-).
Comment 38 zikmund 2004-11-12 10:38:32 UTC
I have tested the fix (both parts) - it seems to be ready for 4.0
integration. Thanks a lot for the fix, Tom!

(tested on JDK 1.4 & 1.5, Solaris & Windows, with and without space in
path)
Comment 39 Tomas Zezula 2004-11-12 10:45:33 UTC
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java,v
 <--  J2SEActionProvider.java
new revision: 1.29.8.1; previous revision: 1.29
done
Processing log script arguments...
More commits to come...
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/applet/AppletSupport.java,v
 <--  AppletSupport.java
new revision: 1.3.4.1; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in
j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.39.4.1; previous revision: 1.39
done