Bug 65039

Summary: java.nio.charset.MalformedInputException: Input length = 1 by import groovy script
Product: JMeter Reporter: DanP <dan.paesler>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: NEEDINFO ---    
Severity: normal    
Priority: P2    
Version: 5.4   
Target Milestone: JMETER 5.4.1   
Hardware: PC   
OS: All   
Attachments: a little test

Description DanP 2020-12-29 10:51:53 UTC
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
Comment 1 Felix Schumacher 2020-12-29 11:15:09 UTC
Regression caused by 80c39149ef977f87ee03cddb0b99a21629126ce5
Comment 2 Felix Schumacher 2020-12-29 11:43:37 UTC
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.)
Comment 3 DanP 2020-12-29 12:13:20 UTC
Hi there,
the encoding of the scripts is UTF-8 and the language setting of the PC is German.
Comment 4 Felix Schumacher 2020-12-29 13:16:23 UTC
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.
Comment 5 DanP 2020-12-29 13:33:25 UTC
Created attachment 37666 [details]
a little test

a small test as an attachment
Comment 6 Felix Schumacher 2020-12-29 19:21:28 UTC
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
Comment 7 DanP 2020-12-30 05:20:07 UTC
Yes it is right.