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

Better error logging when calendars do not load properly #5034

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
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 @@ -141,7 +141,7 @@ private static Element getRequiredChild(@NotNull final Element root, final Strin
if (element != null) {
return element;
} else {
throw new Exception("Missing the '" + child + "' tag in calendar file: text=" + root.getText());
throw new Exception("Missing the '" + child + "' tag in calendar file: text=" + root.getTextTrim());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ private static void loadProperty(final Configuration configuration, final String
final String location = configuration.getProperty(property);
try {
load(location);
} catch (NoSuchFileException e) {
logger.warn().append("Problem loading calendars. importPath=").append(location).append(e).endl();
} catch (Exception e) {
logger.warn().append("Problem loading calendars. property=").append(property)
.append(" importPath=").append(location).append(e).endl();
throw new RuntimeException("Problem loading calendars. property=" + property +
" importPath=" + location, e);
}
}

Expand All @@ -90,18 +93,15 @@ private static void load(final String businessCalendarConfig) throws NoSuchFileE
logger.warn("Could not open " + filePath + " from classpath");
throw new RuntimeException("Could not open " + filePath + " from classpath");
}
} catch (IOException e) {
} catch (Exception e) {
logger.warn("Problem loading calendar: location=" + businessCalendarConfig, e);
throw new RuntimeException("Problem loading calendar: location=" + businessCalendarConfig, e);
}
};

try (final BufferedReader config = new BufferedReader(new InputStreamReader(configToLoad))) {
config.lines().forEach(consumer);
} catch (NoSuchFileException e) {
logger.warn("Problem loading calendar: location=" + businessCalendarConfig, e);
throw e;
} catch (IOException e) {
} catch (Exception e) {
logger.warn("Problem loading calendar: location=" + businessCalendarConfig, e);
throw new RuntimeException("Problem loading calendar: location=" + businessCalendarConfig, e);
}
Expand Down
Loading