Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MirrorRequest: catch UnsupportedOperationException #252 #471

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ protected void setSourceRepository(IArtifactRepository value) {

@Override
public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor) {
monitor.subTask(NLS.bind(Messages.downloading, getArtifactKey().getId()));
SubMonitor subMonitor = SubMonitor.convert(monitor, NLS.bind(Messages.downloading, getArtifactKey().getId()),
3);
setSourceRepository(sourceRepository);
// Do we already have the artifact in the target?
if (target.contains(getArtifactKey())) {
Expand Down Expand Up @@ -160,13 +161,13 @@ else if (ProcessingStepHandler.canProcess(descriptor2))
}

IArtifactDescriptor destinationDescriptor = getDestinationDescriptor(descriptor, descriptor == canonical);
IStatus status = transfer(destinationDescriptor, descriptor, monitor);
IStatus status = transfer(destinationDescriptor, descriptor, subMonitor.split(1));
// if ok, cancelled or transfer has already been done with the canonical form return with status set
if (status.getSeverity() == IStatus.CANCEL) {
setResult(status);
return;
}
if (monitor.isCanceled()) {
if (subMonitor.isCanceled()) {
setResult(Status.CANCEL_STATUS);
return;
}
Expand All @@ -176,15 +177,21 @@ else if (ProcessingStepHandler.canProcess(descriptor2))
}

// failed, first remove possibly erroneously added descriptor
if (target.contains(destinationDescriptor))
target.removeDescriptor(destinationDescriptor);
if (target.contains(destinationDescriptor)) {
try {
target.removeDescriptor(destinationDescriptor, subMonitor.split(1));
} catch (UnsupportedOperationException e) {
setResult(Status.warning("unable to remove Descriptor", e)); //$NON-NLS-1$
return;
}
}

if (descriptor == canonical || canonical == null) {
setResult(status);
return;
}

IStatus canonicalStatus = transfer(getDestinationDescriptor(canonical, true), canonical, monitor);
IStatus canonicalStatus = transfer(getDestinationDescriptor(canonical, true), canonical, subMonitor.split(1));
// To prevent the optimized transfer status severity from dominating the canonical, only merge
// if the canonical severity is equal to or higher than the optimized transfer severity.
if (canonicalStatus.getSeverity() < status.getSeverity())
Expand Down
Loading