Clean log from parse and parsing interrupted error messages

This commit is contained in:
aboyko
2022-10-07 17:19:02 -04:00
parent 0130203c8f
commit b3b03bfb47
6 changed files with 37 additions and 134 deletions

View File

@@ -87,8 +87,6 @@ public class RewriteRecipeRepository implements ApplicationContextAware {
private static final Logger log = LoggerFactory.getLogger(RewriteRecipeRepository.class);
private static final String WORKSPACE_EXECUTE_COMMAND = "workspace/executeCommand";
private static final String RECIPES_LOADING_PROGRESS = "loading-rewrite-recipes";
final private SimpleLanguageServer server;
final private Map<String, Recipe> recipes;
@@ -166,8 +164,9 @@ public class RewriteRecipeRepository implements ApplicationContextAware {
}
private synchronized void loadRecipes() {
String taskId = UUID.randomUUID().toString();
try {
server.getProgressService().progressBegin(RECIPES_LOADING_PROGRESS, "Loading Rewrite Recipes", null);
server.getProgressService().progressBegin(taskId, "Loading Rewrite Recipes", null);
log.info("Loading Rewrite Recipes...");
StsEnvironment env = createRewriteEnvironment();
for (Recipe r : env.listRecipes()) {
@@ -198,7 +197,7 @@ public class RewriteRecipeRepository implements ApplicationContextAware {
} catch (Throwable t) {
log.error("", t);
} finally {
server.getProgressService().progressDone(RECIPES_LOADING_PROGRESS);
server.getProgressService().progressDone(taskId);
}
}

View File

@@ -90,12 +90,16 @@ public class RewriteReconciler implements JavaReconciler {
}
}
} catch (Exception e) {
log.error("", e);
if (ORAstUtils.isExceptionFromInterrupedThread(e)) {
log.debug("", e);
} else {
log.error("", e);
}
} finally {
problemCollector.endCollecting();
}
}
private List<ReconcileProblem> createProblems(IDocument doc, FixAssistMarker m, J astNode) {
if (astNode != null) {
Range range = astNode.getMarkers().findFirst(Range.class).orElse(null);
@@ -156,7 +160,11 @@ public class RewriteReconciler implements JavaReconciler {
}
}
} catch (Exception e) {
log.error("", e);
if (ORAstUtils.isExceptionFromInterrupedThread(e)) {
log.debug("", e);
} else {
log.error("", e);
}
}
}
return allProblems;