ghProjectCard.content.repository is null
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
Try to call getRepository
on an issue instantiated from a getContent
call on a GHProjectCard
throws an NPE.
val gitHub = GitHubBuilder.fromPropertyFile().build()
println(gitHub.myself)
val project = gitHub.getOrganization(organization).listProjects().single { it.number == projectNumber }
val issues = project.listColumns().flatMap { ghProjectColumn ->
println("Scanning column: ${ghProjectColumn.name}")
ghProjectColumn.listCards().mapNotNull { ghProjectCard ->
ghProjectCard.content?.run {
SecurityBoardIssue(
title = title,
dateCreated = createdAt,
column = ghProjectColumn.name,
repository = repository.name // throws NPE
)
}
}
}
Expected behavior
Should be able to determine the repository that a project card originates from.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
github-api - Bountysource
gitHub.getRepository(ghContent.getOwner().getFullName()).getStargazersCount()); returns the proper count. Probably related to #349 and #1068. Expected behavior
Read more >java - spring boot Cannot invoke Repository because ...
You are trying to inject the field customerRepository using Autowired annotation, but your class is not injectable.
Read more >1. Working with Spring Data Repositories
The CrudRepository provides sophisticated CRUD functionality for the entity class that is being managed. Example 1.1. CrudRepository interface. public interface ...
Read more >Oracle ATG Web Commerce - IS NULL
An IS NULL query can determine whether an expression evaluates to null. For example: phoneNumber IS NULL ... SQL Repository Architecture.
Read more >Spring Data JPA and Null Parameters - Baeldung
We can add more query methods to our repository. For example, to ignore email, we can add a method that only accepts name:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is still there.
root
streamlining did not fix this. @JLLeitschuh Great analysis. Thanks.@JLLeitschuh Here’s the getContent() method: https://github.com/hub4j/github-api/blob/2dc736ab2135bc200903f4bae887ac137c9cfc13/src/main/java/org/kohsuke/github/GHProjectCard.java#L124-L136
GHPullRequest
extendsGHIssue
so the we only need to changeGHIssue.getRepository()
. https://github.com/hub4j/github-api/blob/2dc736ab2135bc200903f4bae887ac137c9cfc13/src/main/java/org/kohsuke/github/GHIssue.java#L87-L90Add a null check. If null, get the URL for this item
this.getUrl()
, truncate it to get the repository url, and retrieve the repository using that url. Does that make sense?Rough example: