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

NullPointerException in com.cdancy.jenkins.rest.domain.queue.AutoValue_Task.<init>(AutoValue_Task.java:18) #143

Closed
matthew-bovolotto opened this issue Feb 17, 2021 · 4 comments · Fixed by #144
Assignees
Milestone

Comments

@matthew-bovolotto
Copy link

Current Behavior

When calling:

final List<QueueItem> queueItems = client.api().queueApi().queue();

This exception is sometimes thrown:

Caused by: java.lang.NullPointerException: Null url
        at com.cdancy.jenkins.rest.domain.queue.AutoValue_Task.<init>(AutoValue_Task.java:18)
        at com.cdancy.jenkins.rest.domain.queue.Task.create(Task.java:38)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.google.common.reflect.Invokable$MethodInvokable.invokeInternal(Invokable.java:208)
        at com.google.common.reflect.Invokable.invoke(Invokable.java:102)
        at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.newInstance(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:227)
        at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:207)
        at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$ParameterReader.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:275)
        at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:187)
        at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.readAndBuild(NullFilteringTypeAdapterFactories.java:96)
        at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.read(NullFilteringTypeAdapterFactories.java:84)
        at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.read(NullFilteringTypeAdapterFactories.java:63)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        at org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:80)
        at org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:44)
        at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
        at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
        at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
        at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
        at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:86)
        at com.sun.proxy.$Proxy136.queue(Unknown Source)

Context

Causes application crash, unable to access queue information.

Steps to Reproduce (for bugs)

Seems to be inconsistent from Jenkins, captured HTTP packet:

 {
    "_class": "hudson.model.Queue",
    "discoverableItems": [],
    "items": [{
            "_class": "hudson.model.Queue$BuildableItem",
            "actions": [],
            "blocked": false,
            "buildable": true,
            "id": 3549,
            "inQueueSince": 1613541614644,
            "params": "",
            "stuck": true,
            "task": {
                "_class": "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
            },
            "url": "queue/item/3549/",
            "why": "There are no nodes with the label [0xe2][0x80][0x98]lsf[0xe2][0x80][0x99]",
            "buildableStartMilliseconds": 1613541614649,
            "pending": false
        }
    ]
}

Seems to be the same issue encountered in: #136

Your Environment

  • Version 0.0.28 of jenkins-rest
  • Java 11
@cdancy
Copy link
Owner

cdancy commented Feb 17, 2021

Interesting .... yeah very similar in that the data being returned is just not complete. Let me spin up a quick fix for this.

martinda added a commit to martinda/cdancy-jenkins-rest that referenced this issue Feb 18, 2021
@matthew-bovolotto
Copy link
Author

Thanks @cdancy for taking such a quick look at this! Thanks @martinda for providing a patch PR so quickly!

In case anyone is interested the cause in Jenkins returning null/non-existent values seems to be related to jobs hanging in the queue for extended periods of time (jobs where hanging on finding a remote agent).

cdancy added a commit that referenced this issue Feb 18, 2021
@cdancy cdancy linked a pull request Feb 18, 2021 that will close this issue
@cdancy cdancy added this to the v0.0.29 milestone Feb 18, 2021
@cdancy
Copy link
Owner

cdancy commented Feb 18, 2021

Merged. I'll kick a release shortly.

@cdancy
Copy link
Owner

cdancy commented Feb 18, 2021

v0.0.29 has been released.

@cdancy cdancy closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants