提交 eab4bb6a 编写于 作者: K Kohsuke Kawaguchi

Integrated json-lib 2.4

I had to tweak UpdateSite code because JSONObject.fromObject(String)
became more strict and no longer allows extra garbage after the closing
'}'
上级 ebd8ff1f
...@@ -199,7 +199,7 @@ THE SOFTWARE. ...@@ -199,7 +199,7 @@ THE SOFTWARE.
<dependency><!-- until we get this version through Stapler --> <dependency><!-- until we get this version through Stapler -->
<groupId>org.kohsuke.stapler</groupId> <groupId>org.kohsuke.stapler</groupId>
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>
<version>2.1-rev7</version> <version>2.4-jenkins-1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-httpclient</groupId> <groupId>commons-httpclient</groupId>
......
...@@ -171,7 +171,11 @@ public class UpdateSite { ...@@ -171,7 +171,11 @@ public class UpdateSite {
String uncleanJson = IOUtils.toString(is,"UTF-8"); String uncleanJson = IOUtils.toString(is,"UTF-8");
int jsonStart = uncleanJson.indexOf("{\""); int jsonStart = uncleanJson.indexOf("{\"");
if (jsonStart >= 0) { if (jsonStart >= 0) {
return updateData(uncleanJson.substring(jsonStart), signatureCheck); uncleanJson = uncleanJson.substring(jsonStart);
int end = uncleanJson.lastIndexOf('}');
if (end>0)
uncleanJson = uncleanJson.substring(0,end+1);
return updateData(uncleanJson, signatureCheck);
} else { } else {
throw new IOException("Could not find json in content of " + throw new IOException("Could not find json in content of " +
"update center from url: "+src.toExternalForm()); "update center from url: "+src.toExternalForm());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册