-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins:2.89.1
gerrit:2.14.51
Steps:
1 Stop jenkins
2 push data to gerrit repo
3 Start jenkins
Problems:
When gerrit-trigger get missed event from event-log , which is the plugin of gerrit, it parse
the json data err.
Unanticipated error when examining JSON String net.sf.json.JSONException: Found starting '{' but missing '}' at the end. at character 0 of null at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499) at net.sf.json.util.JSONTokener.<init>(JSONTokener.java:85) at net.sf.json.JSONObject._fromString(JSONObject.java:1145) at net.sf.json.JSONObject.fromObject(JSONObject.java:162) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:139) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:84) at com.sonymobile.tools.gerrit.gerritevents.GerritJsonEventFactory.getJsonObjectIfInterestingAndUsable(GerritJsonEventFactory.java:126)
Possibile reason:
gerrit trigger parse the event string use scan.getline, but in the commit message, there are "\n", so the gerrit trigger split the event string to several strings, and parse them ,which will cause error.
Ex:
part of string in event is like this: "commitMessage":"hgggggg\nchangeID:********\n
"status":"NEW"
gerrit trigger parse it like three strings
1: "commitMessage":"hgggggg
2 changeID:********
3 "status":"NEW"
this is not correct