Forum Discussion
Further to this, as I now have NetScan script running externally, I am now on the discovery and collector scripts so need to revisit this, as such I have looked at the client documentation and tried to build the correct response.
def logoutResponse = httpClient.delete(loginurl,cookieString,logoutheaders)
logoutResult = httpClient.getStatusCode()
if ( !(httpClient.getStatusCode() =~ /20/) )
{
//Error has occured
println "Logout Failure";
println httpClient.getStatusCode();
println loginResponse;
return(1);
}
I now get
exception:java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at com.logicmonitor.groovy.objects.BaseWrapper.invoke(BaseWrapper.java:124)
at com.logicmonitor.groovy.objects.lang.ScriptWrapper.run(ScriptWrapper.java:31)
at com.santaba.agent.groovy.executor.GroovyScriptShell.execute(GroovyScriptShell.java:71)
at com.santaba.agent.util.GroovyScriptExecutor.execute(GroovyScriptExecutor.java:148)
at com.santaba.agent.debugger.GroovyTask._executeInAgent(GroovyTask.java:210)
at com.santaba.agent.debugger.GroovyTask._handle(GroovyTask.java:189)
at com.santaba.agent.debugger.DebugTask.run(DebugTask.java:176)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
at com.santaba.agent.groovyapi.http.Client._processResponse(Client.java:580)
at com.santaba.agent.groovyapi.http.Client.request(Client.java:429)
at com.santaba.agent.groovyapi.http.Client.delete(Client.java:409)
at com.santaba.agent.groovyapi.http.Client$delete$5.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:144)
at Script660.run(Script660.groovy:96)
at jdk.internal.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.logicmonitor.groovy.objects.BaseWrapper.invoke(BaseWrapper.java:118)
... 9 more
The issue here is that there is no content in the delete as it is the cookie you are deleting, I have a workaround in reducing the time the session is open, however this could end up with multiple sessions open on the end point unnecessarily until they time out.