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.
Indentation in Java files doesn't work until you open a HTML file. To reproduce: - start IDE with empty userdir - create a java project from template - press Enter at the end of e.g. line 19 - it is not indented but cursor jumps to the beginning of the line - type e.g. int i = 0; - try Ctrl+Shift+F to reformat code but nothing happens - create a new HTML file from template - return back to Main.java and again press Ctrl+Shift+F. It works now. Build 20070503-0713, WindowsXP, JDK1.6.0_02-e2-b02.
Cannot reproduce. There is failing formating test, but it happens on one specific machine (Solaris) and is not reproducible manually.
OK, you are right it is random. For me it happens approximatelly 2 times from 5 attempts.
BTW I've experienced a similar problem. Sometimes when the IDE started with a java source already opened the indentation did not worked (cursor on column one after Enter). Opening and closing Tools->Options always helped.
I couldn't reproduce it either. I don't think there was any real connection between java and HTML files. Opening any file of a type that had not been opened yet would have probably fixed the problem simply because the settings hierarchy is reset whenever a new file type is opened for the first time. The same happens when you open Tools-Options (Advanced) for the first time.
I am still able to reproduce is regularly. I read your comment that it happens because the settings hierarchy is not initialized. Does it mean some event (file open) haven't arrived? Why? Could you fix it with that knowledge? Or could you send a patch with some diagnostic?
Probably, or the events arrive in a wrong order. It all boils down to finding an IndentEngine for a mime type, which currently is a tricky bussines. I suspect that sometimes this can happen even before the settings hierarchy is fully initialized, in which case the proper IndentEngine can't be found and the default one is created instead. Then opening another file type means the settings hierarchy is reset and the whole excercise is done again, this time probably with more luck. I'll see if I can track it down. It's usually working fine for me, but then I do not restart the IDE very often.
*** Issue 103643 has been marked as a duplicate of this issue. ***
I suspect you would track this issue much faster if Netbeans would fail-fast when the operation fails (code-format or indentation) due to some missing dependency. Also, you should dump tons of debug information when this occurs :) I think this is a recently introduced bug because I don't think I saw it in a build from a week or two ago.
*** Issue 104209 has been marked as a duplicate of this issue. ***
*** Issue 111969 has been marked as a duplicate of this issue. ***
It seems to be fixed in the latest build 070807.
Verified.