Getting 'StringIndexOutOfBoundsException' When Fetching static files(.css & .woff etc)

Hi Gatling Team/Experts,

I am getting this error when gatling is trying to fetch static files like .css & .woff. Can you help me identify what’s causing this and how to fix this ?

Environment :
Operating System : macOS Catalina
Java : openjdk version “11.0.11” 2021-04-20
Gatling bundle version : 3.7.2 [ Have tried with 3.7.3 as well as 3.7.1]
Command using to execute : sh bin/gatling.sh -s <<package.JavaClassName>>

Sample Code :

import static io.gatling.javaapi.core.CoreDsl.;
import static io.gatling.javaapi.http.HttpDsl.
;
import io.gatling.javaapi.core.;
import io.gatling.javaapi.http.
;

public class StaticCss extends Simulation {

HttpProtocolBuilder httpProtocol =
http
.baseUrl(“https://static.oracle.com/cdn/jet/11.1.2/default/css/redwood/oj-redwood-min.css”)
.inferHtmlResources(AllowList(), DenyList());
// A scenario is a chain of requests and pauses
ScenarioBuilder scn =
scenario(“Scenario Name”)
.exec(http(“request_1”).get(""));

{
setUp(scn.injectOpen(atOnceUsers(1)).protocols(httpProtocol));
}
}

Error :
j.l.StringIndexOutOfBoundsException: String index out of range : 18

Let me know if you need any other details. Appreciate any inputs.

Hi,

Your https://static.oracle.com/cdn/jet/11.1.2/default/css/redwood/oj-redwood-min.css responds with a Content-Type header whose value is text/css; charset=

See the empty charset attribute?
We’re going to handle this more gracefully, but this definitely a bad value you should fix.

see https://github.com/gatling/gatling/issues/4193

Thank you very much for the quick response and the fix Stéphane Landelle. If possible please add/modify error message to be bit more specific - just in case if possible.

And until 3.7.4 is released, Is there any workaround If I don’t have control over the response header ?