Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 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 4 years ago.
19436.1.patch (655 bytes ) - added by taylor.smock 4 years ago.
Prepend / to commands, if it doesn't exist
19436.2.patch (2.2 KB ) - added by taylor.smock 4 years ago.
Add non-regression test

Download all attachments as: .zip

Change History (7)

by taylor.smock, 4 years ago

Attachment: 19436.patch added

comment:1 by taylor.smock, 4 years ago

Cc: simon04 added
Description: modified (diff)

comment:2 by taylor.smock, 4 years ago

Component: CoreCore remotecontrol
Description: modified (diff)

by taylor.smock, 4 years ago

Attachment: 19436.1.patch added

Prepend / to commands, if it doesn't exist

by taylor.smock, 4 years ago

Attachment: 19436.2.patch added

Add non-regression test

comment:3 by simon04, 4 years ago

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 by simon04, 4 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.