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 193340 - IllegalArgumentException: Parameter file was not normalized. Was null instead of null
Summary: IllegalArgumentException: Parameter file was not normalized. Was null instead...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
: 193523 194957 196627 199447 211848 213424 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-13 20:15 UTC by stopd
Modified: 2012-06-09 10:02 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 174969


Attachments
stacktrace (714 bytes, text/plain)
2010-12-13 20:15 UTC, stopd
Details
patched fs module (856.46 KB, application/octet-stream)
2010-12-20 13:03 UTC, Vladimir Voskresensky
Details
patched utils.jar (367.32 KB, application/octet-stream)
2010-12-20 13:07 UTC, Vladimir Voskresensky
Details
stacktrace (954 bytes, text/plain)
2011-04-06 23:15 UTC, prinsklyn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stopd 2010-12-13 20:15:21 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-6306-on-101210)
VM: Java HotSpot(TM) Client VM, 17.1-b03, Java(TM) SE Runtime Environment, 1.6.0_22-b04
OS: Windows 7

Stacktrace: 
java.lang.IllegalArgumentException: Parameter file was not normalized. Was null instead of null
   at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:1006)
   at org.netbeans.modules.cnd.utils.cache.CndFileUtils.toFileObject(CndFileUtils.java:130)
   at org.netbeans.modules.cnd.utils.MIMESupport.getFileMIMEType(MIMESupport.java:86)
   at org.netbeans.modules.cnd.utils.filters.HeaderSourceFileFilter.accept(HeaderSourceFileFilter.java:73)
   at javax.swing.JFileChooser.accept(JFileChooser.java:1576)
   at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:231)
Comment 1 stopd 2010-12-13 20:15:25 UTC
Created attachment 104027 [details]
stacktrace
Comment 2 Vladimir Kvashin 2010-12-14 02:21:16 UTC
http://hg.netbeans.org/cnd-main/rev/f733f3b05394
Comment 3 Vladimir Kvashin 2010-12-14 02:22:27 UTC
Please disregard my previous comment, I occasionally copy-pasted wrong text.
Comment 4 Vladimir Kvashin 2010-12-14 15:56:33 UTC
I was not able to reproduce this so far.

This might happen only if FileObjectBasedFile returned null path.

I pushed code that asserts path != null for FileObjectBasedFile just in FileObjectBasedFile constructor:
http://hg.netbeans.org/cnd-main/rev/e4b42ca3cb4f

Any comments on how to reproduce are appreciated.
Comment 5 Quality Engineering 2010-12-15 06:19:18 UTC
Integrated into 'main-golden', will be available in build *201012150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e4b42ca3cb4f
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: better diagnostic for #193340 -  IllegalArgumentException: Parameter file was not normalized. Was null instead of null
Comment 6 Vladimir Voskresensky 2010-12-15 21:54:40 UTC
let's evaluate exceptions as P2 issues
Comment 7 Vladimir Voskresensky 2010-12-16 20:52:53 UTC
stopd, any details how to reproduce this bug?
Comment 8 stopd 2010-12-16 21:34:33 UTC
Ok, I played a bit around and got some steps to reproduce it on my machine:

A freshly started Netbeans and inside an empty project group:
1. Create new "C/C++ Application" with a main file
2. Right click main.cpp in "Source Files" folder and do "Remove from Project"
3. Right click the project in the "Projects" view and do "Add Existing Item" and choose the main.cpp file
4. Left click once on the newly added main.cpp file
5. Right click once on the newly added main.cpp file
6. Click "Remove from Project"
7. Right click once the project in the "Projects" view
8. Click "Add Existing Item" 

I sometimes need to repeat steps 4 to 8 two or three times (adding the file on step 8 when no exception comes up). Always inserting the file and clicking on it and then without selecting anything else remove and add it using the context menu only.
Comment 9 Vladimir Voskresensky 2010-12-16 21:46:10 UTC
thanks.
And what is Files of Type filter?
Because by default I have "All Files" and exception is from another filter.
Can you submit exception again when dialog appears?

Thanks,
Vladimir.
Comment 10 stopd 2010-12-16 22:58:01 UTC
I submitted another occurrence of the exception but this time it happened with the all files filter. 

I think my steps before were probably just a coincidence. Instead if I add a file once (the name is kept as the default in the open dialog) and then repeatedly invoke the "Add Existing Item" context menu and just close the dialog, sooner or later the exception comes up.
Comment 11 Vladimir Voskresensky 2010-12-17 07:30:18 UTC
*** Bug 193523 has been marked as a duplicate of this bug. ***
Comment 12 Vladimir Voskresensky 2010-12-20 13:03:39 UTC
Created attachment 104309 [details]
patched fs module
Comment 13 Vladimir Voskresensky 2010-12-20 13:07:08 UTC
Created attachment 104310 [details]
patched utils.jar

could you, please, replace your jar files with attached files to get more tracing.

Thanks!
Vladimir.
Comment 14 Vladimir Voskresensky 2010-12-20 13:08:18 UTC
files to replace with attached versions are:

netbeans/cnd/modules/org-netbeans-modules-cnd-utils.jar
netbeans/platform/core/org-openide-filesystems.jar
Comment 15 Vladimir Voskresensky 2010-12-22 10:35:13 UTC
from user:
  Product Version         = NetBeans IDE Dev (Build nbms-and-javadoc-6348-on-101218) (#c87f4bc20449)
  Operating System        = Windows 7 version 6.1 running on x86
  Java; VM; Vendor        = 1.6.0_22; Java HotSpot(TM) Client VM 17.1-b03; Sun Microsystems Inc.
  Runtime                 = Java(TM) SE Runtime Environment 1.6.0_22-b04
  Java Home               = C:\Program Files (x86)\Java\jdk1.6.0_22\jre
  System Locale; Encoding = en (nb); Cp1252

SEVERE [MIMESupport]: input file null iof class sun.awt.shell.Win32ShellFolder2
java.lang.IllegalArgumentException: Parameter file was not normalized. Was null iof class sun.awt.shell.Win32ShellFolder2 path = C:\Projects\Java\CppApplication\Makefile parent= C:\Projects\Java\CppApplication canonical = null instead of null iof class sun.awt.shell.Win32ShellFolder2 path = C:\Projects\Java\CppApplication\Makefile parent= C:\Projects\Java\CppApplication
	at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:1015)
	at org.netbeans.modules.cnd.utils.cache.CndFileUtils.toFileObject(CndFileUtils.java:130)
[catch] at org.netbeans.modules.cnd.utils.MIMESupport.getFileMIMEType(MIMESupport.java:90)
	at org.netbeans.modules.cnd.utils.filters.HeaderSourceFileFilter.accept(HeaderSourceFileFilter.java:73)
	at javax.swing.JFileChooser.accept(JFileChooser.java:1576)
	at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:231)
	at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(BasicDirectoryModel.java:211)
Comment 16 Vladimir Voskresensky 2010-12-22 10:42:06 UTC
Looks like JDK related bug which we can not fix.
can you try what is advised in topic http://wiki.netbeans.org/FaqWindowsCPU
and put "nb.FileChooser.useShellFolder=false" into netbeans.conf
Comment 17 stopd 2010-12-22 14:47:39 UTC
Disabling the places bar by using "nb.FileChooser.useShellFolder=false" did not change anything



Using an older JDK caused a slightly different stack trace but is probably the same problem.

Product Version         = NetBeans IDE Dev (Build nbms-and-javadoc-6348-on-101218) (#c87f4bc20449)
Operating System        = Windows 7 version 6.1 running on x86
Java; VM; Vendor        = 1.6.0_20; Java HotSpot(TM) Client VM 16.3-b01; Sun Microsystems Inc.
Runtime                 = Java(TM) SE Runtime Environment 1.6.0_20-b02
Java Home               = C:\Program Files (x86)\Java\jdk1.6.0_20\jre
System Locale; Encoding = en (nb); Cp1252

SEVERE [org.openide.util.Exceptions]
java.lang.NullPointerException
	at sun.awt.shell.Win32ShellFolder2.pidlsEqual(Win32ShellFolder2.java:498)
	at sun.awt.shell.Win32ShellFolder2.equals(Win32ShellFolder2.java:491)
	at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:1005)
	at org.netbeans.modules.cnd.utils.cache.CndFileUtils.toFileObject(CndFileUtils.java:130)
	at org.netbeans.modules.cnd.utils.MIMESupport.getFileMIMEType(MIMESupport.java:90)
	at org.netbeans.modules.cnd.utils.filters.AllSourceFileFilter.accept(AllSourceFileFilter.java:81)
	at javax.swing.JFileChooser.accept(JFileChooser.java:1576)
	at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:231)
[catch] at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(BasicDirectoryModel.java:211)



I also tried a recent JDK7 build I have installed. I couldn't provoke the exception in this case.
Comment 18 Vladimir Voskresensky 2010-12-22 22:52:44 UTC
can someone familiar with JDK bugs evaluate, please?
Comment 19 Vladimir Voskresensky 2010-12-22 22:57:08 UTC
I think, key information is in comment #15 (which was generated with patched version of fs module).
Looks like normalization of file with path "C:\Projects\Java\CppApplication\Makefile" on Windows 7 went wrong due to corresponding canonical File for it is something with "null" as toString presentation
Canonical file itself is not null, as we can see it is instance of sun.awt.shell.Win32ShellFolder2.
Original file is also instance of sun.awt.shell.Win32ShellFolder2.
Comment 20 Vladimir Kvashin 2011-02-02 11:59:15 UTC
*** Bug 194957 has been marked as a duplicate of this bug. ***
Comment 21 Alexander Pepin 2011-02-02 12:46:57 UTC
Another simple steps to reproduce:
- create Subprojects application 
- open main.cc
- restart IDE
- call File->Open File...
Result: Exception occurs:
java.lang.IllegalArgumentException: Parameter file was not normalized. Was null
instead of null
    at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:1012)
    at
org.netbeans.modules.cnd.utils.cache.CndFileUtils.toFileObject(CndFileUtils.java:163)
    at
org.netbeans.modules.cnd.utils.MIMESupport.getFileMIMEType(MIMESupport.java:86)
    at
org.netbeans.modules.cnd.utils.filters.HeaderSourceFileFilter.accept(HeaderSourceFileFilter.java:73)
    at
org.netbeans.modules.cnd.utils.filters.CndOpenFileDialogFilter$Adapter.accept(CndOpenFileDialogFilter.java:91)
    at
org.netbeans.modules.cnd.utils.filters.CndOpenFileDialogFilter$HeaderFilter.accept(CndOpenFileDialogFilter.java:114)
    at javax.swing.JFileChooser.accept(JFileChooser.java:1576)
    at
javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:231)
    at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThr
Comment 22 Exceptions Reporter 2011-03-05 01:55:23 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=174969
Comment 23 Antonin Nebuzelsky 2011-03-07 12:34:29 UTC
Cannot reproduce.

Also cannot find any Java bug report in bugs.sun.com which would be related to "null" as toString of File.

Cannot do anything about it in JDK Problems category, cannot file as a Java bug myself without being able to provide them any details about the problem.

All exceptions gathered here are related to the same stacktrace going through org.netbeans.modules.cnd.utils.cache.CndFileUtils. No exceptions going through any other code path unrelated to CND.

Reassigning back to CND for further evaluation and most probably fixing in CND.
Comment 24 Vladimir Voskresensky 2011-03-08 08:09:05 UTC
(In reply to comment #23)
> Cannot reproduce.
> 
> Also cannot find any Java bug report in bugs.sun.com which would be related to
> "null" as toString of File.
> 
> Cannot do anything about it in JDK Problems category, cannot file as a Java bug
> myself without being able to provide them any details about the problem.
> 
> All exceptions gathered here are related to the same stacktrace going through
> org.netbeans.modules.cnd.utils.cache.CndFileUtils. No exceptions going through
> any other code path unrelated to CND.
> 
> Reassigning back to CND for further evaluation and most probably fixing in CND.
Have a look at my comment http://netbeans.org/bugzilla/show_bug.cgi?id=193340#c15
which I generated with patched FileUtil.
It means that getCanonical for sun.awt.shell.Win32ShellFolder2 returns "null" string (not null object)
I'd prefer FileUtil.toFileObject to be aware of this instead of hacking on our side.
Comment 25 Jaroslav Tulach 2011-03-08 08:36:34 UTC
Patch?
Comment 26 Vladimir Voskresensky 2011-03-08 12:17:24 UTC
(In reply to comment #25)
> Patch?
What do you mean?
I've just changed Logging in toFileObject to see more details to be smth like:

                    LOG.log(Level.WARNING, null, new IllegalArgumentException(
                    "Parameter file was not " + // NOI18N   
                    "normalized. Was " + file + " iof " + file.getClass() + " path=" + file.getPath() + " parent=" + file.getParent() +
                            " canonical = " + file.getCanonicalPath() + 
                            " instead of " + normFile + " iof " + normFile.getClass() + " path=" + normFile.getPath() + " parent=" + normFile.getParent()
                    ));
Comment 27 Jaroslav Tulach 2011-03-08 12:52:37 UTC
What do I mean? Whether you will provide a fix or not? Because, with all my respect, this is not P2 bug in filesystems, at most it is an enhancement for filesystems and I am not in mood to implement enhancements day before code freeze.
Comment 28 Vladimir Voskresensky 2011-03-10 06:35:42 UTC
         if (asserts) {
             File normFile = normalizeFile(file);
             if (!file.equals(normFile)) {
-                LOG.log(Level.WARNING, null, new IllegalArgumentException(
+                LOG.log(file.getClass().getName().startsWith("sun.awt.shell") ? Level.INFO : Level.WARNING, null, new IllegalArgumentException( // NOI18N
                 "Parameter file was not " + // NOI18N   
                 "normalized. Was " + file + " instead of " + normFile
                 ));
Comment 29 Vladimir Voskresensky 2011-03-10 06:37:50 UTC
Jarda, can you apply this simple fix in FileUtil.toFileObject to prevent exception dialog?
(Am I right, that dialog is shown for levels from warning and above?)
Comment 30 Jaroslav Tulach 2011-03-10 17:44:38 UTC
Guys, the exception is printed only with asserts on - e.g. it will not affect 7.0 FCS. I prefer to deal with the case in less rush then => TM=Next.
Comment 31 Vladimir Voskresensky 2011-03-10 20:49:03 UTC
(In reply to comment #30)
> Guys, the exception is printed only with asserts on - e.g. it will not affect
> 7.0 FCS. I prefer to deal with the case in less rush then => TM=Next.
You are right, no need for integration in to 7.0 but can I apply proposed fix in trunk?
It's rather annoying on Windows for users of dev builds
Comment 32 Jaroslav Tulach 2011-03-10 21:53:44 UTC
I still have not simulated the problem myself, but I believe that rather than changing the error verbosity, we shall fix 

FileUtil.normalizeFileOnWindows

to just ignore this case and return something meaningful. I can see there are some tricks for Windows Vista. Maybe we need new ones for Windows 7.
Comment 33 Vladimir Voskresensky 2011-03-10 22:11:55 UTC
I agree, it's much better to fix FileUtil.normalizeFileOnWindows
Comment 34 Vladimir Voskresensky 2011-03-13 12:06:36 UTC
*** Bug 196627 has been marked as a duplicate of this bug. ***
Comment 35 prinsklyn 2011-04-06 23:15:40 UTC
Created attachment 107571 [details]
stacktrace
Comment 36 Jaroslav Tulach 2011-04-07 10:15:57 UTC
I checked in ergonomics#336772e876bb, but I did not test it. The code is based on Vladimir's "if", so it could work. Please verify the fix.
Comment 37 Quality Engineering 2011-04-15 08:38:44 UTC
Integrated into 'main-golden', will be available in build *201104150401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/336772e876bb
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #193340: Ignore special UI subclasses of File used on Windows
Comment 38 nnnnnk 2011-09-29 09:19:26 UTC
*** Bug 199447 has been marked as a duplicate of this bug. ***
Comment 39 Alexander Simon 2012-04-27 16:02:48 UTC
*** Bug 211848 has been marked as a duplicate of this bug. ***
Comment 40 Alexander Simon 2012-04-27 16:03:40 UTC
Occurred on NB 7.2
Comment 41 Jaroslav Tulach 2012-05-02 06:36:23 UTC
I need a bit more information then "occured in 7.2" to do something with the bug. Closing. Btw. there is no report from 7.2 among the list of exception reporter duplicates...
Comment 42 Vladimir Voskresensky 2012-05-02 08:55:31 UTC
Jarda, can you for simplifying the issue investigation to add 
file.getClass().getName() to the log report (in 7.2)?

If I remember correctly 7.2-based issue has happened in the FileChooser with custom Files and FileObject based Filter

Thanks,
Vladimir.
Comment 43 Alexander Simon 2012-06-09 10:02:16 UTC
*** Bug 213424 has been marked as a duplicate of this bug. ***