Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 271681 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java (-9 / +9 lines)
Lines 161-175 Link Here
161
				// The only thing needed is to translate the error code ARTIFACT_NOT_FOUND to
161
				// The only thing needed is to translate the error code ARTIFACT_NOT_FOUND to
162
				// REPOSITORY_NOT_FOUND as the download does not know what the file represents.
162
				// REPOSITORY_NOT_FOUND as the download does not know what the file represents.
163
				//
163
				//
164
				// TODO: ? Tests dictate that REPOSITORY_NOT_FOUND is the correct response to 
164
				IStatus ms = null;
165
				// issues like "unknown host", "malformed url" - it is almost impossible to differentiate
165
				if (transferResult.getException() instanceof FileNotFoundException)
166
				// between "not found" and "error while reading something found" at this point.
166
					ms = new MultiStatus(Activator.ID, //
167
				// int code = transferResult.getCode();
167
							ProvisionException.REPOSITORY_NOT_FOUND,
168
				MultiStatus ms = new MultiStatus(Activator.ID, //
168
							// (code == ProvisionException.ARTIFACT_NOT_FOUND || code == ProvisionException.REPOSITORY_NOT_FOUND ? ProvisionException.REPOSITORY_NOT_FOUND : ProvisionException.REPOSITORY_FAILED_READ), //
169
						ProvisionException.REPOSITORY_NOT_FOUND,
169
							new IStatus[] {transferResult}, //
170
						// (code == ProvisionException.ARTIFACT_NOT_FOUND || code == ProvisionException.REPOSITORY_NOT_FOUND ? ProvisionException.REPOSITORY_NOT_FOUND : ProvisionException.REPOSITORY_FAILED_READ), //
170
							NLS.bind(Messages.ErrorReadingSite, location), null);
171
						new IStatus[] {transferResult}, //
171
				else
172
						NLS.bind(Messages.ErrorReadingSite, location), null);
172
					ms = transferResult;
173
				throw new ProvisionException(ms);
173
				throw new ProvisionException(ms);
174
174
175
			} finally {
175
			} finally {
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java (-2 / +2 lines)
Lines 124-136 Link Here
124
		try {
124
		try {
125
			factory.load(location, 0, new NullProgressMonitor());
125
			factory.load(location, 0, new NullProgressMonitor());
126
		} catch (ProvisionException e) {
126
		} catch (ProvisionException e) {
127
			assertEquals(ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
127
			assertEquals(ProvisionException.REPOSITORY_INVALID_LOCATION, e.getStatus().getCode());
128
		}
128
		}
129
		factory = new UpdateSiteMetadataRepositoryFactory();
129
		factory = new UpdateSiteMetadataRepositoryFactory();
130
		try {
130
		try {
131
			factory.load(location, 0, new NullProgressMonitor());
131
			factory.load(location, 0, new NullProgressMonitor());
132
		} catch (ProvisionException e) {
132
		} catch (ProvisionException e) {
133
			assertEquals(ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
133
			assertEquals(ProvisionException.REPOSITORY_INVALID_LOCATION, e.getStatus().getCode());
134
		}
134
		}
135
	}
135
	}
136
136
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java (-2 / +6 lines)
Lines 121-127 Link Here
121
				lastModifiedRemote = getTransport().getLastModified(jarLocation, submonitor.newChild(1));
121
				lastModifiedRemote = getTransport().getLastModified(jarLocation, submonitor.newChild(1));
122
				if (lastModifiedRemote <= 0)
122
				if (lastModifiedRemote <= 0)
123
					LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Server returned lastModified <= 0 for " + jarLocation)); //$NON-NLS-1$
123
					LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Server returned lastModified <= 0 for " + jarLocation)); //$NON-NLS-1$
124
125
			} catch (Exception e) {
124
			} catch (Exception e) {
126
				// not ideal, just skip the jar on error, and try the xml instead - report errors for
125
				// not ideal, just skip the jar on error, and try the xml instead - report errors for
127
				// the xml.
126
				// the xml.
Lines 154-160 Link Here
154
				} catch (AuthenticationFailedException e) {
153
				} catch (AuthenticationFailedException e) {
155
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_AuthenticationFaileFor_0, repositoryLocation), e));
154
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_AuthenticationFaileFor_0, repositoryLocation), e));
156
				} catch (CoreException e) {
155
				} catch (CoreException e) {
157
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_FailedCommunicationWithRepo_0, repositoryLocation), e));
156
					IStatus status = e.getStatus();
157
					if (status == null)
158
						throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_FailedCommunicationWithRepo_0, repositoryLocation), e));
159
					else if (status.getException() instanceof FileNotFoundException)
160
						throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, status.getMessage(), null));
161
					throw new ProvisionException(status);
158
162
159
				}
163
				}
160
				// There is an xml, and it should be used - cache is stale if it is jar based or
164
				// There is an xml, and it should be used - cache is stale if it is jar based or

Return to bug 271681