Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 71954 Details for
Bug 184022
Update Manager throws ArithmeticException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for UpdateSearchRequest
updatesearchrequest.txt (text/plain), 8.62 KB, created by
Paul Foreman
on 2007-06-20 16:16:21 EDT
(
hide
)
Description:
Patch for UpdateSearchRequest
Filename:
MIME Type:
Creator:
Paul Foreman
Created:
2007-06-20 16:16:21 EDT
Size:
8.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.update.core >Index: src/org/eclipse/update/search/UpdateSearchRequest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/search/UpdateSearchRequest.java,v >retrieving revision 1.33 >diff -u -r1.33 UpdateSearchRequest.java >--- src/org/eclipse/update/search/UpdateSearchRequest.java 22 Mar 2007 20:01:17 -0000 1.33 >+++ src/org/eclipse/update/search/UpdateSearchRequest.java 20 Jun 2007 20:15:23 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Paul Foreman (IBM Corp.) - bug 184022 (Divide by Zero when updating) > *******************************************************************************/ > package org.eclipse.update.search; > >@@ -263,111 +264,114 @@ > int ntasks = nsearchsites + queries.length * candidates.length; > if (updateMapURL!=null) ntasks++; > >- monitor.beginTask(Messages.UpdateSearchRequest_searching, ntasks); >+ // bug 184022 If ntasks is zero we have a divide by zero error when creating the monitor >+ if (ntasks > 0) { >+ monitor.beginTask(Messages.UpdateSearchRequest_searching, ntasks); > >- try { >- UpdatePolicy updatePolicy=null; >- if (updateMapURL!=null) { >- updatePolicy = new UpdatePolicy(); >- IStatus status =UpdateUtils.loadUpdatePolicy(updatePolicy, updateMapURL, new SubProgressMonitor(monitor, 1)); >- if (status != null) >- statusList.add(status); >- } >- >- List combinedAssociateSites = new ArrayList(); >- for (int i = 0; i < queries.length; i++) { >- IUpdateSearchQuery query = queries[i]; >- IQueryUpdateSiteAdapter qsite = query.getQuerySearchSite(); >- // currently, the next conditional is only executed (qsite!=null) when >- // running an update search. >- if (qsite != null && searchFeatureProvidedSites) { >- // do not update features that are installed in read-only locations >- if (query instanceof UpdatesSearchCategory.UpdateQuery) { >- IFeature feature = ((UpdatesSearchCategory.UpdateQuery)query).getFeature(); >- if (feature != null && !feature.getSite().getCurrentConfiguredSite().verifyUpdatableStatus().isOK()) >- continue; >- } >- // check for mapping >- IUpdateSiteAdapter mappedSite = getMappedSite(updatePolicy, qsite); >- // when there is no mapped site the feature is not updatable >- if (mappedSite == null || mappedSite.getURL() == null) >- continue; >- SubProgressMonitor subMonitor = >- new SubProgressMonitor(monitor, 1); >- List associateSites = new ArrayList(); >- IStatus status = >- searchOneSite( >- mappedSite, >- null, >- query, >- collector, >- associateSites, >- subMonitor, >- true); >+ try { >+ UpdatePolicy updatePolicy=null; >+ if (updateMapURL!=null) { >+ updatePolicy = new UpdatePolicy(); >+ IStatus status =UpdateUtils.loadUpdatePolicy(updatePolicy, updateMapURL, new SubProgressMonitor(monitor, 1)); > if (status != null) > statusList.add(status); >- if (monitor.isCanceled()) >- break; >- combinedAssociateSites = combineAssociateSites( combinedAssociateSites, associateSites, visitedSitesURL, visitedSites); > } >- >- for (int j = 0; j < candidates.length; j++) { >- if (monitor.isCanceled()) { >- break; >+ >+ List combinedAssociateSites = new ArrayList(); >+ for (int i = 0; i < queries.length; i++) { >+ IUpdateSearchQuery query = queries[i]; >+ IQueryUpdateSiteAdapter qsite = query.getQuerySearchSite(); >+ // currently, the next conditional is only executed (qsite!=null) when >+ // running an update search. >+ if (qsite != null && searchFeatureProvidedSites) { >+ // do not update features that are installed in read-only locations >+ if (query instanceof UpdatesSearchCategory.UpdateQuery) { >+ IFeature feature = ((UpdatesSearchCategory.UpdateQuery)query).getFeature(); >+ if (feature != null && !feature.getSite().getCurrentConfiguredSite().verifyUpdatableStatus().isOK()) >+ continue; >+ } >+ // check for mapping >+ IUpdateSiteAdapter mappedSite = getMappedSite(updatePolicy, qsite); >+ // when there is no mapped site the feature is not updatable >+ if (mappedSite == null || mappedSite.getURL() == null) >+ continue; >+ SubProgressMonitor subMonitor = >+ new SubProgressMonitor(monitor, 1); >+ List associateSites = new ArrayList(); >+ IStatus status = >+ searchOneSite( >+ mappedSite, >+ null, >+ query, >+ collector, >+ associateSites, >+ subMonitor, >+ true); >+ if (status != null) >+ statusList.add(status); >+ if (monitor.isCanceled()) >+ break; >+ combinedAssociateSites = combineAssociateSites( combinedAssociateSites, associateSites, visitedSitesURL, visitedSites); > } >- IUpdateSearchSite source = candidates[j]; >- SubProgressMonitor subMonitor = >- new SubProgressMonitor(monitor, 1); >- List associateSites = new ArrayList(); >- IStatus status = >- searchOneSite( >- source, >- source.getCategoriesToSkip(), >- query, >- collector, >- associateSites, >- subMonitor, >- true); >- if (status != null) >- statusList.add(status); >- combinedAssociateSites = combineAssociateSites( combinedAssociateSites, associateSites, visitedSitesURL, visitedSites); >- } >- if (monitor.isCanceled()) >- break; > >- >- for(int associateSitesDepth = 0; associateSitesDepth < 5; associateSitesDepth++) { >- List tempCombinedSites = new ArrayList(); >- Iterator combinedAssociateSitesIterator = combinedAssociateSites.iterator(); >- while(combinedAssociateSitesIterator.hasNext()) { >- >- IUpdateSearchSite source = (IUpdateSearchSite)combinedAssociateSitesIterator.next(); >- >+ for (int j = 0; j < candidates.length; j++) { >+ if (monitor.isCanceled()) { >+ break; >+ } >+ IUpdateSearchSite source = candidates[j]; >+ SubProgressMonitor subMonitor = >+ new SubProgressMonitor(monitor, 1); > List associateSites = new ArrayList(); >- SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); > IStatus status = > searchOneSite( >- source, >- source.getCategoriesToSkip(), >- query, >- collector, >- associateSites, >- subMonitor, >- true); >- combinedAssociateSites = combineAssociateSites( tempCombinedSites, associateSites, visitedSitesURL, visitedSites); >+ source, >+ source.getCategoriesToSkip(), >+ query, >+ collector, >+ associateSites, >+ subMonitor, >+ true); > if (status != null) > statusList.add(status); >- } >- combinedAssociateSites = tempCombinedSites; >+ combinedAssociateSites = combineAssociateSites( combinedAssociateSites, associateSites, visitedSitesURL, visitedSites); >+ } >+ if (monitor.isCanceled()) >+ break; >+ >+ >+ for(int associateSitesDepth = 0; associateSitesDepth < 5; associateSitesDepth++) { >+ List tempCombinedSites = new ArrayList(); >+ Iterator combinedAssociateSitesIterator = combinedAssociateSites.iterator(); >+ while(combinedAssociateSitesIterator.hasNext()) { >+ >+ IUpdateSearchSite source = (IUpdateSearchSite)combinedAssociateSitesIterator.next(); >+ >+ List associateSites = new ArrayList(); >+ SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); >+ IStatus status = >+ searchOneSite( >+ source, >+ source.getCategoriesToSkip(), >+ query, >+ collector, >+ associateSites, >+ subMonitor, >+ true); >+ combinedAssociateSites = combineAssociateSites( tempCombinedSites, associateSites, visitedSitesURL, visitedSites); >+ if (status != null) >+ statusList.add(status); >+ } >+ combinedAssociateSites = tempCombinedSites; > >+ } >+ if (monitor.isCanceled()) >+ break; > } >- if (monitor.isCanceled()) >- break; >+ } catch (CoreException e) { >+ searchInProgress = false; >+ monitor.done(); >+ throw e; > } >- } catch (CoreException e) { >- searchInProgress = false; >- monitor.done(); >- throw e; > } > } > searchInProgress = false;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 184022
: 71954