Fix toJsonClassLoaderContextRec size bug

toJsonClassLoaderContextRec's size is twice as large than expected. And
the initial values is filled with null value.

Bug: 158843648
Test: m nothing(testcase is added)
Change-Id: I24c23269bd16baa18481f34b85c543d41f26d0e0
This commit is contained in:
Jeongik Cha
2021-04-22 20:55:21 +09:00
parent ed9c17d033
commit 19ade89042
2 changed files with 26 additions and 3 deletions

View File

@@ -544,13 +544,13 @@ func toJsonClassLoaderContext(clcMap ClassLoaderContextMap) jsonClassLoaderConte
// Recursive helper for toJsonClassLoaderContext.
func toJsonClassLoaderContextRec(clcs []*ClassLoaderContext) []*jsonClassLoaderContext {
jClcs := make([]*jsonClassLoaderContext, len(clcs))
for _, clc := range clcs {
jClcs = append(jClcs, &jsonClassLoaderContext{
for i, clc := range clcs {
jClcs[i] = &jsonClassLoaderContext{
Name: clc.Name,
Host: clc.Host.String(),
Device: clc.Device,
Subcontexts: toJsonClassLoaderContextRec(clc.Subcontexts),
})
}
}
return jClcs
}