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

GHssue.listComments() throws NullPointer from search result - owner not set #708

Closed
maxandersen opened this issue Feb 21, 2020 · 0 comments · Fixed by #709
Closed

GHssue.listComments() throws NullPointer from search result - owner not set #708

maxandersen opened this issue Feb 21, 2020 · 0 comments · Fixed by #709
Labels

Comments

@maxandersen
Copy link

maxandersen commented Feb 21, 2020

Describe the bug

//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS info.picocli:picocli:4.2.0
//DEPS org.kohsuke:github-api:1.101

import static java.lang.System.out;
import static java.util.Arrays.*;
import org.kohsuke.github.*;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;

import java.util.concurrent.Callable;

@Command(name = "fetchpub", mixinStandardHelpOptions = true, version = "fetchpub 0.1",
        description = "fetchpub made with jbang")
class fetchpub implements Callable<Integer> {

    @Parameters(index = "0", description = "The greeting to print", defaultValue = "World!")
    private String greeting;

    public static void main(String... args) {
        int exitCode = new CommandLine(new fetchpub()).execute(args);
        System.exit(exitCode);
    }

    @Override
    public Integer call() throws Exception { // your business logic goes here...
        GitHub github = GitHub.connectAnonymously();

        var ghRepo = github.getRepository("quarkusio/quarkus");

        var list = github.searchIssues().isOpen().q("repo:quarkusio/quarkusio.github.io").q("label:publication").list().asList();

        for(GHIssue issue:list) {
            out.println(issue.getTitle());
            out.println(issue.listComments().iterator().next());

        }
        return 0;
    }
}

run this and you get:

[jbang] Building jar...
warning: Supported source version 'RELEASE_6' from annotation processor 'org.jvnet.hudson.annotation_indexer.AnnotationProcessorImpl' less than -source '11'
1 warning
Add Alexa skill with Quarkus - mirko bonasorte - Medium to Publications
java.lang.NullPointerException
	at org.kohsuke.github.GHIssue.getIssuesApiRoute(GHIssue.java:562)
	at org.kohsuke.github.GHIssue.listComments(GHIssue.java:446)
	at fetchpub.call(fetchpub.java:37)
	at fetchpub.call(fetchpub.java:15)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1783)
	at picocli.CommandLine.access$900(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2150)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2144)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975)
	at picocli.CommandLine.execute(CommandLine.java:1904)
	at fetchpub.main(fetchpub.java:23)

for some reason issue.owner is not set when comes from an issue query.

@bitwiseman bitwiseman added the bug label Feb 21, 2020
@bitwiseman bitwiseman changed the title geting issue comments from a search result results in NullPointer as owner not set GHssue.listComments() throws NullPointer from search result - owner not set Feb 22, 2020
bitwiseman added a commit to bitwiseman/github-api that referenced this issue Feb 22, 2020
User reported hub4j#708 which made me realize that search tests were basically all disabled.
This terms on two basic search tests and also makes it so GHIssue can continue to work without
a GHRepository set on it.

Fixes hub4j#708
bitwiseman added a commit to bitwiseman/github-api that referenced this issue Feb 22, 2020
User reported hub4j#708 which made me realize that search tests were basically all disabled.
This terms on two basic search tests and also makes it so GHIssue can continue to work without
a GHRepository set on it.

Fixes hub4j#708
bitwiseman added a commit to bitwiseman/github-api that referenced this issue Feb 22, 2020
User reported hub4j#708 which made me realize that search tests were basically all disabled.
This terms on two basic search tests and also makes it so GHIssue can continue to work without
a GHRepository set on it.

Fixes hub4j#708
bitwiseman added a commit to bitwiseman/github-api that referenced this issue Feb 23, 2020
User reported hub4j#708 which made me realize that search tests were basically all disabled.
This terms on two basic search tests and also makes it so GHIssue can continue to work without
a GHRepository set on it.

Fixes hub4j#708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants