| Summary: | NPE from API Freeze Report Conversion task when new bundle is added | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Darin Wright <darin.eclipse> | ||||||
| Component: | API Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | ankur_sharma, Olivier_Thomann | ||||||
| Version: | 3.7 | Flags: | Olivier_Thomann:
review?
(Michael_Rennie) |
||||||
| Target Milestone: | 3.7 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 178415 [details]
Proposed fix
Released for 3.7M2. Michael, please verify. It turns out the problem was caused by something different than I thought. I originally thought the "report" and "htmlfile" attributes were directories. So, when running the report conversion task I had already created a directory with the name "api-freeze-report". This causes the NPE (in 3.6). In 3.7 M2 I no longer get an NPE, but if a directory exists with the same name as the "htmlfile" specified, no report is generated. Thus, I'm not sure the fix that Olivier added is required, but there is still a problem that no report is generated in this case (a directory already exists with the htmlfile name), and there is no error reported by the ant task. It just fails silently. (In reply to comment #3) > In 3.7 M2 I no longer get an NPE, but if a directory exists with the same name > as the "htmlfile" specified, no report is generated. Thus, I'm not sure the fix > that Olivier added is required, but there is still a problem that no report is > generated in this case (a directory already exists with the htmlfile name), and > there is no error reported by the ant task. It just fails silently. Yes, added or removed component also led to a NPE. So the patch is fixing that part. I am looking at this last problem. We must simply ensure that the xml file for the api freeze task is a file and also that the report location for the conversion task is also a file. Created attachment 179967 [details]
Proposed fix + regression tests
This patch checks that the xml file and html file are files and not directories.
Released for 3.7M3. |
I ran an API Freeze Report between 3.6 and 3.5 installs: <target name="API Freeze" description="description"> <apitooling.apifreeze baseline="c:\sdk 3.5\eclipse" profile="c:\sdk3.6\eclipse" report="c:\temp\api-freeze" /> </target> <target name="API Freeze Report" description="description"> <apitooling.apifreeze_reportconversion xmlfile="c:\temp\api-freeze" htmlfile="c:\temp\api-freeze-report" /> </target> When I ran the report conversion task, I got the following NPE (I assume this is because there are bundles in the newer release that are not in the old). Genreally, this sort of thing won't happen when performing an API freeze check (since bundles/APIs are relatively stable), but the case should be handled: --- Nested Exception --- java.lang.NullPointerException at org.eclipse.pde.api.tools.internal.tasks.APIFreezeReportConversionTask$1.compare(APIFreezeReportConversionTask.java:298) at java.util.Arrays.mergeSort(Arrays.java:1270) at java.util.Arrays.mergeSort(Arrays.java:1281) at java.util.Arrays.mergeSort(Arrays.java:1281) at java.util.Arrays.mergeSort(Arrays.java:1281) at java.util.Arrays.mergeSort(Arrays.java:1281) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:159) at org.eclipse.pde.api.tools.internal.tasks.APIFreezeReportConversionTask.dumpEntries(APIFreezeReportConversionTask.java:294) at org.eclipse.pde.api.tools.internal.tasks.APIFreezeReportConversionTask.execute(APIFreezeReportConversionTask.java:395) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:662) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:495) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378) at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:298) at java.lang.Thread.run(Thread.java:619)