sdedic commented on code in PR #6789:
URL: https://github.com/apache/netbeans/pull/6789#discussion_r1423567847
##########
java/maven/src/org/netbeans/modules/maven/problems/MavenModelProblemsProvider.java:
##########
@@ -179,25 +177,50 @@ private Pair<Collection<ProjectProblem>, Boolean>
doGetProblems1(boolean sync) {
}
MavenProject o = analysedProject.get();
- LOG.log(Level.FINER, "Called getProblems for {0}, analysed = {1},
current = {2}",
- new Object[] { project, o == null ? 0 :
System.identityHashCode(o), System.identityHashCode(updatedPrj) });
//for non changed project models, no need to recalculate, always
return the cached value
- Object wasprocessed =
updatedPrj.getContextValue(MavenModelProblemsProvider.class.getName());
- if (o == updatedPrj && wasprocessed != null) {
- Pair<Collection<ProjectProblem>, Boolean> cached =
problemsCache;
- LOG.log(Level.FINER, "getProblems: Project was processed,
cached is: {0}", cached);
- if (cached != null) {
- return cached;
+ if (pending.isDone()) {
+ try {
+ // cannot block, if .isDone().
+ MavenProject updatedPrj = pending.get();
+ LOG.log(Level.FINER, "Called getProblems for {0}, analysed
= {1}, current = {2}",
+ new Object[] { project, o == null ? 0 :
System.identityHashCode(o), System.identityHashCode(updatedPrj) });
+ Object wasprocessed =
updatedPrj.getContextValue(MavenModelProblemsProvider.class.getName());
+ if (o == updatedPrj && wasprocessed != null) {
+ Pair<Collection<ProjectProblem>, Boolean> cached =
problemsCache;
+ LOG.log(Level.FINER, "getProblems: Project was
processed, cached is: {0}", cached);
+ if (cached != null) {
+ return cached;
+ }
+ }
+ } catch (ExecutionException | InterruptedException ex) {
+ LOG.log(Level.FINER, "Project load for {0} threw exception
{1}", new Object[] { project, ex.getMessage() });
+ LOG.log(Level.FINER, "Stacktrace:", ex);
}
- }
+ } else {
+ LOG.log(Level.FINER, "Called getProblems for {0}, analysed =
{1}, current = PENDING",
+ new Object[] { project, o == null ? 0 :
System.identityHashCode(o) });
+ }
SanityBuildAction sba = cachedSanityBuild.get();
if (sba != null && sba.getPendingResult() == null) {
cachedSanityBuild.clear();
}
+
+ // PENDING: think if .thenApplyAsync would be more useful.
c = () -> {
// double check, the project may be invalidated during the
time.
- MavenProject prj =
((NbMavenProjectImpl)project).getFreshOriginalMavenProject();
+ MavenProject prj;
+
+ try {
+ prj =
((NbMavenProjectImpl)project).getFreshOriginalMavenProject().get();
+ LOG.log(Level.FINER, "Evaluating getProblems for {0},
analysed = {1}, current = {2}",
+ new Object[] { project, o == null ? 0 :
System.identityHashCode(o), System.identityHashCode(prj) });
Review Comment:
The logging fixes were addressed in 89faee1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists