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 33976 - code generation fails
Summary: code generation fails
Status: RESOLVED DUPLICATE of bug 33040
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Tomas Pavek
URL:
Keywords:
: 33975 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-28 17:21 UTC by drobbins
Modified: 2003-07-25 16:45 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ide log file (59.52 KB, text/plain)
2003-05-28 17:21 UTC, drobbins
Details
source code (86.11 KB, text/plain)
2003-05-29 20:14 UTC, drobbins
Details
ide log file (152.73 KB, text/plain)
2003-05-30 19:28 UTC, drobbins
Details
log file (17.52 KB, text/plain)
2003-06-03 16:37 UTC, drobbins
Details
before and after (10.13 KB, text/plain)
2003-06-04 14:01 UTC, drobbins
Details
log file (30.23 KB, text/plain)
2003-07-01 13:18 UTC, drobbins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description drobbins 2003-05-28 17:21:03 UTC
Hi,
I've been developing an applet with 3.5 RC2 using the GUI 
form editor and I've run across a problem. When I compile 
my code, all the source code disappears. The size of 
my .java source file goes to zero. everything still 
appears ok in the form editor. The log file seems to 
indicate some problem with code generation so I guess it's 
trying to re-generate my source code and failing. HEditor 
is tha name of my applet and it says something about an 
incompatible superclass, but the superclass is just 
JApplet. What's really odd is that this is intermitent. 
I've got the file under source control so when this 
happens I can retrieve my last saved version and continue 
working. Things go along fine for a few hours then the 
source file blows up again. It seems to happen when I 
compile my code. I attached the log file and my source 
file as well.

Dave
Comment 1 drobbins 2003-05-28 17:21:47 UTC
Created attachment 10491 [details]
ide log file
Comment 2 drobbins 2003-05-28 17:22:35 UTC
here's the source file
Comment 3 Jaromir Uhrik 2003-05-28 17:27:45 UTC
*** Issue 33975 has been marked as a duplicate of this issue. ***
Comment 4 Jaromir Uhrik 2003-05-29 08:12:59 UTC
Dave, could you please attach the source file, your previous try to
attach was not successful. Thanks.
Comment 5 drobbins 2003-05-29 20:13:03 UTC
Hi,
 
 this may not be very obvious, let me explain the code
 the applet needs to display about 20 tables which is way 
more than will
 fit on the screen
 the tables don't all need to appear all the time
 so the main UI is a jscrollpane containing a jpanel
 when the user clicks a configure button, a table gets 
displayed that
 list's all the possible tables
 he checks off the ones he wants to work with and they are 
dynamically
 created and added to the scrollpane/panel
 the table I'm using is a third party bean you don't have, 
I included a
 demo copy of it and send it to you
 I'm working on 2 other applets that are a little less 
complicated and
 haven't seen this problem with them
 
 Dave

ps: I've had another thought
I used to do all my work under the GUI Editing tab
I'd have the form editor and the source editor both open 
and jump back and forth. Just about the time this problem 
poped up, I started keeping the form editor full size 
under the GUI editing tab and a source code editor open 
under the Editing tab. Maybe this has something to do with 
the prob?
Comment 6 drobbins 2003-05-29 20:14:58 UTC
Created attachment 10516 [details]
source code
Comment 7 drobbins 2003-05-29 20:15:53 UTC
sorry about that, could figure out how to attach a file :)
Comment 8 drobbins 2003-05-30 19:28:35 UTC
Created attachment 10540 [details]
ide log file
Comment 9 drobbins 2003-06-03 16:37:57 UTC
Created attachment 10572 [details]
log file
Comment 10 drobbins 2003-06-03 20:14:16 UTC
this is happening to me about once a day
are you able to reproduce it?
it happens when I compile and it wipes out part of 
my .java source file
I sent another log file
I think the source I sent is in a form you can load and 
try to make it break, you won't be able to execute it 
without the database connection but that shouldn't be 
required
let me know if there is anything I can do to help out

Dave
Comment 11 drobbins 2003-06-04 14:01:13 UTC
Created attachment 10584 [details]
before and after
Comment 12 drobbins 2003-06-04 14:03:32 UTC
I just can't figure out how to use this system :(
the zip file I just sent contains the before and after of 
another event. It's really odd, this time it trashed code 
in the middle of the file and left the beginning and end 
intact. The error occured at line 50. No mention of it in 
the log file.

Dave
Comment 13 drobbins 2003-06-11 03:52:01 UTC
hello folks,
there doesn't seem to be any action on this issue. it would seem to me
that it is a show stopper. I've experienced it a dozen times. now one
of my co-developers has experienced it with a much simpler applet. it
appears to have to do with the source code editor and the form editor
trying to sync their code. let me know if you are unable to reproduce
this problem and I will try to help demonstrate the situation for you 

Dave
Comment 14 Tomas Pavek 2003-06-11 17:14:13 UTC
Dave, this thing really looks strange, I am not able to reproduce it.
It works fine on my machine. What are the exact steps - just working
in the form editor? Does it
happen after a change is done in the form editor (that's the moment
when form editor regenerates the code)? Or it happens on save (before
compilation)? Note form editor regenerates only part of the code (in
guarded blocks). It never happens when just working in the source
editor? Does it happen to you only for this particular example
(HEditor)? Can be reproduce without having the file in version
controlling filesystem? It's lot of question, but I'm trying to find
out what the relevant conditions are here.

Going through the log files, there is a suspicious exception from
source editor on two places, like:

java.lang.IndexOutOfBoundsException: Invalid line index=367 >=
lineCount=367
	at
org.netbeans.editor.LineRootElement.getElement(LineRootElement.java:54)
	at org.openide.text.NbDocument.findLineOffset(NbDocument.java:124)
	at org.openide.text.DocumentLine.updatePositionRef(DocumentLine.java:413)
	at org.openide.text.DocumentLine.notifyMove(DocumentLine.java:403)
	at org.openide.text.DocumentLine$Set.linesMoved(DocumentLine.java:692)
	at org.openide.text.LineListener.insertUpdate(LineListener.java:119)
	at
org.openide.util.WeakListener$Document.insertUpdate(WeakListener.java:705)
	at
javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:184)
	at
org.netbeans.editor.BaseDocument.fireInsertUpdate(BaseDocument.java:1004)
	at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:583)
	at org.netbeans.editor.Analyzer.read(Analyzer.java:501)
	at org.netbeans.editor.BaseDocument.read(BaseDocument.java:917)
	at org.netbeans.editor.BaseKit.read(BaseKit.java:411)
	at
org.netbeans.modules.java.JavaEditor.loadFromStreamToKit(JavaEditor.java:326)
	at
org.openide.text.EditorSupport$Del.loadFromStreamToKit(EditorSupport.java:667)
[catch] at
org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:1167)
...


There are also some SAXExceptions - this indicates corrupted form
file, but that might be unrelated to this issue.
Comment 15 Tomas Pavek 2003-06-11 17:17:25 UTC
Editor guys, could you please evaluate the exception above? Or if you
have some idea about cause of this problem? (Especially the corrupted
java file in attachment 10584 [details] files.zip could be interesting for you.)
Thanks.
Comment 16 Tomas Pavek 2003-06-11 17:18:29 UTC
Jaromir, could you try to reproduce the problem during the time I'll
be on vacation next 7 days?
Comment 17 drobbins 2003-06-12 02:41:54 UTC
Hi guy's

this is the scenario
I used the form editor to put together the UI
then I started implementing the business logic. So I'm working in the
source editor and about once or twice a day, when I compile the code,
I get an exception and it trashes my source code. At first I thought
it had to do with the fact that the applet has some kinda convoluted
logic. It's creating tables on the fly and loading them with data from
a database, but now one of my co-workers has experienced the same
problem with a much simpler applet(he's using the same third party
class). now I'm starting the suspect the third part class we're using.
I would think that if this were a bug in the IDE other people would be
experiencing it also. I'm not positive but I've started doing a clean
before I do a compile and that seems to have made the problem go away.
when I don't do a clean, I see windows flicker during the compile,
sometimes the IDE stops being the top window on my desktop, it's like
it's re-writing the source files and it's reloading itself. I'll try
to come up with an example that shows the problem, but up till now it
seem to be very random and I don't know how to make it happen regularly.  
In your efforts to reproduce it, try moving things around in the form
editor and modifyiyng the source code a little. declare an int
somewhere or something. I don't know if this is caused by the third
party class or what but it would seem to be something that needs to be
caught. Let me know what I can do to help

Dave   
Comment 18 Martin Roskanin 2003-06-12 08:40:07 UTC
I would say that the root of this problem is here:
Annotation: The document HEditor could not be loaded.
java.lang.IndexOutOfBoundsException: Invalid line index=410 >=
lineCount=410
	at org.netbeans.editor.LineRootElement.getElement(LineRootElement.java:54)
	at org.openide.text.NbDocument.findLineOffset(NbDocument.java:124)
	at org.openide.text.DocumentLine.updatePositionRef(DocumentLine.java:413)
	at org.openide.text.DocumentLine.notifyMove(DocumentLine.java:403)
	at org.openide.text.DocumentLine$Set.linesMoved(DocumentLine.java:692)

It is known problem in editor - issue #33040, Tomas, feel free to
duplicate this issue.
Comment 19 Tomas Pavek 2003-06-25 08:45:58 UTC
It seems the root cause is really the issue 33040. But Dave is right
some reloading happens behind, maybe connected to version control - it
can be seen at least on stacktraces of the failing forms in the
ide.log (however I don't know how much this is related).

Dave, do you use the NetBeans version control support? If yes, does
the problem happen if you have the sources mounted just as ordinary
filesystem (not VCS)? And if you open the java code of form only using
"Edit" command from context menu in Explorer (so the form editor is
not open and active)?
Comment 20 drobbins 2003-06-25 21:15:41 UTC
The applet I'm building runs in a web site that is being 
developed with InterDev. The whole thing is under Visual 
Source Safe version control. InterDev is running in local 
mode where all the master files are on a machine somewhere 
else and I have a local copy on my machine. I have noticed 
that when I check my java stuff in and backout using 
interdev, netbeans see's the file have changed(it marks 
the applet as not being compiled)That probably has 
something to do with timestamps. Even when I compile 
succesfully I see a lot of windows moving around, often 
the window displaying my source will jump to the end of 
the file and then back to where I was working. I also 
occationally see the entire netbeans application stop 
being the topmost window on my screen. I will try opening 
the file so the from editor is not active and let you know 
if it seems to make a difference
Comment 21 drobbins 2003-07-01 13:18:25 UTC
Created attachment 10846 [details]
log file
Comment 22 drobbins 2003-07-01 13:18:53 UTC
I think this might be releated to the problem I've been 
having. This morning I started to work, wrote a few lines 
of code and tried to save my work before compiling it. I 
got an exception and couldn't save. I restarted netbeans 
and the problem went away. The exception is in the attached 
log file. The problem with trashing the source file seems 
to be related to saving so maybe this will shed a little 
more light on whats going on.

Dave
Comment 23 Tomas Pavek 2003-07-01 17:23:31 UTC
The exception is somewhere from debugger. Have you started the
debugger in that IDE session (before you edited the file and tried to
save it)? The exception seems to be unrelated to this problem for me.
But thanks for it. Probably you should try to report it for
debuggercore as separate issue.
Comment 24 Tomas Pavek 2003-07-25 16:45:06 UTC

*** This issue has been marked as a duplicate of 33040 ***