https://linen.dev logo
#general
Title
# general
k

Krishna Prasad

05/27/2023, 3:27 AM
Hi, I noticed an issue when Sanitizing the recordings.. For recordings that use urlPathPatterns like the once seen below
{
"request": { "urlPathPattern": ".......", "method": "POST", "headers": { "nep-correlation-id": { "equalTo": "...." } We are seeing an NullPointerException when calling Sanitizaton.. I am seeing NPE exceptions as seen below _simulator_1 | 034029.798 [qtp2005169944-19] WARN [] org.eclipse.jetty.server.HttpChannel - /__admin/recordings/sanitizejava.lang.NullPointerException: null_ _simulator_1 | at java.net.URI$Parser.parse(URI.java:3041)_ _simulator_1 | at java.net.URI.<init>(URI.java:588)_ _simulator_1 | at java.net.URI.create(URI.java:850)_ _simulator_1 | at com.github.tomakehurst.wiremock.recording.ScenarioProcessor.putStubsInScenario(ScenarioProcessor.java:67)_ _simulator_1 | at com.github.tomakehurst.wiremock.recording.ScenarioProcessor.putRepeatedRequestsInScenarios(ScenarioProcessor.java:57)_ Looking at the code com.github.tomakehurst,wiremock.recording.ScenarioProcessor.java.. I noticed that in line 67.. we are calling
Urls.urlToPathParts(URI.create(firstScenario.getRequest().getUrl()));
I think the NPE Error could be due to the recordings using urlPathPattern instead of url. Could you please let me know if this is an issue ?
t

Tom

05/27/2023, 12:16 PM
Are you using custom extension code here? Normally the recorder doesn’t produce stubs with
urlPathPattern
so it’s not necessary to check for. If so, it might be safer to create your own logic here rather than relying on one of WireMock’s implementation classes.
2 Views