[Retrace] Add test for rewriting of class name in exception message
Bug: b/300416467
Change-Id: I0ae58abd3e498a1e28eb1f05ae5882e6fb69d502
diff --git a/src/test/java/com/android/tools/r8/retrace/RetraceTests.java b/src/test/java/com/android/tools/r8/retrace/RetraceTests.java
index 6abc4c7..c1e939d 100644
--- a/src/test/java/com/android/tools/r8/retrace/RetraceTests.java
+++ b/src/test/java/com/android/tools/r8/retrace/RetraceTests.java
@@ -35,6 +35,7 @@
import com.android.tools.r8.retrace.stacktraces.ClassWithDashStackTrace;
import com.android.tools.r8.retrace.stacktraces.ColonInFileNameStackTrace;
import com.android.tools.r8.retrace.stacktraces.DifferentLineNumberSpanStackTrace;
+import com.android.tools.r8.retrace.stacktraces.ExceptionMessageWithClassNameInMessage;
import com.android.tools.r8.retrace.stacktraces.FileNameExtensionStackTrace;
import com.android.tools.r8.retrace.stacktraces.FoundMethodVerboseStackTrace;
import com.android.tools.r8.retrace.stacktraces.IdentityMappingStackTrace;
@@ -296,6 +297,11 @@
}
@Test
+ public void testExceptionMessageWithClassNameInMessage() throws Exception {
+ runRetraceTest(new ExceptionMessageWithClassNameInMessage());
+ }
+
+ @Test
public void testUnknownSourceStackTrace() throws Exception {
runRetraceTest(new UnknownSourceStackTrace());
}
diff --git a/src/test/java/com/android/tools/r8/retrace/stacktraces/ExceptionMessageWithClassNameInMessage.java b/src/test/java/com/android/tools/r8/retrace/stacktraces/ExceptionMessageWithClassNameInMessage.java
new file mode 100644
index 0000000..5b21d1a
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/retrace/stacktraces/ExceptionMessageWithClassNameInMessage.java
@@ -0,0 +1,51 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.retrace.stacktraces;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+
+/** This is a reproduction of b/300416467 */
+public class ExceptionMessageWithClassNameInMessage implements StackTraceForTest {
+
+ @Override
+ public List<String> obfuscatedStackTrace() {
+ return ImmutableList.of(
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: Exception",
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: java.util.concurrent.ExecutionException:"
+ + " ary: eu: Exception in CronetUrlRequest: net::ERR_CONNECTION_CLOSED, ErrorCode=5,"
+ + " InternalErrorCode=-100, Retryable=true");
+ }
+
+ @Override
+ public String mapping() {
+ return "foo.bar.baz -> net:";
+ }
+
+ @Override
+ public List<String> retracedStackTrace() {
+ return ImmutableList.of(
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: Exception",
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: java.util.concurrent.ExecutionException:"
+ // TODO(b/300416467): We should not deobfuscate net.
+ + " ary: eu: Exception in CronetUrlRequest: foo.bar.baz::ERR_CONNECTION_CLOSED,"
+ + " ErrorCode=5, InternalErrorCode=-100, Retryable=true");
+ }
+
+ @Override
+ public List<String> retraceVerboseStackTrace() {
+ return ImmutableList.of(
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: Exception",
+ "10-26 19:26:24.749 10159 26250 26363 E Tycho.crl: java.util.concurrent.ExecutionException:"
+ // TODO(b/300416467): We should not deobfuscate net.
+ + " ary: eu: Exception in CronetUrlRequest: foo.bar.baz::ERR_CONNECTION_CLOSED,"
+ + " ErrorCode=5, InternalErrorCode=-100, Retryable=true");
+ }
+
+ @Override
+ public int expectedWarnings() {
+ return 0;
+ }
+}