Skip to content

[fix][cli] Fix pulsar-shell cannot produce message with quotes and space - #24320

Merged
lhotari merged 2 commits into
apache:masterfrom
berg223:fix_shell_produce_error
May 21, 2025
Merged

lhotari merged 2 commits into
apache:masterfrom
berg223:fix_shell_produce_error

Conversation

@berg223

@berg223 berg223 commented May 20, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #24319

Motivation

The InteractiveLineReader cannot parseLine("client produce -m \"hello\ pulsar\" my-topic") correctly. The result will not retain quotes.

Modifications

change the following code from


                public List<String> parseLine(String line) {
                    return reader.getParser().parse(line, 0).words();
                }

to

                public List<String> parseLine(String line) {
                    return reader.getParser().parse(line, 0, Parser.ParseContext.SPLIT_LINE).words();
                }

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • org.apache.pulsar.shell.PulsarShellTest#testInteractiveMode

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions

Copy link
Copy Markdown

@berg223 Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions Bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels May 20, 2025
@lhotari lhotari changed the title [fix][cli] Fix pulsar-shell cannot produce message with quota and space [fix][cli] Fix pulsar-shell cannot produce message with quotes and space May 20, 2025

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution @berg223

@lhotari lhotari added this to the 4.1.0 milestone May 20, 2025
@codecov-commenter

codecov-commenter commented May 20, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.25%. Comparing base (bbc6224) to head (de6a057).
Report is 1110 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/org/apache/pulsar/shell/PulsarShell.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24320      +/-   ##
============================================
+ Coverage     73.57%   74.25%   +0.68%     
+ Complexity    32624    32268     -356     
============================================
  Files          1877     1866      -11     
  Lines        139502   145104    +5602     
  Branches      15299    16591    +1292     
============================================
+ Hits         102638   107753    +5115     
+ Misses        28908    28836      -72     
- Partials       7956     8515     +559     
Flag Coverage Δ
inttests 26.63% <0.00%> (+2.05%) ⬆️
systests 23.26% <0.00%> (-1.06%) ⬇️
unittests 73.75% <0.00%> (+0.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...main/java/org/apache/pulsar/shell/PulsarShell.java 51.21% <0.00%> (+0.73%) ⬆️

... and 1087 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@berg223

berg223 commented May 21, 2025

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@lhotari
lhotari merged commit 6b2ed7e into apache:master May 21, 2025
@berg223
berg223 deleted the fix_shell_produce_error branch May 24, 2025 16:24
lhotari pushed a commit that referenced this pull request Jun 2, 2025
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…ace (apache#24320)

(cherry picked from commit 6b2ed7e)
(cherry picked from commit a0aaf44)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 5, 2025
…ace (apache#24320)

(cherry picked from commit 6b2ed7e)
(cherry picked from commit a0aaf44)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] pulsar-shell cannot produce message with quota and space

4 participants