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 167792 Details for
Bug 312284
[repository] getting index file is guarded by a throwable
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]
fix v.1
clipboard.txt (text/plain), 4.10 KB, created by
Ian Bull
on 2010-05-10 15:33:02 EDT
(
hide
)
Description:
fix v.1
Filename:
MIME Type:
Creator:
Ian Bull
Created:
2010-05-10 15:33:02 EDT
Size:
4.10 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.repository >Index: src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java,v >retrieving revision 1.23 >diff -u -r1.23 AbstractRepositoryManager.java >--- src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java 5 Mar 2010 20:42:43 -0000 1.23 >+++ src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java 10 May 2010 19:30:01 -0000 >@@ -638,17 +638,9 @@ > //add the repository first so that it will be enabled, but don't send add event until after the load > added = addRepository(location, true, false); > >- // get the search order from the server, if it's available >- ByteArrayOutputStream index = new ByteArrayOutputStream(); >- LocationProperties locationProperties = null; >- try { >- getTransport().download(getIndexFile(location), index, monitor); >- } catch (Throwable e) { >- // If any exceptions are thrown, just ignore the index file >- } >+ LocationProperties indexFile = loadIndexFile(location, monitor); > >- locationProperties = LocationProperties.create(new ByteArrayInputStream(index.toByteArray())); >- String[] preferredOrder = getPreferredRepositorySearchOrder(locationProperties); >+ String[] preferredOrder = getPreferredRepositorySearchOrder(indexFile); > String[] suffixes = sortSuffixes(getAllSuffixes(), location, preferredOrder); > > SubMonitor sub = SubMonitor.convert(monitor, NLS.bind(Messages.repoMan_adding, location), suffixes.length * 100); >@@ -694,6 +686,28 @@ > } > > /** >+ * Fetches the p2.index file from the server. If the file could not be fetched >+ * a NullSafe version is returned. >+ */ >+ private LocationProperties loadIndexFile(URI location, IProgressMonitor monitor) { >+ // get the search order from the server, if it's available >+ ByteArrayOutputStream index = new ByteArrayOutputStream(); >+ LocationProperties locationProperties = LocationProperties.createEmptyIndexFile(); >+ IStatus indexFileStatus = null; >+ try { >+ indexFileStatus = getTransport().download(getIndexFileURI(location), index, monitor); >+ } catch (URISyntaxException uriSyntaxException) { >+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, uriSyntaxException.getMessage(), uriSyntaxException)); >+ indexFileStatus = null; >+ } >+ >+ if (indexFileStatus != null && indexFileStatus.isOK()) >+ locationProperties = LocationProperties.create(new ByteArrayInputStream(index.toByteArray())); >+ >+ return locationProperties; >+ } >+ >+ /** > * Basic sanity checking on location argument > */ > private URI checkValidLocation(URI location) { >@@ -1121,7 +1135,7 @@ > } > } > >- private static URI getIndexFile(URI base) throws URISyntaxException { >+ private static URI getIndexFileURI(URI base) throws URISyntaxException { > final String name = INDEX_FILE; > String spec = base.toString(); > if (spec.endsWith(name)) >Index: src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java,v >retrieving revision 1.1 >diff -u -r1.1 LocationProperties.java >--- src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java 15 Feb 2010 19:41:07 -0000 1.1 >+++ src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java 10 May 2010 19:30:01 -0000 >@@ -51,6 +51,10 @@ > private String[] artifactSearchOrder = new String[0]; // Version 1 > private Map<String, Boolean> md5Hashes = null; // Version 1 > >+ public static LocationProperties createEmptyIndexFile() { >+ return new LocationProperties(); >+ } >+ > /** > * Creates a LocationProperties Object from an input stream. If the LocationProperties > * could be created, it is returned. If it could not be created, an empty LocationProperties
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 312284
: 167792