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 202479

Summary: @ServiceProvider services sooner than filesystem content causes: Broken platform reference when opening not activated J2SE
Product: java Reporter: asenk
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: VERIFIED FIXED    
Severity: normal CC: jtulach, masaki, mmirilovic
Priority: P3 Keywords: THREAD
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description asenk 2011-09-22 10:24:03 UTC
Product Version: NetBeans IDE 7.1 Beta (Build 201109212202)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Linux version 2.6.38-11-generic running on i386; UTF-8; en_US (nb)
User directory: /home/tester/.netbeans/7.1beta
Cache directory: /home/tester/.netbeans/7.1beta/var/cache

Steps to reproduce:
1.Install new full distro version
2.Start IDE
3.Open some J2SE project (do not create new one!)

The opened project cannot be built or run. If you try to build it, you can see "Broken platform reference" error. In Libraries manager is "Java Platform:Missing platform".
It is impossible to add the platform again. Removing and adding platform again doesn't help.

Workaround: Delete userdir, and start IDE once again. Then create new J2SE project before opening old one.
Comment 1 Marian Mirilovic 2011-09-22 10:34:32 UTC
Please evaluate ASAP .. thanks in advance.
Comment 2 Petr Cyhelsky 2011-09-22 10:48:21 UTC
Product Version: NetBeans IDE 7.1 Beta (Build 201109212202)
Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b18
System: Linux version 2.6.38-11-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/petr/.netbeans/7.1beta
Cache directory: /home/petr/.netbeans/7.1beta/var/cache

are you sure there isn't just something wrong with your java platform? I use exactly this scenario after install and it works correctly - i.e. run, build, profile etc works... 

It doesn't seem to be P1 if it is just some corner case...
Comment 3 Marian Mirilovic 2011-09-22 10:51:46 UTC
Adam, I expect you reused older userdir - didn't you ?
Comment 4 asenk 2011-09-22 10:56:03 UTC
(In reply to comment #3)
> Adam, I expect you reused older userdir - didn't you ?

No, I started IDE with fresh userdir and I didn't import anything.


(In reply to comment #2)
> 
> are you sure there isn't just something wrong with your java platform? I use
> exactly this scenario after install and it works correctly - i.e. run, build,
> profile etc works... 

I will try reinstall Java on my computer.
Comment 5 asenk 2011-09-22 10:57:57 UTC
Product Version: NetBeans IDE 7.1 Beta (Build 201109212202)
Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
System: Linux version 2.6.38-11-generic running on i386; UTF-8; en_US (nb)
User directory: /home/tester/.netbeans/7.1beta
Cache directory: /home/tester/.netbeans/7.1beta/var/cache

I'm able to reproduce this bug with JDK1.6...
Comment 6 Tomas Zezula 2011-09-22 11:40:13 UTC
Seems as FoD.
Can you reproduce it without FoD?
Comment 7 Tomas Zezula 2011-09-22 12:59:34 UTC
Does the reassignment mean that it's not reproduceable without FoD?
Comment 8 asenk 2011-09-22 13:08:00 UTC
(In reply to comment #7)
> Does the reassignment mean that it's not reproduceable without FoD?
Yes, it is reproducible only with FOD.
Comment 9 Tomas Zezula 2011-09-22 19:38:42 UTC
Finally I was able to reproduce it, it's a race.
The problem is that the service registered by @ServiceProvider is instantiated before the layer, of the same module which provides the service, is merged into system filesystem.
So the service is not able to find the config folder on the system filesystem.

It seems to be changed. Is this desired? I can probably workaround it in java.platform module if needed.
Comment 10 Jaroslav Tulach 2011-10-25 05:59:42 UTC
If you can make the code more robust, please try.
Comment 11 Tomas Zezula 2011-10-25 17:04:52 UTC
Fixed jet-main 5a392d63ec8a
Comment 12 Quality Engineering 2011-10-26 14:23:42 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/5a392d63ec8a
User: Tomas Zezula <tzezula@netbeans.org>
Log: #202479:@ServiceProvider services sooner than filesystem content causes: Broken platform reference when opening not activated J2SE
Comment 13 Tomas Zezula 2011-10-31 09:31:08 UTC
*** Bug 204348 has been marked as a duplicate of this bug. ***
Comment 14 Jaroslav Tulach 2011-10-31 12:44:26 UTC
Thanks for making the code more robust.
Comment 15 asenk 2011-11-01 12:49:08 UTC
I have to reopen this bug :-(
Fix helped a little bit, but the whole problem isn't solved. 

If I follow steps to reproduce I got the same error. But now is it more easier to solve the problem. 
1. IDE restart
2. Add new platform in project properties

So I think that the priority is P3 after this fix.
Comment 16 Tomas Zezula 2011-11-02 13:46:51 UTC
Fixed jet-main 392beab16a9f
I've added even more defensive code, it not only delays the folder lookup but also listens on its creation.
If even this does not work please reopen and assign on ide/fod (the folder does not exist at all).
Comment 17 Quality Engineering 2011-11-04 15:02:34 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/392beab16a9f
User: Tomas Zezula <tzezula@netbeans.org>
Log: #202479:@ServiceProvider services sooner than filesystem content causes: Broken platform reference when opening not activated J2SE