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 169963

Summary: java.net.URISyntaxException: Illegal character in opaque part at index 22: jar:file:/C:/Documents and Settings/A148999/Mis documentos/workspace/LIBRARIES/JSF-FACELETS/lib/commons-beanutils.jar!/
Product: javaee Reporter: vieiro <vieiro>
Component: JSFAssignee: Alexey Butenko <alexeybutenko>
Status: RESOLVED FIXED    
Severity: blocker Keywords: SPACE_IN_PATH
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=155108
Issue Type: DEFECT Exception Reporter: 155108
Attachments: stacktrace
screenshot-1
screenshot-2
screenshot-3
MYJSFLIBRARY.xml

Description vieiro 2009-08-06 09:55:10 UTC
Build: NetBeans IDE Dev (Build 200908022240)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Windows XP, 5.1, x86

User Comments:
vieiro: Adding a new JSF library in a Web Project



Stacktrace: 
java.net.URISyntaxException: Illegal character in opaque part at index 22: jar:file:/C:/Documents and Settings/A148999/Mis documentos/workspace/LIBRARIES/JSF-FACELETS/lib/commons-beanutils.jar!/
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parse(URI.java:3019)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URI.create(URI.java:840)
        at org.netbeans.modules.project.ant.ProjectLibraryProvider.copyLibrary(ProjectLibraryProvider.java:1048)
Comment 1 vieiro 2009-08-06 09:55:15 UTC
Created attachment 85891 [details]
stacktrace
Comment 2 Jesse Glick 2009-08-07 00:55:22 UTC
The root problem is some library definition which specifies a malformed URL:

jar:file:/C:/Documents and Settings/A148999/Mis documentos/workspace/LIBRARIES/JSF-FACELETS/lib/commons-beanutils.jar!/

should be:

jar:file:/C:/Documents%20and%20Settings/A148999/Mis%20documentos/workspace/LIBRARIES/JSF-FACELETS/lib/commons-beanutils.jar!/

Reporter, please locate the $userdir/config/org-netbeans-api-project-libraries/Libraries/*.xml which contains this bad
URL. (You can correct it on disk as a workaround.) In order to fix, we would need to know when this entry was added to
the file (probably when the file was created - but was this in an old userdir which you imported), and what IDE feature
was responsible for creating the file - e.g. Tools > Library Manager, or something else?
Comment 3 vieiro 2009-08-07 08:09:34 UTC
Steps to reproduce (NB 6.8 M1):

1.- Create a brand new web project.
2.- Proceed through the Wizard. On the "Frameworks" step select "JavaServer Faces" (which should read "Java Server
Faces", by the way).
3.- Select the "Create New Library" option.
  3.1.- On the "JSF Directory" select a directory where the JSF jar files are available (I think this seeks for
jsf-api.jar or something).
  3.2.- On the "Library Name" enter a dummy name. In this very test case I entered "MYJSFLIBRARY".
[See screenshot-1]

After a (long?) while an exception happens
[See screenshot-2].

I'm attaching the two screenshots and the generated "MYJSFLIBRARY.xml" file. Note that this file contains spaces instead
of "%20".




Comment 4 vieiro 2009-08-07 08:10:13 UTC
Created attachment 85940 [details]
screenshot-1
Comment 5 vieiro 2009-08-07 08:10:34 UTC
Created attachment 85941 [details]
screenshot-2
Comment 6 vieiro 2009-08-07 08:10:58 UTC
Created attachment 85942 [details]
screenshot-3
Comment 7 vieiro 2009-08-07 08:11:27 UTC
Created attachment 85943 [details]
MYJSFLIBRARY.xml
Comment 8 Jesse Glick 2009-08-07 18:01:13 UTC
JSFUtils.java line 157:

URL url = jars[i].toURL();
url = FileUtil.getArchiveRoot(url);
urls.add(url);

You should know that File.toURL is deprecated in JDK 6 for the good reason that it doesn't work. Always use
File.toURI().toURL() instead. (Even that is broken for UNC paths but supposedly the fix for issue #46813 made it not
matter.) Anyway there is an easier way to handle getting classpath-format URLs from File's:

URL url = FileUtil.urlForArchiveOrDir(jars[i]);
if (url != null {
    urls.add(url);
}
Comment 9 Alexey Butenko 2009-08-20 13:55:14 UTC
http://hg.netbeans.org/web-main/rev/1550275c5713
Comment 10 Quality Engineering 2009-08-21 06:16:03 UTC
Integrated into 'main-golden', will be available in build *200908210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1550275c5713
User: Alexey Butenko <alexeybutenko@netbeans.org>
Log: #169963: NPE fix