Skip to content

header json cannot be empty #1

@tobwiens

Description

@tobwiens

Following code executes the web-hook

// Please fill variables
String method = "POST"
String url = "http://localhost:8080/notification-service/notifications"
String headers = "{}" //Example: "{key0 = value0, key1 = value1, ...}"
String content = "{\n" +
"\"date\": \"2016-08-17T08:30:22.862Z\" \n" +
"\"description\": \"some description\",\n" +
"\"notificationId\": 0\n" +
"}"

// Don't change code below
import org.ow2.proactive.addons.webhook.Webhook;
Webhook.execute ( method, url, headers, content);

Following error occurs:

[email protected];12:16:06] Failed to execute task: javax.script.ScriptException: java.lang.ArrayIndexOutOfBoundsException: 1 
[[email protected];12:16:06] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:195) 
[[email protected];12:16:06] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:134) 
[[email protected];12:16:06] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.fromForkedJVM(ExecuteForkedTaskInsideNewJvm.java:88) 
[[email protected];12:16:06] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.main(ExecuteForkedTaskInsideNewJvm.java:78) 
[[email protected];12:16:06] Caused by: org.ow2.proactive.scripting.ScriptException: javax.script.ScriptException: java.lang.ArrayIndexOutOfBoundsException: 1 
[[email protected];12:16:06] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159) 
[[email protected];12:16:06] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130) 
[[email protected];12:16:06] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249) 
[[email protected];12:16:06] at org.ow2.proactive.scripting.Script.execute(Script.java:319) 
[[email protected];12:16:06] at org.ow2.proactive.scripting.ScriptHandler.handle(ScriptHandler.java:76) 
[[email protected];12:16:06] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:191) 
[[email protected];12:16:06] ... 3 more 

Filling the header with one value, and the exception disappears.

Example code:

// Please fill variables
String method = "POST"
String url = "http://localhost:8080/notification-service/notifications"
String headers = "{key0 = value0}" //Example: "{key0 = value0, key1 = value1, ...}"
String content = "{\n" +
"\"date\": \"2016-08-17T08:30:22.862Z\" \n" +
"\"description\": \"some description\",\n" +
"\"notificationId\": 0\n" +
"}"

// Don't change code below
import org.ow2.proactive.addons.webhook.Webhook;
Webhook.execute ( method, url, headers, content);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions