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

Log resolving errors from LibraryClasspathContainerResolverService #3180

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 @@ -37,6 +37,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.maven.artifact.Artifact;
import org.eclipse.core.runtime.CoreException;
Expand Down Expand Up @@ -158,6 +159,7 @@ public IStatus resolveContainer(
} else {
library = CloudLibraries.getLibrary(libraryId);
}

if (library != null) {
List<Job> sourceAttacherJobs = new ArrayList<>();
LibraryClasspathContainer container =
Expand All @@ -168,13 +170,20 @@ public IStatus resolveContainer(
new IJavaProject[] {javaProject},
new IClasspathContainer[] {container},
subMonitor.newChild(1));
serializer.saveContainer(javaProject, container);
for (Job job : sourceAttacherJobs) {
job.schedule();
if (!javaProject.getProject().getWorkspace().isTreeLocked()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the PR is doing more than simply logging errors.

// The classpath container update may have been triggered as part of a resource change
// in which case the workspace is locked and so we cannot serialize out our
// container cache. There will be other opportunities.
// https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/3181
serializer.saveContainer(javaProject, container);
for (Job job : sourceAttacherJobs) {
job.schedule();
}
}
}
return Status.OK_STATUS;
} catch (CoreException | IOException ex) {
logger.log(Level.SEVERE, "Could not resolve container: " + containerPath, ex);
return StatusUtil.error(
this, Messages.getString("TaskResolveContainerError", containerPath), ex);
}
Expand Down