Don't dump stack trace if the startup fails
This makes test logs less distracting.
Change-Id: Iad08a9c59234b0830c58288decb6dfd44159cad9
diff --git a/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java b/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
index 94ee107..d55fdbc 100644
--- a/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
+++ b/java/com/googlesource/gerrit/plugins/supermanifest/SuperManifestRefUpdatedListener.java
@@ -138,13 +138,10 @@
srcRef = refs/heads/nyc
srcPath = manifest.xml
*/
- private Set<ConfigEntry> parseConfiguration(PluginConfigFactory cfgFactory, String name) {
- Config cfg;
- try {
- cfg = cfgFactory.getProjectPluginConfig(allProjectsName, name);
- } catch (NoSuchProjectException e) {
- throw new IllegalStateException(e);
- }
+ private Set<ConfigEntry> parseConfiguration(PluginConfigFactory cfgFactory, String name)
+ throws NoSuchProjectException {
+ Config cfg = cfgFactory.getProjectPluginConfig(allProjectsName, name);
+
Set<ConfigEntry> newConf = new HashSet<>();
Set<String> destinations = new HashSet<>();
@@ -196,7 +193,11 @@
@Override
public void start() {
- updateConfiguration();
+ try {
+ updateConfiguration();
+ } catch (NoSuchProjectException e) {
+ warn("can't read configuration: %s", e.getMessage());
+ }
}
/** for debugging. */
@@ -210,7 +211,7 @@
return b.toString();
}
- private void updateConfiguration() {
+ private void updateConfiguration() throws NoSuchProjectException {
Set<ConfigEntry> entries = parseConfiguration(cfgFactory, pluginName);
Set<ConfigEntry> filtered = new HashSet<>();
@@ -232,7 +233,11 @@
public synchronized void onGitReferenceUpdated(Event event) {
if (event.getProjectName().equals(allProjectsName.get())) {
if (event.getRefName().equals("refs/meta/config")) {
- updateConfiguration();
+ try {
+ updateConfiguration();
+ } catch (NoSuchProjectException e) {
+ throw new IllegalStateException(e);
+ }
}
return;
}