apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.1k stars 2.06k forks source link

java.nio.charset.MalformedInputException: Input length = 1 by import groovy script #5477

Open asfimport opened 3 years ago

asfimport commented 3 years ago

DanP (Bug 65039): When I import a groovy script with umlauts in comments and strings, I get the following error message. In version 5.3 everything was still OK.

for example: // work in progress --> statusDe":"Beschäftigt","akt":34,"status":20 ...

error message

2020-12-29 11:20:23,500 ERROR o.a.j.e.JSR223PostProcessor: Problem in JSR223 script, ExtractRepeatQuery javax.script.ScriptException: java.nio.charset.MalformedInputException: Input length = 1 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.readFully(GroovyScriptEngineImpl.java:458) ~[groovy-jsr223-3.0.5.jar:3.0.5] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:188) ~[groovy-jsr223-3.0.5.jar:3.0.5] at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:186) ~[ApacheJMeter_core.jar:5.4] at org.apache.jmeter.extractor.JSR223PostProcessor.process(JSR223PostProcessor.java:45) [ApacheJMeter_components.jar:5.4] at org.apache.jmeter.threads.JMeterThread.runPostProcessors(JMeterThread.java:952) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:573) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:?] at java.lang.Thread.run(Thread.java:832) [?:?] Caused by: java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:274) ~[?:?] at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:352) ~[?:?] at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188) ~[?:?] at java.io.InputStreamReader.read(InputStreamReader.java:181) ~[?:?] at java.io.BufferedReader.read1(BufferedReader.java:210) ~[?:?] at java.io.BufferedReader.read(BufferedReader.java:287) ~[?:?] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.readFully(GroovyScriptEngineImpl.java:454) ~[groovy-jsr223-3.0.5.jar:3.0.5] ... 8 more

Severity: normal OS: All

asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Regression caused by 80c39149ef977f87ee03cddb0b99a21629126ce5

asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Can you tell us, what encoding your files are in and what language setting your setup has? (On linux this would be the values of LANG, LC_ALL and co.)

asfimport commented 3 years ago

DanP (migrated from Bugzilla): Hi there, the encoding of the scripts is UTF-8 and the language setting of the PC is German.

asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Which OS?

Can you attach a minimal test-plan with a minimal groovy script, that triggers the issue?

I tried a small script with Linux (utf-8 encoded) running with LANG=de_DE.utf-8 and had no problems.

asfimport commented 3 years ago

DanP (migrated from Bugzilla): a small test as an attachment

Created attachment TestGroovy.zip: a little test

asfimport commented 3 years ago

@FSchumacher (migrated from Bugzilla): Are you sure, that your groovy script is utf-8? When I unzipped it, I got the following encodings:

$ file * TestGroovyFailed.groovy: ISO-8859 text, with CRLF line terminators TestGroovy.jmx: XML 1.0 document, ASCII text

asfimport commented 3 years ago

DanP (migrated from Bugzilla): Yes it is right.

asfimport commented 2 years ago

@FSchumacher (migrated from Bugzilla): "it is right" means a) the script is in iso-8859 and therefore has the wrong encoding b) the script is in utf-8 and the attached zip is wrong

Please choose one and report back.

If no feedback is given, we will close this bug, as it is most likely explained by a wrong encoding of the script.