Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46260

FileNotFoundExecption when getting info from BitBucket

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • bitbucket-oauth-plugin
    • None

    Description

      At some point our logs started to fill up with this kind of spam:

      java.io.FileNotFoundException: https://api.bitbucket.org/1.0/users/David Gegelija

      I cant pin point down what is causing it, any ideas?

      Added longer log file also

      Attachments

        Activity

          oleg_nenashev Oleg Nenashev added a comment -
          java.io.FileNotFoundException: https://api.bitbucket.org/1.0/users/Ethel Voites
          	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
          	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
          	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
          	at java.net.URL.openStream(URL.java:1045)
          	at org.jenkinsci.plugins.api.BitbucketApiService.getUserByUsername(BitbucketApiService.java:74)
          	at org.jenkinsci.plugins.BitbucketSecurityRealm.loadUserByUsername(BitbucketSecurityRealm.java:175)
          	at jenkins.security.UserDetailsCache$Retriever.call(UserDetailsCache.java:172)
          	at jenkins.security.UserDetailsCache$Retriever.call(UserDetailsCache.java:161)
          

          Nothing to do in the core. It's an issue with the Bitbucket API from what I see

           

          oleg_nenashev Oleg Nenashev added a comment - java.io.FileNotFoundException: https: //api.bitbucket.org/1.0/users/Ethel Voites at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at java.net.URL.openStream(URL.java:1045) at org.jenkinsci.plugins.api.BitbucketApiService.getUserByUsername(BitbucketApiService.java:74) at org.jenkinsci.plugins.BitbucketSecurityRealm.loadUserByUsername(BitbucketSecurityRealm.java:175) at jenkins.security.UserDetailsCache$Retriever.call(UserDetailsCache.java:172) at jenkins.security.UserDetailsCache$Retriever.call(UserDetailsCache.java:161) Nothing to do in the core. It's an issue with the Bitbucket API from what I see  
          pabloli Pavel Li added a comment - - edited

          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?

          Thank you!

          pabloli Pavel Li added a comment - - edited 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? Thank you!
          pabloli Pavel Li added a comment -

          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

           

          pabloli Pavel Li added a comment - 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  

          People

            Unassigned Unassigned
            humunuk Siim Kallari
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: