-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix ObjectOutput handling of top-level scalar responses #3861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,11 +42,6 @@ public ObjectOutput(RedisCodec<K, V> codec) { | |
|
|
||
| @Override | ||
| public void set(long integer) { | ||
|
|
||
| if (!initialized) { | ||
| output = new ArrayList<>(); | ||
| } | ||
|
|
||
| setValue(integer); | ||
| } | ||
|
|
||
|
|
@@ -78,6 +73,11 @@ public void setSingle(ByteBuffer bytes) { | |
| @SuppressWarnings("unchecked") | ||
| private void setValue(Object value) { | ||
|
|
||
| if (!initialized) { | ||
| output = new ArrayList<>(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If value is non-collection type, could we not initialize output as a List? Instead, just assign value to ouput?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion! Updated the implementation to assign top-level non-collection RESP3 values directly to Nested collection responses are unchanged because I also added regression tests covering top-level bulk string, boolean, double, and integer responses. |
||
| initialized = true; | ||
| } | ||
|
|
||
| if (output != null) { | ||
|
|
||
| if (output instanceof Collection) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we assign the actual value here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Updated accordingly.
Top-level RESP3 scalar values are now assigned directly to
outputinstead of being wrapped in aList.