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 66744 - Sources of JFrame can't be changed.
Summary: Sources of JFrame can't be changed.
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
: 65500 70318 71198 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-13 19:29 UTC by Peter Pis
Modified: 2007-11-05 13:44 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Debug messages. "System.outs" and Thread.dumpStack()'s added to GuardedDocument.setCharacterAttributes() (32.92 KB, text/plain)
2005-10-25 12:35 UTC, Jan Becicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Pis 2005-10-13 19:29:04 UTC
Product Version       = NetBeans IDE Dev (Build 051013)
Operating System      = Windows XP version 5.1 running on x86
Java; VM; Vendor      = 1.5.0_05; Java HotSpot(TM) Client VM 1.5.0_05-b05; Sun
Microsystems Inc.
Java Home             = d:\Java\jdk1.5.0_05\jre

Steps:
1. Check out sources, open project.
2. Create new JFrame in it. Open it into editor area.
3. Invoke "CVS | Commit" on it.
4. In design view add some components. Save and commit it again.
5. Select JFrame and invoke "CVS | Show Annotations ..."
6. In "Annotation" column invoke "Rollback to 1.1" popup menu action

Source code of JFrame is now guarded. It can be changed.
Comment 1 Maros Sandor 2005-10-17 14:40:59 UTC
I am unable to reproduce it.
Comment 2 Maros Sandor 2005-10-19 14:28:20 UTC
We do not set or maintain guarded blocks, we just change local files on disk and
then fire events that these files have changed. I do not see how we can do
something that would break guarded blocks. Please evaluate.
Comment 3 Jan Stola 2005-10-21 14:50:50 UTC
Reassigning to java. I do not see how form can cause this behaviour,
but I am sure that you will find some reason ;-).
Comment 4 Jan Becicka 2005-10-21 16:07:16 UTC
Is this one reproducible?
Comment 5 Jan Becicka 2005-10-25 12:33:00 UTC
The bug is probably in editor. I'm attaching debug thread dumps showing, that
although GuardedDocument.setCharacterAttributes() is called with correct values
("Mark Guarded(start, length)"), value of
GuardedDocument.guardedBlockChain.chain.startMark.multiMark.rawOffset is really
strange. It is "1073741823".
Comment 6 Jan Becicka 2005-10-25 12:35:27 UTC
Created attachment 26311 [details]
Debug messages. "System.outs" and Thread.dumpStack()'s added to GuardedDocument.setCharacterAttributes()
Comment 7 Miloslav Metelka 2005-10-26 09:50:29 UTC
Please don't look at rawOffset values, they are really "raw" but even 1073741823
can be OK because (Integer.MAX_INT / 2) gets subtracted from the rawOffset
because it's a gap storage. The only relevant value is mark.getOffset() or
position.getOffset().
Comment 8 Jan Becicka 2005-10-26 10:18:04 UTC
OK. In this case docLen=30673
GuardedDocument.guardedBlockChain.chain.startMark.multiMark.getOffset() is 30673
GuardedDocument.guardedBlockChain.chain.next.startMark.multiMark.getOffset() is
30673
GuardedDocument.guardedBlockChain.chain.next.next.startMark.multiMark.getOffset()
is 30673

This is also strange, isn't it?
Comment 9 Miloslav Metelka 2005-11-14 16:59:33 UTC
Yes, it looks like the positions were there before the document's loading and
they were moved by the subsequent insertion of the reloaded content but it might
be some deficiency in the MarkBlockChain implementation as well.
Honzo, did you check that first the content gets loaded into the document and
then the new guarded sections get assigned through the
GuardedDocument.setCharacterAttributes()? If so then it's likely the second
possibility.
Comment 10 Jan Becicka 2005-11-21 15:23:28 UTC
I was able to reproduce this issue, but I'm not any more. Probably reloading of
form files was improved somehow.
Comment 11 Peter Pis 2005-11-22 17:34:36 UTC
Verified. Source code can be changed. NetBeans IDE Dev (Build 200511211900)
Comment 12 Jan Becicka 2005-12-14 12:45:08 UTC
*** Issue 70318 has been marked as a duplicate of this issue. ***
Comment 13 Jan Becicka 2005-12-14 12:49:16 UTC
Still reproducible with scenario in Issue 70318. It can be related to issue 70331.
JavaEditor does:
kit.read(reader, doc, 0);
fillSections(reader, doc), where GuardedDocument.setCharacterAttributes() is
called with correct attributes.
Comment 14 Tomas Stupka 2005-12-16 15:14:56 UTC
*** Issue 65500 has been marked as a duplicate of this issue. ***
Comment 15 Peter Pis 2006-01-03 13:42:23 UTC
I have tried to reproduce this issue with steps I have provided. Now it occured
randomly.
Comment 16 Miloslav Metelka 2006-01-03 16:52:19 UTC
The MarkBlockChain did not handle well the situation when there were empty
blocks (after removal of the document content during reload).
Fixed in trunk:
Checking in libsrc/org/netbeans/editor/MarkBlockChain.java;
/cvs/editor/libsrc/org/netbeans/editor/MarkBlockChain.java,v  <-- 
MarkBlockChain.java
new revision: 1.21; previous revision: 1.20
Comment 17 Miloslav Metelka 2006-01-04 09:05:22 UTC
Graphical diff:
http://www.netbeans.org/source/browse/editor/libsrc/org/netbeans/editor/MarkBlockChain.java.diff?r1=1.20&r2=1.21

I would like to ask QE to test the fix. Thanks.
Dusane, could you please review the fix? Thanks.
Comment 18 Milan Kubec 2006-01-04 11:14:17 UTC
Verified - I'm not able to reproduce the issue in trunk build 200601031900. 
Peter please verify your use case too. Thanks.
Comment 19 Peter Pis 2006-01-04 12:18:28 UTC
My case with the use of cvs - verified.
Comment 20 Dusan Balek 2006-01-04 12:40:47 UTC
The fix looks OK.
Comment 21 Roman Strobl 2006-01-05 12:58:06 UTC
When do you plan to fix this in the 5.0 branch? Just curious.
Comment 22 Miloslav Metelka 2006-01-05 14:41:18 UTC
Integrated into release50:
Checking in MarkBlockChain.java;
/cvs/editor/libsrc/org/netbeans/editor/MarkBlockChain.java,v  <-- 
MarkBlockChain.java
new revision: 1.20.96.1; previous revision: 1.20
Comment 23 Peter Pis 2006-01-06 09:43:55 UTC
Verified in NetBeans IDE 5.0 Dev (Build 200601052030).
Comment 24 Miloslav Metelka 2006-01-10 13:59:10 UTC
*** Issue 71198 has been marked as a duplicate of this issue. ***