[JIRA] (JENKINS-46260) FileNotFoundExecption when getting info from BitBucket

10 views
Skip to first unread message

pablol@mail.ru (JIRA)

unread,
Feb 12, 2020, 10:24:08 AM2/12/20
to jenkinsc...@googlegroups.com
Pavel Li commented on Bug JENKINS-46260
 
Re: FileNotFoundExecption when getting info from BitBucket

I've also started to experience this issue in logs with Bitbucket OAuth plugin with Role Based plugin. And in newer version with Bitbucket API 2.0:

 

java.io.FileNotFoundException: https://api.bitbucket.org/2.0/users/John Doe at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)

 

I've checked with direct call to API with similar request, it gives following response:

 

{"type""error",    "error": {        "message""John Doe"    }}

The problem is that it isn't actual user id which is expected by API.

If I use correct user id, i.e. jdoe, it works fine.

So, something works incorrectly and sends wrong requests to Bitbucket API.

Could someone advise where to go with this issue? What would be the right direction if it is not in core?

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

pablol@mail.ru (JIRA)

unread,
Feb 12, 2020, 10:25:03 AM2/12/20
to jenkinsc...@googlegroups.com
Pavel Li edited a comment on Bug JENKINS-46260
I've also started to experience this issue in logs with Bitbucket OAuth plugin with Role Based plugin. And in newer version with Bitbucket API 2.0:

 
{code:java}

java.io.FileNotFoundException: https://api.bitbucket.org/2.0/users/John Doe at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
{code}
 

I've checked with direct call to API with similar request, it gives following response:

 
{code:java}

{"type": "error",    "error": {        "message": "John Doe"    }}
{code}

The problem is that it isn't actual user id which is expected by API.

If I use correct user id, i.e. _jdoe_, it works fine.


So, something works incorrectly and sends wrong requests to Bitbucket API.

Could someone advise where to go with this issue? What would be the right direction if it is not in core?

  Thank you!

pablol@mail.ru (JIRA)

unread,
Feb 12, 2020, 11:59:02 AM2/12/20
to jenkinsc...@googlegroups.com
Pavel Li commented on Bug JENKINS-46260

I've tried to look at the Bitbucket OAuth code. Here is the part that causes the error:
 

...
public UserDetails getUserByUsername(String username) { 
    InputStreamReaderreader = null; 
    UserDetailsuserResponce = null; 
    try { 
        URLurl = newURL(API2_ENDPOINT + "users/" + username);
...

And as far as I understood the username is provided by Jenksins Core

https://javadoc.jenkins.io/hudson/security/SecurityRealm.html 

So, it could be that username is provided in a wrong form, or plugin uses it incorrectly...

But I'm null in Java, so all the above could be completely wrong

 

Reply all
Reply to author
Forward
0 new messages