Fail to get updates from http://updates.jenkins-ci.org/update-center.json

758 views
Skip to first unread message

Manuel Holzleitner

unread,
Dec 4, 2015, 4:39:43 AM12/4/15
to Jenkins Developers
Hello,

I get the plugin infos by retrieving the http://updates.jenkins-ci.org/update-center.json file and downloading it to /var/lib/jenkins/updates/default.json.
However, this does not work anymore as I get a parse exception now:
Dec 04, 2015 9:28:46 AM SEVERE hudson.model.UpdateSite getJSONObject
Failed to parse /var/lib/jenkins/updates/default.json
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of updateCenter.post(

It seems that http://updates.jenkins-ci.org/update-center.json (which resolves to http://jenkins.mirror.isppower.de/updates/current/update-center.json for me) is not a valid JSON as it contains a "updateCenter.post(" string at the beginning.

Kind Regards,
Manuel

Manuel Holzleitner

unread,
Dec 4, 2015, 4:45:21 AM12/4/15
to Jenkins Developers
Sorry, I missed to pipe the file through sed '1d;$d' to remove the non-Json lines at the beginning and at the end of the file

Richard Bywater

unread,
Dec 4, 2015, 4:48:45 AM12/4/15
to Jenkins Developers
Just taking a look at that file I'm surprised its like that - is it documented why it advertises itself as JSON but actually isn't? Breaks all the rules :)

Richard.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5b0c1a44-6d17-4cb1-9f64-711d0031ee7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Dec 4, 2015, 11:04:39 AM12/4/15
to Jenkins Dev
On Fri, Dec 4, 2015 at 4:48 AM, Richard Bywater <ric...@byh2o.com> wrote:
> is it documented why it advertises itself as JSON but actually isn't?

It is JSONP. Yes it should have been named `update-center.js` to
match, but existing Jenkins installations expect JSONP from this URL
so it is too late to change it.

(BTW the use of JSONP is actually doubly obsolete. First we deprecated
that URL; `update-center.json.html` is an HTML wrapper using
`window.postback`, the more modern way of doing this. Then we stopped
downloading UC content from the browser by default anyway—now unless
you configure otherwise, the Jenkins master does the download, and
just strips out the JSONP header and footer. Ideally we would
introduce a *third* URL that was actually JSON, for use with current
releases, but all the moving parts in various implementations of the
update center backend make this a painful task.)

Richard Bywater

unread,
Dec 4, 2015, 4:04:39 PM12/4/15
to Jenkins Dev

Can I suggest we change the content type to application/javascript then at least so at least one part is correct? :) (if it doesn't break anything obviously)

Richard


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Christoph Obexer

unread,
Dec 5, 2015, 3:00:27 PM12/5/15
to Jenkins Developers
In case anyone considers working on this please also consider https://issues.jenkins-ci.org/browse/JENKINS-26231 :)

Thanks! Br,
Christoph
Reply all
Reply to author
Forward
0 new messages