Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 184022

Summary: Update Manager throws ArithmeticException
Product: [Eclipse Project] Platform Reporter: David Hergert <david.hergert>
Component: Update (deprecated - use Eclipse>Equinox>p2)Assignee: Platform-Update-Inbox <platform-update-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, cbeth, dejan, pforeman, psingh, raji, romain.castell, zzhang
Version: 3.3   
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for UpdateSearchRequest none

Description David Hergert CLA 2007-04-25 10:41:21 EDT
Build ID: I20070323-1616

Steps To Reproduce:
1. Open Update Manager (Manage Configuration)
2. Right-Clicked on JST Web Core Patch Feature 1.5.2.v200611141330 (added via Extension Point) and click Find Updates...
3. Received No Updates message, but exception appears in logs.


More information:
java.lang.ArithmeticException: / by zero
	at org.eclipse.update.internal.ui.views.FindUpdatesAction$TrackingProgressMonitor.updateStatus(FindUpdatesAction.java:73)
	at org.eclipse.update.internal.ui.views.FindUpdatesAction$TrackingProgressMonitor.beginTask(FindUpdatesAction.java:53)
	at org.eclipse.update.search.UpdateSearchRequest.performSearch(UpdateSearchRequest.java:266)
	at org.eclipse.update.ui.UpdateJob.runUpdates(UpdateJob.java:207)
	at org.eclipse.update.ui.UpdateJob.run(UpdateJob.java:168)
	at org.eclipse.update.internal.ui.views.FindUpdatesAction$TrackedUpdateJob.run(FindUpdatesAction.java:93)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Paul Foreman CLA 2007-06-20 16:16:21 EDT
Created attachment 71954 [details]
Patch for UpdateSearchRequest
Comment 2 Paul Foreman CLA 2007-06-20 16:19:13 EDT
I just ran into this same problem and have a fix for it.  When a feature is missing an update site, a monitor gets created with 0 tasks to execute.  This patch will make sure that we return from the search without doing anything.

I have attached above as "Patch for UpdateSearchRequest" 

There was only one line changed but it looks like a lot of lines changed because I indented everything after if (ntasks > 0).
Comment 3 David Hergert CLA 2007-06-21 09:22:20 EDT
(In reply to comment #2)

Thanks for the patch, Paul.  I'd like to try it out.  But forgive my novice question, is there a document or website somewhere explaining how to patch Eclipse itself and then run it with the patched code?  

Also, the target milestone for this bug is not set.  Will your fix be targeted for 3.4?
Comment 4 Paul Foreman CLA 2007-06-21 14:53:13 EDT
David,

You can grab the source here:
http://wiki.eclipse.org/index.php/CVS_Howto

Once you have CVS set up in eclipse you can
   1. Select the org.eclipse.update.core project in the Navigator or other view.
   2. Context Menu->Compare With->Patch...
   3. Fill in the location of the patch file
   4. Click Next. A summary of changed files will appear.
   5. Click Finish. The changes are now merged into the workspace.

Once this is done you can then build your own jar that includes this patch.

At this point the patch has to be reviewed and accepted by the Eclipse team.  They will decide what target will be set for the patch.

Good luck!
Comment 5 Chris Aniszczyk CLA 2007-07-08 16:08:04 EDT
Dejan, this is a good candidate for 3.3.1, I'll mark it so.
Comment 6 Dejan Glozic CLA 2007-09-05 11:15:36 EDT
Didn't get in.
Comment 7 Raji Akella CLA 2008-01-14 14:13:28 EST
(In reply to comment #6)
Will this be in 3.4?
Comment 8 Pawan Singh CLA 2008-06-04 19:41:21 EDT
Can someone confirm that this is fixed for 3.3.2 or 3.4? The activity on this issue has gone silent.
Comment 9 John Arthorne CLA 2008-06-05 09:26:51 EDT
This wasn't fixed in 3.3.2 or 3.4.
Comment 10 John Arthorne CLA 2009-02-01 22:17:05 EST
*** Bug 263078 has been marked as a duplicate of this bug. ***
Comment 11 John Arthorne CLA 2009-02-01 22:17:48 EST
Released a fix to HEAD.