Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#19436 closed defect (fixed)

[PATCH] Don't attempt to add null objects to a JsonArray in RequestProcessor

Reported by: taylor.smock Owned by: team
Priority: normal Milestone: 20.07
Component: Core remotecontrol Version:
Keywords: Cc: simon04

Description (last modified by taylor.smock)

For some reason, on some configurations, my plugin isn't registering itself properly, which causes an NPE in RequestProcessor#getHandlersInfoAsJson. This is due to the code returning a null value (on purpose), and then attempting to add the null value to the JsonArray builder.

This is a regression from r16550. StringBuilder happily accepted null values and output null in the string.

I'm attaching a partial preferences xml so I can fix it in MapWithAI as well (I shouldn't be allowing 8111 ports in mapwithai.sources.entries right now).

  <tag key='remotecontrol.enabled' value='true'/>
  <tag key='remotecontrol.new-layer' value='true'/>
  <maps key='mapwithai.sources.entries'>
    <map>
      <tag key='parameters' value='[]'/>
      <tag key='name' value='a'/>
      <tag key='type' value='thirdParty'/>
      <tag key='url' value='http://localhost:8111/features?q=mapwithai'/>
      <tag key='cookies' value=''/>
      <tag key='customHttpHeaders' value='{}'/>
      <tag key='category' value='other'/>
    </map>

EDIT: Not a MapWithAI specific bug
http://localhost:8111/features?q=add_node will also cause an NPE. It looks like we need to prepend a / if one doesn't exist.

Attachments (3)

19436.patch (820 bytes) - added by taylor.smock 3 years ago.
19436.1.patch (655 bytes) - added by taylor.smock 3 years ago.
Prepend / to commands, if it doesn't exist
19436.2.patch (2.2 KB) - added by taylor.smock 3 years ago.
Add non-regression test

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by taylor.smock

Attachment: 19436.patch added

comment:1 Changed 3 years ago by taylor.smock

Cc: simon04 added
Description: modified (diff)

comment:2 Changed 3 years ago by taylor.smock

Component: CoreCore remotecontrol
Description: modified (diff)

Changed 3 years ago by taylor.smock

Attachment: 19436.1.patch added

Prepend / to commands, if it doesn't exist

Changed 3 years ago by taylor.smock

Attachment: 19436.2.patch added

Add non-regression test

comment:3 Changed 3 years ago by simon04

Resolution: fixed
Status: newclosed

In 16767/josm:

fix #19436 - RequestProcessor: do not add null objects to a JsonArray (patch by taylor.smock, modified)

comment:4 Changed 3 years ago by simon04

Milestone: 20.07

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.