Skip to content

Commit b1c4803

Browse files
committed
Remove default params
1 parent 29e6c16 commit b1c4803

File tree

5 files changed

+50
-10
lines changed

5 files changed

+50
-10
lines changed

grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/CodeSnippetPrinter.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ interface CodeSnippetPrinter {
2727
* Attempts to present a preview code snippet of the code that went wrong
2828
*
2929
* @param exception The exception
30+
* @param optional attributes for formatting
3031
* @return The code snippet or nothing if it can't be previewed
3132
*/
33+
String prettyPrintCodeSnippet(Throwable exception, Map attrs)
34+
35+
@Deprecated
3236
String prettyPrintCodeSnippet(Throwable exception)
3337
}

grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTracePrinter.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ import org.codehaus.groovy.control.MultipleCompilationErrorsException
2323
*/
2424
class DefaultStackTracePrinter implements StackTracePrinter {
2525

26-
String prettyPrint(Throwable t, Map attrs = [:]) {
26+
@Deprecated
27+
String prettyPrint(Throwable t) {
28+
prettyPrint(t, [:])
29+
}
30+
31+
@Override
32+
String prettyPrint(Throwable t, Map attrs) {
2733
if (t == null) return ''
2834
if (!t.stackTrace) return 'No stack trace available'
2935
final sw = new StringWriter()

grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/StackTracePrinter.groovy

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,16 @@ interface StackTracePrinter {
2929
* @param throwable The throwable
3030
* @return The result
3131
*/
32+
@Deprecated
3233
String prettyPrint(Throwable throwable)
34+
35+
/**
36+
* Pretty print the given stack trace and return the result
37+
*
38+
* @param throwable The throwable
39+
* @param optional attributes for formatting
40+
* @return The result
41+
*/
42+
String prettyPrint(Throwable throwable, Map attrs)
43+
3344
}

grails-core/src/main/groovy/org/grails/core/exceptions/DefaultErrorsPrinter.groovy

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ class DefaultErrorsPrinter extends DefaultStackTracePrinter implements CodeSnipp
4747
res == null ? te.className : res.getFilename()
4848
}
4949

50-
String prettyPrintCodeSnippet(Throwable exception, Map attrs = [:]) {
50+
@Deprecated
51+
String prettyPrintCodeSnippet(Throwable exception) {
52+
prettyPrintCodeSnippet(exception, [:])
53+
}
54+
55+
String prettyPrintCodeSnippet(Throwable exception, Map attrs) {
5156
if (exception == null) {
5257
return ''
5358
}
@@ -198,18 +203,32 @@ class DefaultErrorsPrinter extends DefaultStackTracePrinter implements CodeSnipp
198203
""
199204
}
200205

201-
String formatCodeSnippetStart(Resource resource, int lineNumber, Map attrs = [:]) {
206+
@Deprecated
207+
String formatCodeSnippetStart(Resource resource, int lineNumber) {
208+
formatCodeSnippetStart(resource, lineNumber, [:])
209+
}
210+
211+
String formatCodeSnippetStart(Resource resource, int lineNumber, Map attrs) {
202212
"""Around line $lineNumber of $resource.filename
203213
"""
214+
}
204215

216+
@Deprecated
217+
protected String formatCodeSnippetLine(int currentLineNumber, currentLine) {
218+
formatCodeSnippetLine(currentLineNumber, currentLine, [:])
205219
}
206220

207-
protected String formatCodeSnippetLine(int currentLineNumber, currentLine, Map attrs = [:]) {
221+
protected String formatCodeSnippetLine(int currentLineNumber, currentLine, Map attrs) {
208222
"""${currentLineNumber}: ${currentLine}
209223
"""
210224
}
211225

212-
protected String formatCodeSnippetErrorLine(int currentLineNumber, currentLine, Map attrs = [:]) {
226+
@Deprecated
227+
protected String formatCodeSnippetErrorLine(int currentLineNumber, currentLine) {
228+
formatCodeSnippetErrorLine(currentLineNumber, currentLine, [:])
229+
}
230+
231+
protected String formatCodeSnippetErrorLine(int currentLineNumber, currentLine, Map attrs) {
213232
"""${currentLineNumber}: ${currentLine}
214233
"""
215234
}

grails-web-common/src/main/groovy/org/grails/web/errors/ErrorsViewStackTracePrinter.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ class ErrorsViewStackTracePrinter extends DefaultErrorsPrinter {
3838
}
3939

4040
@Override
41-
String prettyPrint(Throwable t, Map attrs = [:]) {
41+
String prettyPrint(Throwable t, Map attrs) {
4242
if (t instanceof GrailsWrappedRuntimeException) {
4343
t = t.cause
4444
}
4545
return super.prettyPrint(t, attrs)
4646
}
4747

4848
@Override
49-
String prettyPrintCodeSnippet(Throwable t, Map attrs = [:]) {
49+
String prettyPrintCodeSnippet(Throwable t, Map attrs) {
5050
if (t instanceof GrailsWrappedRuntimeException) {
5151
t = t.cause
5252
}
5353
return super.prettyPrintCodeSnippet(t, attrs)
5454
}
5555

5656
@Override
57-
String formatCodeSnippetStart(Resource resource, int lineNumber, Map attrs = [:]) {
57+
String formatCodeSnippetStart(Resource resource, int lineNumber, Map attrs) {
5858
String path = resource.filename
5959
// try calc better path
6060
try {
@@ -77,12 +77,12 @@ class ErrorsViewStackTracePrinter extends DefaultErrorsPrinter {
7777
}
7878

7979
@Override
80-
protected String formatCodeSnippetLine(int currentLineNumber, Object currentLine, Map attrs = [:]) {
80+
protected String formatCodeSnippetLine(int currentLineNumber, Object currentLine, Map attrs) {
8181
"""<code class="${attrs['lineClass'] ?: 'line'}"><span class="${attrs['lineNumberClass'] ?: 'lineNumber'}">${currentLineNumber}:</span>${currentLine.encodeAsHTML()}</code>"""
8282
}
8383

8484
@Override
85-
protected String formatCodeSnippetErrorLine(int currentLineNumber, Object currentLine, Map attrs = [:]) {
85+
protected String formatCodeSnippetErrorLine(int currentLineNumber, Object currentLine, Map attrs) {
8686
"""<code class="${attrs['lineErrorClass'] ?: 'line error'}"><span class="${attrs['lineNumberClass'] ?: 'lineNumber'}">${currentLineNumber}:</span>${currentLine.encodeAsHTML()}</code>"""
8787
}
8888

0 commit comments

Comments
 (0)