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 160498 - Editor does not work with lucene-core-2.4.0
Summary: Editor does not work with lucene-core-2.4.0
Status: RESOLVED DUPLICATE of bug 157028
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 6.x
Hardware: All Linux
: P2 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 162037 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-17 19:45 UTC by Jesse Glick
Modified: 2009-05-21 13:27 UTC (History)
5 users (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 Jesse Glick 2009-03-17 19:45:17 UTC
P3 because I don't know if anyone else can reproduce - P2 if so. 090313, just started to observe recently, probably as
of Parsing API merge. Working on nb.org projects.

Much of the time Fix Imports fails to add imports for classes which are not currently imported. Add Import editor hint
is also not available. Fix Imports does correctly remove unused imports. If I write the import manually, the editor
accepts it as valid. Code completion also sometimes fails to complete a class which is not yet imported, even though it
is available in the classpath. Code completion in the import statement may work on "org.openide." to show classes in
that package, but does not show subpackages, whereas "org.openide.util." shows classes in that package.

All in all, the Java editor seems very buggy in this build.
Comment 1 Jan Lahoda 2009-03-18 09:21:42 UTC
From the described symptoms, I would guess that this is a problem with indexing.
Comment 2 Max Sauer 2009-04-10 10:20:51 UTC
Needs to be investigated.
Comment 3 sanhozay 2009-04-15 00:24:06 UTC
I've got this exact same problem with Netbeans 6.5 on Ubuntu (which is admittedly 9.0.4 and still in pre-release). Never
had this problem to date with 6.5 on Vista.

Product Version: NetBeans IDE 6.5 (Build 090407)
Java: 1.6.0_13; Java HotSpot(TM) 64-Bit Server VM 11.3-b02
System: Linux version 2.6.28-11-generic running on amd64; UTF-8; en_GB (nb)

As described, the Fix Imports menu does nothing. The "Add Import" option is missing on the lightbulb hint (but I do have
two offers to "Create class xxx in package"). I can add the import by hand and I'm offered the "Remove Unused Imports"
hint when I remove code.

Along the lines of the indexing theory, I moved all my .nbi, .netbeans, etc. directories, deleted my projects folder and
restarted NetBeans. Got the same problems in HelloWorld. I can't be 100% certain but I think the fix imports was working
when I first installed this NetBeans on Ubuntu about a week or so ago.
Comment 4 sanhozay 2009-04-15 00:53:25 UTC
Further to this, I wonder if it's related to:

http://www.netbeans.org/issues/show_bug.cgi?id=160305

Looking in my IDE log, I also have lots of errors like this:

SEVERE [global]
While scanning: jar:file:/usr/lib/jvm/java-6-sun-1.6.0.13/jre/lib/rt.jar!/
While scanning: jar:file:/usr/lib/jvm/java-6-sun-1.6.0.13/jre/lib/rt.jar!/
Caused: org.apache.lucene.store.AlreadyClosedException: this Directory is closed
        at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220)
        at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320)
        at org.netbeans.modules.java.source.usages.LuceneIndex.clear(LuceneIndex.java:876)
        at org.netbeans.modules.java.source.usages.BinaryAnalyser.start(BinaryAnalyser.java:151)
[catch] at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.scanRoots(RepositoryUpdater.java:1798)
        at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.access$2700(RepositoryUpdater.java:1292)
        at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1443)
        at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker$1.run(RepositoryUpdater.java:1335)
        at org.netbeans.modules.java.source.usages.ClassIndexManager.writeLock(ClassIndexManager.java:99)
        at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1332)
        at org.netbeans.modules.java.source.usages.RepositoryUpdater$CompileWorker.run(RepositoryUpdater.java:1292)
        at org.netbeans.api.java.source.JavaSource$CompilationJob.run(JavaSource.java:1618)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
ALL [null]: While scanning: jar:file:/usr/lib/jvm/java-6-sun-1.6.0.13/jre/lib/rt.jar!/
Comment 5 Jiri Prox 2009-04-15 12:55:27 UTC
sanhozay: Can you provide full steps to reproduce this problem, and attach messages.log?
Thanks
Comment 6 sanhozay 2009-04-16 11:03:18 UTC
I believe it's a version issue. My problem is with the package of NetBeans that is installed from Ubuntu's repository
using the Ubuntu package manager. Version as shown above. I'm 99% certain that the underlying issue is with the bug in
Apache Lucene breaking NetBeans indexing of jars but my efforts to test this by updating the Lucene jars in the NetBeans
installation failed because I don't properly understand how NetBeans is put together.

To duplicate the problem it's a case of installing Ubuntu 9.04, installing NetBeans using the package manager and trying
to use Fix Imports on any class that you choose to create.

Unfortunately I can't send you my messages.log because I've uninstalled the Ubuntu standard package of NetBeans 6.5
completely and downloaded 6.5.1 from netbeans.org. The Lucene errors have gone away and Fix Imports is working. This is
the version:

Product Version: NetBeans IDE 6.5.1 (Build 200903060201)
Java: 1.6.0_13; Java HotSpot(TM) 64-Bit Server VM 11.3-b02
System: Linux version 2.6.28-11-generic running on amd64; UTF-8; en_GB (nb)

So, as far as NetBeans is concerned, I think it's fixed between 6.5 (Build 090407) and 6.5.1 (Build 200903060201).
What's really unfortunate though is that the package install of NetBeans in the new version of Ubuntu has this small but
really annoying problem.

Shall I raise a bug with Ubuntu, or do you have liaison with them directly on this package?

--
Richard
Comment 7 sanhozay 2009-04-16 11:30:30 UTC
*** Issue 162037 has been marked as a duplicate of this issue. ***
Comment 8 sanhozay 2009-04-16 11:41:52 UTC
Sorry for the multiple replies. The issue is already raised on Ubuntu's bug tracker ...

https://bugs.launchpad.net/ubuntu/+source/netbeans/+bug/353080

... and they have raised it back to here. I've flagged that as a duplicate of this.

http://www.netbeans.org/issues/show_bug.cgi?id=162037
Comment 9 Yulia Novozhilova 2009-05-19 14:25:35 UTC
The problem is that lucene-core-2.4.0 introduces many changes.
One of them is a new method "org.apache.lucene.store.Directory.ensureOpen() throws AlreadyClosedException" which is now
called by org.apache.lucene.store.FSDirectory.list() and some other methods. 

I've installed NetBeans 6.5.1 downloaded from netbeans.org and changed lucene-core-2.3.2 to lucene-core-2.4.0. The
problem is reproducible in this case. It is interesting that 6.7 works well with lucene-core-2.4.0. So something has
changed in NB sources.

Unfortunately it is impossible to use lucene-core-2.3.2 for native packages since ubuntu jaunty contains 2.4.0. The only
way I see now is to try to create a patch for netbeans sources that is used for packaging and upload it into jaunty
repos if it is still possible now. 
Comment 10 Jesse Glick 2009-05-19 17:17:08 UTC
FWIW, as the original reporter I was using a plain installation of NB built from sources, not a Ubuntu package (though I
do run on Ubuntu). I do not recall seeing problems such as these in recent dev builds, however.
Comment 11 Yulia Novozhilova 2009-05-20 11:34:03 UTC
jglick,
So you don't mind seeing this issue in installer/debian... or I should create a separate issue?
Comment 12 mslama 2009-05-20 13:57:50 UTC
Unfortunately this issue breaks usage of NB  6.5 packages which we have now for Ubuntu 9.04. This version was released
in Apr 2009 and will be last available release till Oct 2009. Java IDE functionality is impacted severely IMO.
Comment 13 Yulia Novozhilova 2009-05-20 14:25:22 UTC
Yes, unfortunately:(
Anyway we should avoid such problem for NetBeans 6.7. I wonder if it is possible to patch NetBeans 6.7 sources to adjust
them to lucene-core 2.4.0 (dev version still uses 2.3.2)? Or may be there are plans to switch NetBeans to lucene-core 2.4.0.
Comment 14 David Strupl 2009-05-20 14:35:56 UTC

*** This issue has been marked as a duplicate of 157028 ***
Comment 15 David Strupl 2009-05-21 11:00:14 UTC
I have mistakenly marked this as a duplicate. It is not - I have changed the summary to reflect the current status.
Comment 16 David Strupl 2009-05-21 11:01:36 UTC
This problem is present only on Linux distributions that have lucene version 2.4.0 ...
Comment 17 Tomas Zezula 2009-05-21 11:55:53 UTC

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