-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
The webhook class crashes if the response is malformed.
Let the webhook class connect to ncat:
- Start ncat on trydev and let it listen to 8099
ncat -l 8099
- Connect webhook to ncat
// Please fill variables
String method = "POST"
String url = "http://localhost:8099/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);
- Write a few lines into ncat
- Webhook crashes
Following exception is thrown:
[email protected];12:36:25] POST Response Code :: -1
[[email protected];12:36:25] Failed to execute task: javax.script.ScriptException: org.ow2.proactive.addons.webhook.exception.UnsuccessfulRequestException: POST Response Code :: -1
[[email protected];12:36:25] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:195)
[[email protected];12:36:25] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:134)
[[email protected];12:36:25] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.fromForkedJVM(ExecuteForkedTaskInsideNewJvm.java:88)
[[email protected];12:36:25] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.main(ExecuteForkedTaskInsideNewJvm.java:78)
[[email protected];12:36:25] Caused by: org.ow2.proactive.scripting.ScriptException: javax.script.ScriptException: org.ow2.proactive.addons.webhook.exception.UnsuccessfulRequestException: POST Response Code :: -1
[[email protected];12:36:25] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
[[email protected];12:36:25] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130)
[[email protected];12:36:25] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
[[email protected];12:36:25] at org.ow2.proactive.scripting.Script.execute(Script.java:319)
[[email protected];12:36:25] at org.ow2.proactive.scripting.ScriptHandler.handle(ScriptHandler.java:76)
[[email protected];12:36:25] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:191)
[[email protected];12:36:25] ... 3 more