fix union "assertTag" exception message
It should say "bad access: "tag1", "tag2" is available."
Bug: 150948558
Test: aidl_unittests / aidl_integration_test
Change-Id: Ib4760d6688eb881f2096fbb481d2f3cbfe9e8001
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index dcc931d..2f4c7b3 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -2928,7 +2928,7 @@
private void _assertTag(int tag) {
if (getTag() != tag) {
- throw new IllegalStateException("bad access: " + _tagString(tag) + ", " + _tagString(tag) + " is available.");
+ throw new IllegalStateException("bad access: " + _tagString(tag) + ", " + _tagString(getTag()) + " is available.");
}
}
private String _tagString(int _tag) {
diff --git a/generate_java.cpp b/generate_java.cpp
index 58c1870..daf4147 100644
--- a/generate_java.cpp
+++ b/generate_java.cpp
@@ -633,7 +633,7 @@
out << "private void _assertTag(" + tag_type + " tag) {\n";
out << " if (getTag() != tag) {\n";
out << " throw new IllegalStateException(\"bad access: \" + _tagString(tag) + \", \" + "
- "_tagString(tag) + \" is available.\");\n";
+ "_tagString(getTag()) + \" is available.\");\n";
out << " }\n";
out << "}\n";
// helper: _tagString