From b209dde16c2d879209ef9b365ef1a4284007bc9c Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Fri, 15 Dec 2023 12:37:13 +0100 Subject: [PATCH] fix: log YAML parsing errors as warning to avoid popup Signed-off-by: Fred Bricon --- .../psi/core/project/AbstractConfigSource.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/AbstractConfigSource.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/AbstractConfigSource.java index 47955a7ce..ec02aafbe 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/AbstractConfigSource.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/project/AbstractConfigSource.java @@ -176,13 +176,13 @@ protected final T getConfig() { try (InputStream input = configFile.getInputStream()) { config = loadConfig(input); lastModified = configFile.getModificationStamp(); - } catch (IOException e) { + } catch (Exception e) { reset(); - LOGGER.error("Error while loading properties from '" + configFile + "'.", e); + LOGGER.warn("Error while loading properties from '" + configFile + "'.", e); } } } catch (RuntimeException e1) { - LOGGER.error("Error while getting last modified time for '" + configFile + "'.", e1); + LOGGER.warn("Error while getting last modified time for '" + configFile + "'.", e1); } return config; } @@ -194,9 +194,9 @@ public void reload(PsiFile file) { try (InputStream input = IOUtils.toInputStream(content, Charset.defaultCharset())) { config = loadConfig(input); lastModified = System.currentTimeMillis(); - } catch (IOException e) { + } catch (Exception e) { reset(); - LOGGER.error("Error while loading properties from '" + sourceConfigFile + "'.", e); + LOGGER.warn("Error while loading properties from '" + sourceConfigFile + "'.", e); } } @@ -207,7 +207,7 @@ public Integer getPropertyAsInt(String key) { try { return Integer.parseInt(property.trim()); } catch (NumberFormatException e) { - LOGGER.error("Error while converting '" + property.trim() + "' as Integer for key '" + key + "'", e); + LOGGER.warn("Error while converting '" + property.trim() + "' as Integer for key '" + key + "'", e); return null; } }