JSONPath throws exception when response has status 204

Hi!

When the response of a request has status 204 (ie: No Content), a JSON Path check throws the following exception:

12:18:56.145 [INFO ] c.e.e.g.h.a.HttpRequestAction - Sending Request ‘Get update information’: Scenario ‘Functionnal Tests’, UserId #1
[ERROR] [01/25/2013 12:18:56.164] [GatlingSystem-akka.actor.default-dispatcher-7] [akka://GatlingSystem/user/$c/$a] No content to map due to end-of-input
at [Source: [B@7db06a21; line: 1, column: 1]
com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
at [Source: [B@7db06a21; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:2840)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2782)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2012)
at com.excilys.ebi.gatling.core.check.extractor.jsonpath.JsonPathExtractor.(JsonPathExtractor.scala:46)
at com.excilys.ebi.gatling.http.check.body.HttpBodyJsonPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyJsonPathCheckBuilder$$getCachedExtractor$1.apply(HttpBodyJsonPathCheckBuilder.scala:30)
at com.excilys.ebi.gatling.http.check.body.HttpBodyJsonPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyJsonPathCheckBuilder$$getCachedExtractor$1.apply(HttpBodyJsonPathCheckBuilder.scala:30)
at com.excilys.ebi.gatling.core.check.CheckContext$$anonfun$getOrUpdateCheckContextAttribute$1.apply(CheckContext.scala:59)
at scala.Option.getOrElse(Option.scala:108)
at com.excilys.ebi.gatling.core.check.CheckContext$.getOrUpdateCheckContextAttribute(CheckContext.scala:58)
at com.excilys.ebi.gatling.http.check.body.HttpBodyJsonPathCheckBuilder$.com$excilys$ebi$gatling$http$check$body$HttpBodyJsonPathCheckBuilder$$getCachedExtractor(HttpBodyJsonPathCheckBuilder.scala:30)
at com.excilys.ebi.gatling.http.check.body.HttpBodyJsonPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyJsonPathCheckBuilder$$findExtractorFactory$1.apply(HttpBodyJsonPathCheckBuilder.scala:32)
at com.excilys.ebi.gatling.http.check.body.HttpBodyJsonPathCheckBuilder$$anonfun$com$excilys$ebi$gatling$http$check$body$HttpBodyJsonPathCheckBuilder$$findExtractorFactory$1.apply(HttpBodyJsonPathCheckBuilder.scala:32)
at com.excilys.ebi.gatling.core.check.MatcherCheckBuilder$$anon$2.apply(CheckBuilder.scala:108)
at com.excilys.ebi.gatling.core.check.MatcherCheckBuilder$$anon$2.apply(CheckBuilder.scala:105)
at com.excilys.ebi.gatling.core.check.Check.apply(Check.scala:65)
at com.excilys.ebi.gatling.core.check.Check$.applyChecksRec$1(Check.scala:41)
at com.excilys.ebi.gatling.core.check.Check$$anonfun$applyChecks$1.apply(Check.scala:50)
at com.excilys.ebi.gatling.core.check.Check$$anonfun$applyChecks$1.apply(Check.scala:50)
at com.excilys.ebi.gatling.core.check.CheckContext$.useCheckContext(CheckContext.scala:41)
at com.excilys.ebi.gatling.core.check.Check$.applyChecks(Check.scala:49)
at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.checkPhasesRec$1(GatlingAsyncHandlerActor.scala:222)
at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.com$excilys$ebi$gatling$http$ahc$GatlingAsyncHandlerActor$$processResponse(GatlingAsyncHandlerActor.scala:234)
at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:108)
at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:84)
at akka.actor.Actor$class.apply(Actor.scala:318)
at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.apply(GatlingAsyncHandlerActor.scala:70)
at akka.actor.ActorCell.invoke(ActorCell.scala:626)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197)
at akka.dispatch.Mailbox.run(Mailbox.scala:179)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

I’ll try to have a look at it, but I just wanted to know if someone else can reproduce or if this is a problem with my server :slight_smile:

Cheers,

I was able to reproduce and it comes from Gatling : when your request gets a 204 as a response, the response body is empty but we don’t check for that before building the check.
Some of the libs used for checks handles nicely an empty input, some others don’t and throw an exception,like Jackson (jsonPath) or Xerces (XPath).

A fix should be available shortly, stay tuned.

Cheers,

Pierre

Hi Pierre,

Yep, I’ve found what was the problem, tried to fix it, but didn’t have time :confused:

Thanks ! :slight_smile:

I forgot to mention it, but it’s fixed, you can grab a snapshot should you need it (the fix has been backported to 1.4.X branch, so a 2.0 or 1.4.3 snapshot will do).

Cheers,

Pierre