[jbosstools-issues] [JBoss JIRA] (JBIDE-19720) NPE in org.jboss.tools.common.model.util.EclipseResourceUtil.getJREClassPath

Valentin Baciu (JIRA) issues at jboss.org
Fri May 15 23:23:19 EDT 2015


    [ https://issues.jboss.org/browse/JBIDE-19720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068614#comment-13068614 ] 

Valentin Baciu commented on JBIDE-19720:
----------------------------------------

You're welcome. 

Just to clarify:
- in my workspace I have a project named System with the workspace resource path of /System
- the file system location of the workspace project named System is in /Users/<my user name>/git/System
- the workspace location is at /Users/<my user name>/Documents/workspaces/Test, so the project resides physically outside the workspace location
- the class path entry which happens to have a path which has System as the first segment is part of the JRE container and points to the file system file /System/Library/Java/Extensions/MRJToolkit.jar

If I read the code right it seem to say that there's an expectation that there may be class path entries in the JRE container which point to some files in a workspace project? I find this interesting and perhaps just a bit strange...

Most times the jars that are part of the JRE class path container reside on the file system outside the Eclipse workspace. For example on my Mac the majority of the JRE jars are at /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib with the lone exception of /System/Library/Java/Extensions/MRJToolkit.jar. So my System project tripped the code, bust just as well I could've had one named Library...

In any case, if looking inside an Eclipse project which matches the first path segment is needed, a null check on the result of Project#findMember should help.

> NPE in org.jboss.tools.common.model.util.EclipseResourceUtil.getJREClassPath
> ----------------------------------------------------------------------------
>
>                 Key: JBIDE-19720
>                 URL: https://issues.jboss.org/browse/JBIDE-19720
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: common/jst/core
>    Affects Versions: 4.2.3.Final
>         Environment: Mac OS X 10.10.3, java full version "1.8.0_25-b17"
>            Reporter: Valentin Baciu
>            Assignee: Viacheslav Kabanovich
>            Priority: Minor
>             Fix For: 4.3.0.Beta1
>
>
> java.lang.NullPointerException
> 	at org.jboss.tools.common.model.util.EclipseResourceUtil.getJREClassPath(EclipseResourceUtil.java:711)
> 	at org.jboss.tools.common.model.filesystems.impl.Libs.getNewPaths(Libs.java:141)
> 	at org.jboss.tools.common.model.filesystems.impl.Libs.update(Libs.java:108)
> 	at org.jboss.tools.common.model.util.EclipseResourceUtil.updateLibs(EclipseResourceUtil.java:535)
> 	at org.jboss.tools.common.model.util.EclipseResourceUtil.createObjectForResource(EclipseResourceUtil.java:417)
> 	at org.jboss.tools.jst.web.model.helpers.InnerModelHelper.createXModel(InnerModelHelper.java:40)
> 	at org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor.init(ClassPathMonitor.java:60)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.setProject(KbProject.java:202)
> 	at org.eclipse.core.internal.resources.NatureManager.createNature(NatureManager.java:234)
> 	at org.eclipse.core.internal.resources.Project.getNature(Project.java:448)
> 	at org.jboss.tools.jst.web.kb.KbProjectFactory.getKbProject(KbProjectFactory.java:71)
> 	at org.jboss.tools.jst.web.kb.KbProjectFactory.getKbProject(KbProjectFactory.java:38)
> 	at org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor.getKbProjects(ClassPathMonitor.java:193)
> 	at org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor.validateProjectDependencies(ClassPathMonitor.java:143)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.load(KbProject.java:347)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.resolveStorage(KbProject.java:315)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.resolve(KbProject.java:330)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.addKbProject(KbProject.java:216)
> 	at org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor.validateProjectDependencies(ClassPathMonitor.java:154)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.load(KbProject.java:347)
> 	at org.jboss.tools.jst.web.kb.internal.KbProject.resolveStorage(KbProject.java:315)
> 	at org.jboss.tools.jst.web.kb.internal.KbBuilder.build(KbBuilder.java:100)
> 	at org.jboss.tools.jst.web.kb.KbProjectFactory$1KbBuilderEx.build(KbProjectFactory.java:107)
> 	at org.jboss.tools.jst.web.kb.KbProjectFactory$1.run(KbProjectFactory.java:122)
> 	at org.jboss.tools.common.model.XJob.runInWorkspace(XJob.java:192)
> 	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
> 	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
> Another code path:
> java.lang.NullPointerException
> 	at org.jboss.tools.common.model.util.EclipseResourceUtil.getJREClassPath(EclipseResourceUtil.java:711)
> 	at org.jboss.tools.common.model.filesystems.impl.Libs.getNewPaths(Libs.java:141)
> 	at org.jboss.tools.common.model.filesystems.impl.Libs.update(Libs.java:108)
> 	at org.jboss.tools.common.model.project.ext.AbstractClassPathMonitor.update(AbstractClassPathMonitor.java:73)
> 	at org.jboss.tools.jsf.jsf2.bean.build.JSF2ProjectBuilder.build(JSF2ProjectBuilder.java:116)
> 	at org.jboss.tools.jsf.jsf2.bean.build.JSF2ProjectBuilder.<init>(JSF2ProjectBuilder.java:71)
> 	at org.jboss.tools.jsf.jsf2.bean.model.impl.JSF2Project.load(JSF2Project.java:261)
> 	at org.jboss.tools.jsf.jsf2.bean.model.impl.JSF2Project.resolveStorage(JSF2Project.java:247)
> 	at org.jboss.tools.jsf.jsf2.bean.model.impl.JSF2Project.resolve(JSF2Project.java:254)
> 	at org.jboss.tools.jsf.jsf2.bean.model.impl.JSF2Project$1.run(JSF2Project.java:172)
> 	at org.jboss.tools.common.model.XJob.runInWorkspace(XJob.java:192)
> 	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
> 	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jbosstools-issues mailing list