| Summary: | Target Platform service throws exceptions if run without OSGi | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Curtis Windatt <curtis.windatt.public> | ||||||||
| Component: | UI | Assignee: | Curtis Windatt <curtis.windatt.public> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | ankur_sharma, Michael_Rennie, nicolas.bros | ||||||||
| Version: | 3.7 | Flags: | Michael_Rennie:
review+
|
||||||||
| Target Milestone: | 3.7 M7 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Curtis Windatt
Created attachment 192777 [details]
Fix
Fixed in HEAD. Mike please verify. testing running an API use scan from the command line in windows, it appears the fix just pushes the NPE to a different location:
BUILD FAILED
C:\Users\mrennie\Desktop\build.ent:43: java.lang.NullPointerException
at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolveV
ariables(AbstractBundleContainer.java:80)
at org.eclipse.pde.internal.core.target.ProfileBundleContainer.resolveHo
meLocation(ProfileBundleContainer.java:210)
at org.eclipse.pde.internal.core.target.ProfileBundleContainer.resolveBu
ndles(ProfileBundleContainer.java:104)
at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolve(
AbstractBundleContainer.java:97)
at org.eclipse.pde.api.tools.internal.model.ApiModelFactory.addComponent
s(ApiModelFactory.java:225)
at org.eclipse.pde.api.tools.internal.tasks.CommonUtilsTask.createBaseli
ne(CommonUtilsTask.java:75)
at org.eclipse.pde.api.tools.internal.tasks.ApiUseTask.getBaseline(ApiUs
eTask.java:454)
at org.eclipse.pde.api.tools.internal.tasks.ApiUseTask.execute(ApiUseTas
k.java:287)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 2 seconds
Chatting with Curtis, we think it might be better to remove the 'fixes' from PDE and handle the the non-OSGi case in API tools. In the case that the target platform service is not available, we should just fall-back to using a directory of bundles rather than trying to use the non-OSGi version of the service. I have removed the run without OSGi hacks in TargetPlatformService and LocalTargetHandle. I will look at fixing ApiModelFactory today. Created attachment 193533 [details]
New Fix
This fix changes how the baseline gets created. If the target is not available we (silently) revert to searching the plug-ins directory.
Mike, please review this new patch and see whether it would be satisfactory for the server tooling in 3.7. Not sure yet if it is related but now I get the following (with the patch applied):
BUILD FAILED
C:\Users\mrennie\Desktop\build.ent:43: java.lang.NoSuchMethodError: org/objectwe
b/asm/ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
at org.eclipse.pde.api.tools.internal.model.TypeStructureBuilder.buildTy
peStructure(TypeStructureBuilder.java:194)
at org.eclipse.pde.api.tools.internal.model.AbstractApiTypeRoot.getStruc
ture(AbstractApiTypeRoot.java:53)
at org.eclipse.pde.api.tools.internal.provisional.search.ApiSearchEngine
$ReferenceExtractor.visit(ApiSearchEngine.java:97)
at org.eclipse.pde.api.tools.internal.model.ArchiveApiTypeContainer.acce
pt(ArchiveApiTypeContainer.java:204)
at org.eclipse.pde.api.tools.internal.model.AbstractApiTypeContainer.acc
ept(AbstractApiTypeContainer.java:56)
at org.eclipse.pde.api.tools.internal.model.Component.accept(Component.j
ava:62)
at org.eclipse.pde.api.tools.internal.provisional.search.ApiSearchEngine
.searchReferences(ApiSearchEngine.java:244)
at org.eclipse.pde.api.tools.internal.provisional.search.ApiSearchEngine
.search(ApiSearchEngine.java:310)
at org.eclipse.pde.api.tools.internal.tasks.ApiUseTask.execute(ApiUseTas
k.java:315)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 4 seconds
Created attachment 193614 [details]
update
This is an updated patch that cleans up a bit of the directory scanning code and removes automatically appending 'plugins' to the path for the location.
Here is an example build file that can be used to run the use task from the commandline:
<project name="apiusetask" basedir="." default="run">
<property name="loc" value=""/>
<property name="xml.loc" value=""/>
<property name="html.loc" value=""/>
<property name="eclipse.install.dir" value=""/>
<property name="eclipse.lib.dir" value=""/>
<property name="apiuse.task.props" value=""/>
<target name="init" depends="extract-apitoolingjar">
<taskdef file="${apiuse.task.props}">
<classpath>
<fileset dir="${eclipse.install.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${eclipse.lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
</target>
<target name="extract-apitoolingjar">
<unjar overwrite="true" dest="${eclipse.lib.dir}">
<fileset dir="${eclipse.install.dir}">
<include name="org.eclipse.pde.api.tools_*.jar"/>
</fileset>
<patternset>
<include name="**\*.jar"/>
</patternset>
</unjar>
<move file="${eclipse.lib.dir}\lib\apitooling-ant.jar"
overwrite="true"
todir="${eclipse.lib.dir}"/>
<delete dir="${eclipse.lib.dir}\lib\" includeemptydirs="true"/>
</target>
<target name="run" depends="init">
<apiuse
location="${loc}"
scopepattern=".*"
report="${xml.loc}"
considerinternal="true"
considerillegaluse="true"
debug="true"
/>
<apiuse_reportconversion
xmlfiles="${xml.loc}"
htmlfiles="${html.loc}"
debug="true"
/>
</target>
</project>
applied updated patch to HEAD . *** Bug 343640 has been marked as a duplicate of this bug. *** |