Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
52aa7e1e
Commit
52aa7e1e
authored
Feb 19, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include source of NoSuchMethodError in its failure analysis
Closes gh-15995
parent
971b608f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
NoSuchMethodFailureAnalyzer.java
...oot/diagnostics/analyzer/NoSuchMethodFailureAnalyzer.java
+14
-6
NoSuchMethodFailureAnalyzerTests.java
...iagnostics/analyzer/NoSuchMethodFailureAnalyzerTests.java
+4
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoSuchMethodFailureAnalyzer.java
View file @
52aa7e1e
/*
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -93,11 +93,19 @@ class NoSuchMethodFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchMethodEr
...
@@ -93,11 +93,19 @@ class NoSuchMethodFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchMethodEr
List
<
URL
>
candidates
,
URL
actual
)
{
List
<
URL
>
candidates
,
URL
actual
)
{
StringWriter
description
=
new
StringWriter
();
StringWriter
description
=
new
StringWriter
();
PrintWriter
writer
=
new
PrintWriter
(
description
);
PrintWriter
writer
=
new
PrintWriter
(
description
);
writer
.
print
(
"An attempt was made to call the method "
);
writer
.
println
(
"An attempt was made to call a method that does not"
writer
.
print
(
cause
.
getMessage
());
+
" exist. The attempt was made from the following location:"
);
writer
.
print
(
" but it does not exist. Its class, "
);
writer
.
println
();
writer
.
print
(
className
);
writer
.
print
(
" "
);
writer
.
println
(
", is available from the following locations:"
);
writer
.
println
(
cause
.
getStackTrace
()[
0
]);
writer
.
println
();
writer
.
println
(
"The following method did not exist:"
);
writer
.
println
();
writer
.
print
(
" "
);
writer
.
println
(
cause
.
getMessage
());
writer
.
println
();
writer
.
println
(
"The method's class, "
+
className
+
", is available from the following locations:"
);
writer
.
println
();
writer
.
println
();
for
(
URL
candidate
:
candidates
)
{
for
(
URL
candidate
:
candidates
)
{
writer
.
print
(
" "
);
writer
.
print
(
" "
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoSuchMethodFailureAnalyzerTests.java
View file @
52aa7e1e
...
@@ -44,8 +44,11 @@ public class NoSuchMethodFailureAnalyzerTests {
...
@@ -44,8 +44,11 @@ public class NoSuchMethodFailureAnalyzerTests {
assertThat
(
failure
).
isNotNull
();
assertThat
(
failure
).
isNotNull
();
FailureAnalysis
analysis
=
new
NoSuchMethodFailureAnalyzer
().
analyze
(
failure
);
FailureAnalysis
analysis
=
new
NoSuchMethodFailureAnalyzer
().
analyze
(
failure
);
assertThat
(
analysis
).
isNotNull
();
assertThat
(
analysis
).
isNotNull
();
System
.
out
.
println
(
analysis
.
getDescription
());
assertThat
(
analysis
.
getDescription
())
assertThat
(
analysis
.
getDescription
())
.
contains
(
"the method javax.servlet.ServletContext.addServlet"
.
contains
(
NoSuchMethodFailureAnalyzerTests
.
class
.
getName
()
+
".createFailure("
)
.
contains
(
"javax.servlet.ServletContext.addServlet"
+
"(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+
"(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+
"Ljavax/servlet/ServletRegistration$Dynamic;"
)
+
"Ljavax/servlet/ServletRegistration$Dynamic;"
)
.
contains
(
"class, javax.servlet.ServletContext,"
);
.
contains
(
"class, javax.servlet.ServletContext,"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment