Skip to content

fix: escape multiline classloader names in view#3208

Merged
hengyunabc merged 3 commits into
alibaba:masterfrom
skt-shinyruo:fix/classloader-multiline-output
Jun 11, 2026
Merged

fix: escape multiline classloader names in view#3208
hengyunabc merged 3 commits into
alibaba:masterfrom
skt-shinyruo:fix/classloader-multiline-output

Conversation

@skt-shinyruo

Copy link
Copy Markdown
Contributor

Summary

  • escape CR/LF/TAB in classloader display text before rendering
  • apply the normalization across classloader table/tree and related headers
  • add regression coverage for the affected render paths

Test Plan

  • mvn -f core/pom.xml -Dtest=ClassLoaderViewTest test

@CLAassistant

CLAassistant commented Jun 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Arthas’ classloader rendering so classloader names containing control characters (CR/LF/TAB) don’t break table/tree output, and adds regression coverage for the main render paths.

Changes:

  • Introduce ClassUtils.formatClassLoaderText to normalize CR/LF into a literal \n and TAB into spaces.
  • Apply normalization to classloader display in ClassLoaderView (table/tree + section headers) and TypeRenderUtils.drawClassLoader (class detail views).
  • Add ClassLoaderViewTest coverage for multiple render entry points.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
core/src/test/java/com/taobao/arthas/core/command/view/ClassLoaderViewTest.java Adds regression tests asserting escaped rendering for table/tree/class-detail and headers.
core/src/main/java/com/taobao/arthas/core/util/TypeRenderUtils.java Normalizes classloader strings before building the classloader tree element.
core/src/main/java/com/taobao/arthas/core/util/ClassUtils.java Adds formatClassLoaderText helper for CR/LF/TAB normalization.
core/src/main/java/com/taobao/arthas/core/command/view/ClassLoaderView.java Applies normalization to classloader names/parents in table/tree and related headers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/java/com/taobao/arthas/core/util/TypeRenderUtils.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hengyunabc hengyunabc merged commit d7d8fe8 into alibaba:master Jun 11, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants