Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository size field does not support long values. #13

Closed
4 tasks done
stil4m opened this issue Jan 26, 2022 · 1 comment · Fixed by #14
Closed
4 tasks done

Repository size field does not support long values. #13

stil4m opened this issue Jan 26, 2022 · 1 comment · Fixed by #14
Labels
bug Something isn't working

Comments

@stil4m
Copy link
Contributor

stil4m commented Jan 26, 2022

If retrieving repositories with where the size of the repository is rather large, then the JSON object mapping fails with the following exception:

Exception in thread "main" org.azd.exceptions.AzDException: ApiResponseParsingException: Numeric value (39027429139) out of range of int (-2147483648 - 2147483647)
 at [Source: (StringReader); line: 1, column: 261214] (through reference chain: org.azd.git.types.Repositories["value"]->java.util.ArrayList[270]->org.azd.git.types.Repository["size"])

Steps to reproduce

Run the following Java code:

public class Example {

    public static void main(String[] args) throws AzDException {
        var organisation = "<my org>";
        var personalAccessToken = "<access code>";
        var webApi = new AzDClientApi(organisation, personalAccessToken);
        var core = webApi.getCoreApi();
        System.out.println(webApi.getGitApi().getRepositories());
    }
}

Have a large Git repository. For example the following JSON response on the repositories API:

{
  "value": [
    ...
    {
      "id": "<private>",
      "name": "<private>",
      "url": "<private>",
      "project": {
        ...
      },
      "size": 39027429139,
      ...
    }
    ...
  ]
}

Expected behavior

Status code 0

Actual behavior

Exception was raised by `JsonMapper`

Information Checklist

Kindly make sure that you have added all the following information above and checkoff the required fields
otherwise the issue template will be treated as an incomplete report.

  • Bug Description Added
  • Reproduce Steps Added
  • Expected Behaviour Added
  • Actual Behaviour Added
stil4m added a commit to stil4m/azure-devops-java-sdk that referenced this issue Jan 26, 2022
@hkarthik7 hkarthik7 added the bug Something isn't working label Jan 27, 2022
@hkarthik7 hkarthik7 linked a pull request Jan 27, 2022 that will close this issue
3 tasks
@hkarthik7
Copy link
Owner

@stil4m thanks for pointing this out and for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants