Skip to content

Incorrect behavior of GHRepository.getReadme #150

@vbauer

Description

@vbauer

I've got the following error, trying to fetch README file from https://github.com/matshofman/Android-RSS-Reader-Library:

java.io.FileNotFoundException: https://api.github.com/repos/matshofman/Android-RSS-Reader-Library/contents/readme
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1834) ~[na:1.8.0_11]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) ~[na:1.8.0_11]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) ~[na:1.8.0_11]
    at org.kohsuke.github.Requester.parse(Requester.java:383) ~[github-api-1.59.jar:na]
    at org.kohsuke.github.Requester._to(Requester.java:185) ~[github-api-1.59.jar:na]
    at org.kohsuke.github.Requester.to(Requester.java:160) ~[github-api-1.59.jar:na]
    at org.kohsuke.github.GHRepository.getFileContent(GHRepository.java:917) ~[github-api-1.59.jar:na]
    at org.kohsuke.github.GHRepository.getFileContent(GHRepository.java:907) ~[github-api-1.59.jar:na]
    at org.kohsuke.github.GHRepository.getReadme(GHRepository.java:939) ~[github-api-1.59.jar:na]
    at com.android.arsenal.service.impl.ConverterServiceImpl.convertRepository(ConverterServiceImpl.java:62) ~[classes/:na]
    at com.android.arsenal.service.impl.ProcessorServiceImpl.process(ProcessorServiceImpl.java:135) ~[classes/:na]
    at com.android.arsenal.service.impl.ProcessorServiceImpl.access$100(ProcessorServiceImpl.java:33) ~[classes/:na]
    at com.android.arsenal.service.impl.ProcessorServiceImpl$2.run(ProcessorServiceImpl.java:99) ~[classes/:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_11]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_11]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_11]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_11]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_11]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_11]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_11]

The reason of this problem that readme-file was called "README.markdown" and github-api doesn't use specific Github API to fetch info about README. It just tries to download "readme" file from repository.

Additional information could be found here: https://developer.github.com/v3/repos/contents/

API call should be like this: GET /repos/:owner/:repo/readme

UPD: It will be also useful to add method getReadmHtml and use 'application/vnd.github.VERSION.html' to retrieve HTML document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions