Skip to content

Commit fac6dde

Browse files
authored
Do not skip ErrorReportValve.report in any case (#7489)
Initial advice skipped the original method on <400 http status code and responses not marked as errors. But we should not be changing the original behavior by default.
1 parent 5f75847 commit fac6dde

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

dd-java-agent/instrumentation/tomcat-appsec-7/src/main/java/datadog/trace/instrumentation/tomcat7/ErrorReportValueAdvice.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
public class ErrorReportValueAdvice {
1717

18-
@Advice.OnMethodEnter(suppress = Throwable.class, skipOn = Advice.OnNonDefaultValue.class)
19-
public static boolean onEnter(
18+
@Advice.OnMethodEnter(suppress = Throwable.class)
19+
public static void onEnter(
2020
@Advice.Argument(value = 1) Response response,
2121
@Advice.Argument(value = 2) Throwable throwable,
2222
@Advice.Origin("#t") String className,
@@ -27,7 +27,7 @@ public static boolean onEnter(
2727
// Do nothing if the response hasn't been explicitly marked as in error
2828
// and that error has not been reported.
2929
if (statusCode < 400 || statusCode == 404 || !response.isError()) {
30-
return true; // skip original method
30+
return;
3131
}
3232
if (throwable != null) {
3333
// Report IAST
@@ -45,12 +45,12 @@ public static boolean onEnter(
4545
final Config config = Config.get();
4646
if (config.getIastActivation() != ProductActivation.FULLY_ENABLED
4747
|| !config.isIastStacktraceLeakSuppress()) {
48-
return false;
48+
return;
4949
}
5050

5151
byte[] template = BlockingActionHelper.getTemplate(HTML);
5252
if (template == null) {
53-
return false;
53+
return;
5454
}
5555

5656
try {
@@ -71,7 +71,5 @@ public static boolean onEnter(
7171
} catch (IOException | IllegalStateException e) {
7272
// Ignore
7373
}
74-
75-
return false;
7674
}
7775
}

0 commit comments

Comments
 (0)