I have code completion switched off in Options.
When I invoke it with Ctrl-Space, e.g.:
$s = substr(/* do Ctrl-Space here */)
I get a NullPointerException every time.
Created attachment 63580 [details]
message log file
Interesting issue. If it is always reproducible on the default installation in Windows it is a P1. Setting P2 for now.
I cannot reproduce it on my machine. I tried it on Windows Vista, both my NB project as well as the user dir were placed in a directory with spaces.
Can you reproduce it every time, or is it random? I don't think the fact that CC auto popup is off is relevant (obviously I tried both settings)
I am asking Tor for opinion. I copied the code where the exception is thrown from his sources ;-)
I haven't tried it yet. I will do that next. But other relevant info is:
The CC options I have are:
Auto Popup Copmpletion Window (off)
Auto Popup Completion Documentation Window (on)
Insert Single Proposals Automatically (on)
Guess Filled Method Arguments (off)
Case Sensitive Code Completion (off)
Show Deprecated Members in Code Completion (on)
Insert Closing Barckets Automatically (on)
Also, the following type of CC works:-
// looking for is_numeric() here
if (is<Ctrl-Space> //CC works OK
It only seems to NPE if I Ctrl-Space within "()".
I'll try Auto CC on next.
I have an even bigger problem with Auto Code Completion on.
I want to $s = substr(...)
I get as far as typing $ and I get an IllegalArgumentException - every time. I'm attaching the log for that.
Created attachment 63601 [details]
message log (IllegalArgumentException)
Looking at the first message log I attached, it wasn't an NPE but an IAE.
I now can't seem to Auto Code Completion work. I have to manually invoke with Ctrl-Space.
I also had to delete my netbeans userdir as it seems that something to do with this problem had caused a corruption.
I am now able to reproduce a different exception (an NPE) with your steps, hopefully it is the same problem
java.lang.NullPointerException: The file parameter cannot be null
It sounds like there are several problems here:
(1) You've turned off auto completion, yet somehow code completion is getting invoked automatically as well. That was a
bug in 6.0 and 6.1, but should be fixed now in 6.5 with Vita's editor settings rewrite (issue 90403).
(2) You're getting an exception during code completion when formatting a code completion item. Is there a good reason
example, I call getFileNameUrl() - but that just accesses the URL. I pull out the basename of the file from the URL
itself; I don't actually parse the URL and reconsistitute the path.
(3) The URL has spaces in it, but it isn't a correct URL; URLs should have %20 instead of spaces. I'm not sure how
that happened. But the correct way to create a URL string from a file is this:
In particular, do NOT use file.getURL(). (See http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#toURL() ).
Actually my URL seems properly encoded:
The problem seems to be in the URLMapper.findFileObject() method. Please reassign it to the right component.
Really? In the earlier IllegalArgumentException stacktrace I saw this:
java.lang.IllegalArgumentException: Illegal character in path at index 18: file:/C:/Documents and Settings/Ian Carter/My
Documents/NetBeansProjects/phpLibs/wwwroot/classes/class.string_lib.php [file:/C:/Documents and Settings/Ian Carter/My
[catch] at org.netbeans.modules.masterfs.filebasedfs.FileBasedURLMapper.getFileObjects(FileBasedURLMapper.java:122)
Here there are spaces instead of %20's, for example at offset 18. Or are you saying that the URL passed into URLMapper
is correct (with %20's) and that it's somehow translated into something else inside of there before the argument
exception is thrown?
yes, it looks like a correctly encoded URL gets descrambled in the way
Integrated into 'main-golden', available in NB_Trunk_Production #286 build
User: Tomasz Slota <firstname.lastname@example.org>
Log: #138448: Invoking CC when off by default gives NPE
reassign to openide
I tried the code below and it works. With spaces instead of %20 it throws IllegalArgumentException. Please, give me a
test case or steps how to reproduce.
String urlPath = "file:/C:/Documents%20and%20Settings/admin/My%20Documents/test.php";
URL url = new URL(urlPath);
FileObject fo = URLMapper.findFileObject(url);
Yes, it was on my side after all. Should be finally fixed.
Integrated into 'main-golden', available in NB_Trunk_Production #292 build
User: Tomasz Slota <email@example.com>
Log: #138448: URLMapper.findFileObject() fails for a valid url on Windows
Updating to P1, the fix should get into M1 if only possible
Fix integrated into the release65_m1 branch.