Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-03-20 14:23:10 -0400
committerChristopher Frost2012-03-20 14:23:10 -0400
commit0791d591ef73bdf2d972204e022e8335497cb226 (patch)
tree46bfa0e15d26846f91d81af7121e323f2968b3f5
parent779516981aafb3f3c6129ba2b1cb187eaa79258a (diff)
downloadorg.eclipse.virgo.medic-0791d591ef73bdf2d972204e022e8335497cb226.tar.gz
org.eclipse.virgo.medic-0791d591ef73bdf2d972204e022e8335497cb226.tar.xz
org.eclipse.virgo.medic-0791d591ef73bdf2d972204e022e8335497cb226.zip
374061 Dump generation will continue on even if a dump contributer throws a RTE
-rw-r--r--org.eclipse.virgo.medic.core/.settings/org.eclipse.virgo.ide.bundlor.core.prefs2
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGenerator.java2
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicLogEvents.java3
-rw-r--r--org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGeneratorTests.java11
4 files changed, 13 insertions, 5 deletions
diff --git a/org.eclipse.virgo.medic.core/.settings/org.eclipse.virgo.ide.bundlor.core.prefs b/org.eclipse.virgo.medic.core/.settings/org.eclipse.virgo.ide.bundlor.core.prefs
index 8b5cee9..2d8b2dc 100644
--- a/org.eclipse.virgo.medic.core/.settings/org.eclipse.virgo.ide.bundlor.core.prefs
+++ b/org.eclipse.virgo.medic.core/.settings/org.eclipse.virgo.ide.bundlor.core.prefs
@@ -1,4 +1,4 @@
bundlor.generated.manifest.autoformatting=false
-byte.code.scanning=false
+byte.code.scanning=true
eclipse.preferences.version=1
template.properties.files=../build.versions;../build.properties
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGenerator.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGenerator.java
index 91d8d5e..e6a1016 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGenerator.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGenerator.java
@@ -67,6 +67,8 @@ public final class StandardDumpGenerator implements DumpGenerator {
dumpContributor.contribute(dump);
} catch (DumpContributionFailedException e) {
this.eventLogger.log(MedicLogEvents.CONTRIBUTION_FAILED, e, dumpContributor.getName(), dump.getTimestamp());
+ } catch (RuntimeException e) {
+ this.eventLogger.log(MedicLogEvents.CONTRIBUTION_ERROR, e, dumpContributor.getName(), dump.getTimestamp());
}
}
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicLogEvents.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicLogEvents.java
index bb29a5e..193504c 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicLogEvents.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicLogEvents.java
@@ -19,7 +19,8 @@ public enum MedicLogEvents implements LogEvent {
MISSING_MESSAGE(1, Level.WARNING), //
CONTRIBUTION_FAILED(2, Level.WARNING), //
DUMP_GENERATED(3, Level.INFO), //
- DIRECTORY_CREATION_FAILED(4, Level.WARNING);
+ DIRECTORY_CREATION_FAILED(4, Level.WARNING), //
+ CONTRIBUTION_ERROR(2, Level.ERROR);
private static final String PREFIX = "ME";
diff --git a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGeneratorTests.java b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGeneratorTests.java
index 8f6a421..eb2b05c 100644
--- a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGeneratorTests.java
+++ b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/dump/impl/StandardDumpGeneratorTests.java
@@ -61,20 +61,25 @@ public class StandardDumpGeneratorTests {
dumpContributor2.contribute(isA(Dump.class));
expect(dumpContributor2.getName()).andReturn("dc2").anyTimes();
- expect(accessor.getDumpContributors()).andReturn(Arrays.asList(dumpContributor1, dumpContributor2));
+ DumpContributor dumpContributor3 = createMock(DumpContributor.class);
+ dumpContributor3.contribute(isA(Dump.class));
+ expectLastCall().andThrow(new RuntimeException());
+ expect(dumpContributor3.getName()).andReturn("dc3").anyTimes();
+
+ expect(accessor.getDumpContributors()).andReturn(Arrays.asList(dumpContributor1, dumpContributor2, dumpContributor3));
ConfigurationProvider configurationProvider = createMock(ConfigurationProvider.class);
Dictionary<String, String> configuration = new Hashtable<String, String>();
configuration.put(ConfigurationProvider.KEY_DUMP_ROOT_DIRECTORY, "target");
expect(configurationProvider.getConfiguration()).andReturn(configuration).anyTimes();
- replay(accessor, dumpContributor1, dumpContributor2, configurationProvider);
+ replay(accessor, dumpContributor1, dumpContributor2, dumpContributor3, configurationProvider);
DumpGenerator dumpGenerator = new StandardDumpGenerator(accessor, configurationProvider, eventLogger);
dumpGenerator.generateDump("foo");
dumpGenerator.generateDump("bar", context);
- verify(accessor, dumpContributor1, dumpContributor2, configurationProvider);
+ verify(accessor, dumpContributor1, dumpContributor2, dumpContributor3, configurationProvider);
}
@Test

Back to the top