Hi Guys,


I have been writing a Groovy extension to support a P4 (Perforce) Object. 
 The serialization seems ok when running remotely on slaves for normal use. 
 However, I noticed an error in my unit tests when I wrap the job with 
assertBuildStatusSuccess(job.scheduleBuild2(0)).  


@Test
public void testP4GroovyConnectAndSync() throws Exception {

  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, 
"p4groovy");

  job.setDefinition(new CpsFlowDefinition("" + "node() {\n"

    + "   ws = [$class: 'StreamWorkspaceImpl', charset: 'none', format: 
'jenkins-${NODE_NAME}-${JOB_NAME}', pinHost: false, streamName: 
'//stream/main']\n"

    + "   p4 = p4(credential: '" + auth.getId() + "', workspace: ws)\n"

    + "   p4.run('sync', '//...')\n"

    + "}"));

  job.save();

  WorkflowRun run = jenkins.assertBuildStatusSuccess(job.scheduleBuild2(0));

  jenkins.assertLogContains("p4 sync //...", run);

  jenkins.assertLogContains("totalFileCount 10", run);

}


The 'p4' Groovy object uses a String, a Workspace (made up of other 
Strings, ints and booleans) and a TaskListener.  I have double checked the 
Serialization of Workspace, perhaps TaskListener is the issue? The error 
sort of suggests that...


Aug 31, 2016 1:06:28 PM org.jenkinsci.plugins.workflow.cps.CpsThreadGroup 
saveProgram

WARNING: program state save failed

java.lang.NullPointerException

at hudson.remoting.RemoteOutputStream.writeObject(RemoteOutputStream.java:82
)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(
SerializableClass.java:271)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:976)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(
BlockMarshaller.java:65)

at org.jboss.marshalling.river.BlockMarshaller.writeObject(
BlockMarshaller.java:56)

at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(
MarshallerObjectOutputStream.java:50)

at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(
RiverObjectOutputStream.java:179)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)

at hudson.util.StreamTaskListener.writeObject(StreamTaskListener.java:161)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(
SerializableClass.java:271)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:976)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(
RiverMarshaller.java:1032)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:988)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(
BlockMarshaller.java:65)

at org.jboss.marshalling.river.BlockMarshaller.writeObject(
BlockMarshaller.java:56)

at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(
MarshallerObjectOutputStream.java:50)

at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(
RiverObjectOutputStream.java:179)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)

at java.util.HashMap.writeObject(HashMap.java:1129)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(
SerializableClass.java:271)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:976)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:967)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(
BlockMarshaller.java:65)

at org.jboss.marshalling.river.BlockMarshaller.writeObject(
BlockMarshaller.java:56)

at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(
MarshallerObjectOutputStream.java:50)

at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(
RiverObjectOutputStream.java:179)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)

at com.cloudbees.groovy.cps.SerializableScript.writeObject(
SerializableScript.java:26)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(
SerializableClass.java:271)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:976)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:967)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:967)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(
RiverMarshaller.java:1032)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:988)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:967)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(
BlockMarshaller.java:65)

at org.jboss.marshalling.river.BlockMarshaller.writeObject(
BlockMarshaller.java:56)

at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(
MarshallerObjectOutputStream.java:50)

at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(
RiverObjectOutputStream.java:179)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)

at java.util.HashMap.writeObject(HashMap.java:1129)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(
SerializableClass.java:271)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:976)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(
RiverMarshaller.java:1032)

at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(
RiverMarshaller.java:988)

at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(
RiverMarshaller.java:854)

at org.jboss.marshalling.AbstractObjectOutput.writeObject(
AbstractObjectOutput.java:58)

at org.jboss.marshalling.AbstractMarshaller.writeObject(
AbstractMarshaller.java:111)

at 
org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(
RiverWriter.java:133)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(
CpsThreadGroup.java:341)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(
CpsThreadGroup.java:325)

at org.jenkinsci.plugins.workflow.cps.CpsStepContext$3.onSuccess(
CpsStepContext.java:469)

at org.jenkinsci.plugins.workflow.cps.CpsStepContext$3.onSuccess(
CpsStepContext.java:465)

at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(
CpsFlowExecution.java:519)

at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(
CpsVmExecutorService.java:32)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at hudson.remoting.SingleLaneExecutorService$1.run(
SingleLaneExecutorService.java:111)

at jenkins.util.ContextResettingExecutorService$1.run(
ContextResettingExecutorService.java:28)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

Caused by: an exception which occurred:

in field listener

in field delegate

in field closures

in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@229a0711


Aug 31, 2016 1:06:28 PM org.jenkinsci.plugins.workflow.job.WorkflowRun 
finish

INFO: p4groovy #1 completed: SUCCESS

Aug 31, 2016 1:06:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper 
<init>

INFO: (p4):cmd:... p4 info




Sorry I don't have any more info to share at this point.  Any help or 
suggestions would be great.


Kind regards,

Paul


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/24f15e91-56a6-47b5-b6bc-fc3639b3637a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to