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 53234 - Wrong offset position in Import
Summary: Wrong offset position in Import
Status: CLOSED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks: 49852
  Show dependency tree
 
Reported: 2005-01-11 14:48 UTC by Martin Roskanin
Modified: 2007-09-26 09:14 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 Martin Roskanin 2005-01-11 14:48:55 UTC
Code folding test in editor is broken due to
Import.getStartOffset() and Import.getEndOffset()
inconsistency.

tested source:

/* 
 * Initial Comment Fold
 * Created on 15 September 2004, 10:48
 */

package code_folds.JavaFoldsTest;

// import section fold
import javax.swing.JApplet;
import javax.swing.JButton;

...

If I open test source in IDE I get correct Import
bounds 130,157 of the first import. While test is
running the offsets are 136,163.

The same problems were found in code completion tests.

(jdk 1.4.2)
Comment 1 Martin Matula 2005-01-13 11:06:21 UTC
When asking for offset, does the test open the file in editor? Please
note that if you do not open the file in editor the offset is computed
against the original source text which may contain windows CRLF
characters and guarded-block starting/ending marks which get removed
from the source buffer when opening the file in editor thus cause a
change in offsets. The test should make no assuption that offsets in
files on the disk are same as offsets in the document. Please let us
know if this is the problem or the problem is something else. Also, is
this a regression? (did it work before?) For how long have the tests
been broken if so?
Comment 2 Roman Strobl 2005-01-14 08:50:08 UTC
The test used to work before, I've noticed the first failure on this
Tuesday (11.1.2005). Martin, please answer the other questions.
Comment 3 Martin Roskanin 2005-01-14 09:03:27 UTC
Yes, this is a functional test. File is open in editor. The wrong
import fold bounds are also visible in code folding bar during test
running.
Comment 4 Martin Roskanin 2005-01-14 11:08:26 UTC
It can happen randomly also in IDE session (issue #49852)
Comment 5 Jan Becicka 2005-01-20 16:14:18 UTC
See issue 49852 for additional information
Comment 6 Pavel Flaska 2005-02-14 12:54:29 UTC
You can ask for offset, but bear in mind that offsets of element will
change when offsets were obtained from file, but then the file was
opened in editor. (CR characters are filtered, so offsets are no
longer valid.) I changed some calls in JavaEditor to obtain positions
in all cases from document, so this bug should be no longer reproducible.

Closing as invalid as the import returns the offsets correctly.
Comment 7 Martin Roskanin 2005-02-14 13:26:40 UTC
verified. After fixing issue #49852 tests run correctly. Thanks.
Comment 8 Quality Engineering 2007-09-20 11:58:02 UTC
Reorganization of java component