Merge branch '1.4.x' into 1.5.x
This commit is contained in:
@@ -115,9 +115,14 @@ public final class FailureAnalyzers {
|
||||
|
||||
private FailureAnalysis analyze(Throwable failure, List<FailureAnalyzer> analyzers) {
|
||||
for (FailureAnalyzer analyzer : analyzers) {
|
||||
FailureAnalysis analysis = analyzer.analyze(failure);
|
||||
if (analysis != null) {
|
||||
return analysis;
|
||||
try {
|
||||
FailureAnalysis analysis = analyzer.analyze(failure);
|
||||
if (analysis != null) {
|
||||
return analysis;
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
log.debug("FailureAnalyzer " + analyzer + " failed", ex);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -62,9 +62,16 @@ public class FailureAnalyzersTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void brokenAnalyzerDoesNotPreventOtherAnalyzersFromBeingCalled() {
|
||||
public void analyzerThatFailsDuringInitializationDoesNotPreventOtherAnalyzersFromBeingCalled() {
|
||||
RuntimeException failure = new RuntimeException();
|
||||
analyzeAndReport("broken.factories", failure);
|
||||
analyzeAndReport("broken-initialization.factories", failure);
|
||||
verify(failureAnalyzer, times(1)).analyze(failure);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void analyzerThatFailsDuringAnalysisDoesNotPreventOtherAnalyzersFromBeingCalled() {
|
||||
RuntimeException failure = new RuntimeException();
|
||||
analyzeAndReport("broken-analysis.factories", failure);
|
||||
verify(failureAnalyzer, times(1)).analyze(failure);
|
||||
}
|
||||
|
||||
@@ -83,7 +90,7 @@ public class FailureAnalyzersTests {
|
||||
|
||||
}
|
||||
|
||||
static class BrokenFailureAnalyzer implements FailureAnalyzer {
|
||||
static class BrokenInitializationFailureAnalyzer implements FailureAnalyzer {
|
||||
|
||||
static {
|
||||
Object foo = null;
|
||||
@@ -97,6 +104,15 @@ public class FailureAnalyzersTests {
|
||||
|
||||
}
|
||||
|
||||
static class BrokenAnalysisFailureAnalyzer implements FailureAnalyzer {
|
||||
|
||||
@Override
|
||||
public FailureAnalysis analyze(Throwable failure) {
|
||||
throw new NoClassDefFoundError();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface BeanFactoryAwareFailureAnalyzer extends BeanFactoryAware, FailureAnalyzer {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.diagnostics.FailureAnalyzersTests$BrokenFailureAnalyzer,\
|
||||
org.springframework.boot.diagnostics.FailureAnalyzersTests$BrokenAnalysisFailureAnalyzer,\
|
||||
org.springframework.boot.diagnostics.FailureAnalyzersTests$BasicFailureAnalyzer
|
||||
@@ -0,0 +1,4 @@
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.diagnostics.FailureAnalyzersTests$BrokenAnalysisFailureAnalyzer,\
|
||||
org.springframework.boot.diagnostics.FailureAnalyzersTests$BasicFailureAnalyzer
|
||||
Reference in New Issue
Block a user