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 233840 - AssertionError at org.netbeans.api.java.project.classpath.ProjectClassPathModifier.findExtensible
Summary: AssertionError at org.netbeans.api.java.project.classpath.ProjectClassPathMod...
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-02 10:56 UTC by abien
Modified: 2013-08-05 08:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 202761


Attachments
stacktrace (5.02 KB, text/plain)
2013-08-02 10:56 UTC, abien
Details

Note You need to log in before you can comment on or make changes to this bug.
Description abien 2013-08-02 10:56:05 UTC
Build: NetBeans IDE Dev (Build 201307312300)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b12
OS: Mac OS X

User Comments:
abien: Happened during opening a standalone project




Stacktrace: 
java.lang.AssertionError
   at org.netbeans.api.java.project.classpath.ProjectClassPathModifier.findExtensible(ProjectClassPathModifier.java:364)
   at org.netbeans.api.java.project.classpath.ProjectClassPathModifier.addLibraries(ProjectClassPathModifier.java:93)
   at org.netbeans.modules.glassfish.javaee.Hk2JavaEEPlatformImpl$JaxRsStackSupportImpl.addJsr311Api(Hk2JavaEEPlatformImpl.java:837)
   at org.netbeans.modules.javaee.specs.support.api.JaxRsStackSupport.addJsr311Api(JaxRsStackSupport.java:124)
   at org.netbeans.modules.websvc.rest.spi.RestSupport.ensureRestDevelopmentReadyImpl(RestSupport.java:251)
   at org.netbeans.modules.websvc.rest.spi.RestSupport.access$200(RestSupport.java:93)
Comment 1 abien 2013-08-02 10:56:07 UTC
Created attachment 138183 [details]
stacktrace
Comment 2 Tomas Zezula 2013-08-02 11:02:18 UTC
In the ProjectClassPathModifier.addLibraries the projectArtifact should not be null.
Called from org.netbeans.modules.glassfish.javaee.Hk2JavaEEPlatformImpl$JaxRsStackSupportImpl.addJsr311Api(Hk2JavaEEPlatformImpl.java:837)
Comment 3 TomasKraus 2013-08-03 15:42:37 UTC
Hk2JavaEEPlatformImpl#getSourceRoot(Project project) can return null in some cases. This is part of plugin maintained by Dennis before he left so UI have to get deeper into it first.

Here is how it was getting projectArtifact FileObject from Project.

        private FileObject getSourceRoot(Project project) {
            SourceGroup[] sourceGroups = ProjectUtils.getSources(project)
                    .getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
            if (sourceGroups == null || sourceGroups.length < 1) {
                return null;
            }
            return sourceGroups[0].getRootFolder();
        }

I don't know if it's correct or not.
Comment 4 TomasKraus 2013-08-03 15:44:32 UTC
I need some reproduction scenario for this. What project did you use? Can you create some minimal project to reproduce this and attach it to this bug?
Comment 5 TomasKraus 2013-08-03 17:21:03 UTC
See that Hk2JavaEEPlatformImpl#extendsJerseyProjectClasspath method has additional test:

            FileObject sourceRoot = getSourceRoot(project);
            if (sourceRoot == null) {
                return false;
            }

to handle null value and avoid assertion error.
I'm adding this into Hk2JavaEEPlatformImpl#addJsr311Api to avoid assertion error there too.
Comment 6 TomasKraus 2013-08-03 18:26:04 UTC
Well, return false is not necessary here. I made this code more foolproof.

Checked into GF Tooling Library:
--------------------------------
changeset:   638:b65bd0bfebda
summary:     Bug# 233840 - Return full version string

Checked into NetBeans web-main:
-------------------------------
changeset:   260237:ec6a36c3c7f3
summary:     #233840 - Code formating

changeset:   260238:78842f5dfc65
summary:     #233840 - Fix AssertionError and add GF4 support
Comment 7 TomasKraus 2013-08-03 18:49:54 UTC
Adding Jiri into cc list:

Jiri, wou were probably testing changes that Dennis was doing in the GF plugin.
Do you remember how can I trigger execution of org.netbeans.modules.javaee.specs.support.api.JaxRsStackSupport.addJsr311Api?

Well, I'll close this bug after push because assertion issue is fixed. But addJsr311Api should be rewritten to get rid of hard-coded JARs in next release.
That's why I need some use-case to be able to see this method with debugger.
Comment 8 TomasKraus 2013-08-03 22:33:47 UTC
Pushich changes into web-main, AssertionError error should be fixed.
Comment 9 Quality Engineering 2013-08-05 02:12:46 UTC
Integrated into 'main-silver', will be available in build *201308042300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ec6a36c3c7f3
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #233840 - Code formating
Comment 10 Jiri Skrivanek 2013-08-05 08:26:08 UTC
(In reply to comment #7)
> Jiri, wou were probably testing changes that Dennis was doing in the GF plugin.
> Do you remember how can I trigger execution of
> org.netbeans.modules.javaee.specs.support.api.JaxRsStackSupport.addJsr311Api?

I don't know. Try to look at source code where it is used.