Bug 88745 - Opening an Existing Project or File causes NullPointerException
Opening an Existing Project or File causes NullPointerException
Status: RESOLVED WONTFIX
Product: projects
Classification: Unclassified
Component: Generic Projects UI
5.x
PC Windows XP
: P3 (vote)
: 5.x
Assigned To: Jan Lahoda
issues@projects
jdk_bug_6210674
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-06 21:34 UTC by dscarson
Modified: 2006-11-09 00:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
messages log showing java.lang.NullPointerException (17.50 KB, text/plain)
2006-11-06 21:36 UTC, dscarson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dscarson 2006-11-06 21:34:38 UTC
When attempting to open an existing project or any file, for that matter, a 
NullPointerException occurs.
Comment 1 dscarson 2006-11-06 21:36:14 UTC
Created attachment 35814 [details]
messages log showing java.lang.NullPointerException
Comment 2 dscarson 2006-11-06 21:42:55 UTC
I attempted to diagnose this issue as a possible UNC path problem by moving 
the NB USERDIR default from HOME to another location, as shown in the message 
log configuration parameters. However, it appears that NB still uses HOME as 
the default location for new projects, and possibly existing projects(?) which 
may be causing the problem? This change had no effect. I had noted similar 
problems in NB 5.0 under WinXP in this environment.
Comment 3 novakm 2006-11-08 08:38:09 UTC
Reassigning to projects - ui
Comment 4 novakm 2006-11-08 09:39:09 UTC
Suggested workaround is to change your Home dir using
nb.exe -J-Duser.home=<path>
Comment 5 dscarson 2006-11-08 16:14:14 UTC
The suggested workaround has no effect. On the ND About/Detail window, Home 
Dir is still show as a UNC path: \\gasbar\Redirect$\carson. The User Home 
directory had been previously moved by modifying the netbeans.conf file to 
explicitly change its location:

  # ${HOME} will be replaced by JVM user.home system property
  #netbeans_default_userdir="${HOME}/.netbeans/5.5"
  netbeans_default_userdir="C:\.netbeans\5.5"

When attempting to create a new project, the default location showed the UNC 
path format and a warning icon appeared in the bottom left corner of the 
window complaining about an invalid path name.
Comment 6 Jesse Glick 2006-11-08 17:06:49 UTC
Issue #46813 records that UNC paths should be supported generally in NB.
Currently they are not.

You should use a non-UNC user directory. Editing netbeans.conf ought to work for
that purpose; perhaps you edited the wrong file etc. You can always use
--userdir from a command shell to try a particular userdir temporarily.

For creating projects, you must use a non-UNC path. Mount a drive letter as needed.

The NPE looks unrelated to me; some bug in Swing. Please file it on the Java
BugParade.

*** This issue has been marked as a duplicate of 46813 ***
Comment 7 dscarson 2006-11-08 18:09:33 UTC
Perhaps I'm characterizing the problem incorrectly.

I can move the netbeans.conf file to any location (if the location contains a 
UNC pathname, an warning message is printed in the log file stating 
build.properties cannot be properly written to). I just moved it back to the 
default location of netbeans_default_userdir="${HOME}/.netbeans/5.5". This is 
translated to "C:\Documents and Settings\carson\.netbeans\5.5" on my system 
according to the Help/About/Detail page.

However, the "Home Dir" field on that page has always shown a UNC pathname 
("\\gasbar\Redirect$\carson"). This value is populated on the "New Project 
[...]" page along with the message at the bottom stating "Project Folder is 
not a valid path." This invalid path message disappears if I replace the UNC 
path with a drive letter path. I believe this is what is occurring when I 
attempt to open an existing project (created on another workstation), except, 
the NPE occurs and browser window never opens.

Therefore, the question should be, "How do I permanently modify the 'Home Dir' 
parameter so that it does not use the UNC pathname provided by my roaming 
profile?" There does not appear to be a command line option to do this.
Comment 8 Jesse Glick 2006-11-08 18:31:37 UTC
"Home Dir" doesn't matter much. It is used as an *initial default* location for
New Project but no more. (Should remember a different location after you first
use it.) Pick a different location to create projects in. If you want to use
your home dir you must first mount it on a drive letter and use that path instead.

*** This issue has been marked as a duplicate of 46813 ***
Comment 9 dscarson 2006-11-08 19:12:28 UTC
Replacing the UNC pathname on a new project with a drive letter equivalent 
allows me to create a new project in the desired location; however, I can 
still not open an existing project without experiencing the NPE error. 
Furthermore, if I close the new project and attempt to reopen it I cannot do 
so unless I choose "File/Open Recent Project".

NB does remember the new Home Dir location as a drive letter path, however, 
you still cannot use the Browse button, even when creating new projects.

As it stands, I can only create new projects and open recent projects. The 
workarounds proposed have not been sufficient.
Comment 10 Jesse Glick 2006-11-08 19:57:31 UTC
Afraid we cannot help you with the NPE as this looks like a bug in Swing's
filechooser implementation on Windows:

		ShellFolder sf = (ShellFolder)files[i];
		icon = new ImageIcon(sf.getIcon(true), sf.getFolderType());
                                     ^^^^^^^^^^^^^^^^
                                     null for some reason

I don't know what about your environment would trigger such a bug. (You're not
running Vista or any otherwise unusual version of Windows?) Please file it on
BugParade so it is tracked. You may wish to try a different JDK, e.g. JDK 6 (a
current build like b104, *not* a beta) which might have a fix for this NPE. It
might also help to run with a nonnative look and feel until the NPE is resolved:

http://wiki.netbeans.info/wiki/view/FaqCustomLaf
Comment 11 dscarson 2006-11-08 21:40:32 UTC
Under WinXP SP2, for both JRE 1.5.0_09 and JRE 1.6.0-beta2, the problem is 
corrected by using the "javax.swing.plaf.metal.MetalLookAndFeel" as suggested 
in the NB wiki. It still exists in JRE 1.6.0-beta2 using the default Windows 
look-and-feel.

I will file a bug report with Sun regarding this issue.
Comment 12 dscarson 2006-11-08 23:50:31 UTC
Appears to be similar to BugID 6210674 (FileChooser fails to load custom 
harddrive icon and gets NullPointerException) in Sun Developer Network 
Database.

Workaround is to not use Windows L&F.
Comment 13 Jesse Glick 2006-11-08 23:51:14 UTC
Again, try a current build of JDK 6, not a beta. I have no idea if this area of
code has been touched since then but it is quite possible.
Comment 14 Jesse Glick 2006-11-09 00:03:47 UTC
OK, recording that. It does look like the problem you are having. If you have
any removable drives you don't need, try removing them to see if that helps.

Or if you're more adventurous and/or bored I'm sure you could figure out how to
patch WindowsPlacesBar.java to do a proper null check, compile it, jar it, and
add e.g. -J-Xbootclasspath/p:c:\6210674-patch.jar to your options in netbeans.conf.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo