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 103210 - Indentation of Java files doesn't work until you open HTML file
Summary: Indentation of Java files doesn't work until you open HTML file
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords: RANDOM
: 103643 104209 111969 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-05-03 09:50 UTC by Jiri Skrivanek
Modified: 2007-11-05 13:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2007-05-03 09:50:24 UTC
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.
Comment 1 Jiri Prox 2007-05-03 10:23:25 UTC
Cannot reproduce. There is failing formating test, but it happens on one
specific machine (Solaris) and is not reproducible manually.
Comment 2 Jiri Skrivanek 2007-05-03 10:42:34 UTC
OK, you are right it is random. For me it happens approximatelly 2 times from 5
attempts.
Comment 3 Miloslav Metelka 2007-05-03 15:56:05 UTC
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.
Comment 4 Vitezslav Stejskal 2007-05-06 22:13:42 UTC
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.
Comment 5 Jiri Skrivanek 2007-05-07 09:22:41 UTC
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?
Comment 6 Vitezslav Stejskal 2007-05-08 00:19:25 UTC
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.
Comment 7 _ gtzabari 2007-05-11 04:14:30 UTC
*** Issue 103643 has been marked as a duplicate of this issue. ***
Comment 8 _ gtzabari 2007-05-11 04:18:13 UTC
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.
Comment 9 Vitezslav Stejskal 2007-05-18 00:38:21 UTC
*** Issue 104209 has been marked as a duplicate of this issue. ***
Comment 10 Jiri Prox 2007-08-06 09:42:03 UTC
*** Issue 111969 has been marked as a duplicate of this issue. ***
Comment 11 Jan Pokorsky 2007-08-07 17:47:54 UTC
It seems to be fixed in the latest build 070807.
Comment 12 Jiri Skrivanek 2007-09-04 09:06:46 UTC
Verified.