@@ -287,6 +287,13 @@ public ResponseEntity generateAndPublish(@ApiParam(value = "message protocol", r
287
287
return createResponseEntity (HttpStatus .BAD_REQUEST , JSON_FATAL_STATUS , "hohoho" );
288
288
289
289
JsonElement bodyJson = JsonParser .parseString (body );
290
+ if (!bodyJson .isJsonObject ()) {
291
+ return createResponseEntity (HttpStatus .BAD_REQUEST , JSON_FATAL_STATUS , "hohoho" );
292
+ }
293
+
294
+ if (!bodyJson .getAsJsonObject ().has ("hohoho" )) {
295
+ return createResponseEntity (HttpStatus .BAD_REQUEST , JSON_FATAL_STATUS , "hohoho" );
296
+ }
290
297
// return generateAndPublish(msgProtocol, msgType, userDomain, tag, routingKey, parseData, failIfMultipleFound,
291
298
// failIfNoneFound, lookupInExternalERs, lookupLimit, okToLeaveOutInvalidOptionalFields, bodyJson);
292
299
String mp = "aaa" ;
@@ -302,7 +309,7 @@ public ResponseEntity generateAndPublish(@ApiParam(value = "message protocol", r
302
309
boolean iof = true ;
303
310
String jb = "json" ;
304
311
return generateAndPublish (mp , mt , ud , t , rk , pd , fmf ,
305
- fnf , lee , ll , iof , jb );
312
+ fnf , lee , ll , iof , bodyJson );
306
313
} catch (JsonSyntaxException e ) {
307
314
String exceptionMessage = e .getMessage ();
308
315
log .error ("Unexpected exception caught due to parsed json data" , exceptionMessage );
0 commit comments