Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324668 - NPE from API Freeze Report Conversion task when new bundle is added
Summary: NPE from API Freeze Report Conversion task when new bundle is added
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-07 11:49 EDT by Darin Wright CLA
Modified: 2010-09-30 11:13 EDT (History)
2 users (show)

See Also:
Olivier_Thomann: review? (Michael_Rennie)


Attachments
Proposed fix (4.79 KB, patch)
2010-09-08 10:47 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression tests (15.27 KB, patch)
2010-09-30 11:11 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2010-09-07 11:49:57 EDT
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)
Comment 1 Olivier Thomann CLA 2010-09-08 10:47:23 EDT
Created attachment 178415 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2010-09-08 10:47:55 EDT
Released for 3.7M2.
Michael, please verify.
Comment 3 Darin Wright CLA 2010-09-16 10:06:38 EDT
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.
Comment 4 Olivier Thomann CLA 2010-09-30 09:37:10 EDT
(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.
Comment 5 Olivier Thomann CLA 2010-09-30 10:12:20 EDT
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.
Comment 6 Olivier Thomann CLA 2010-09-30 11:11:55 EDT
Created attachment 179967 [details]
Proposed fix + regression tests

This patch checks that the xml file and html file are files and not directories.
Comment 7 Olivier Thomann CLA 2010-09-30 11:13:38 EDT
Released for 3.7M3.