FSchumacher commented on issue #5767:
URL: https://github.com/apache/jmeter/issues/5767#issuecomment-1407367786

   There are a few problems with the code.
   
   First, Java classes are case sensitive and are starting with an upper case 
character. So `fileReader` is not a class name. The correct class name would be 
`FileReader`. (The variable name on the left side of the equation can be left 
as it is)
   Second, you are not reading the fourth line, only. You are reading the 
complete content. You would have to add an if clause to capture the fourth 
line, only.
   Third, I would use Groovy instead of Beanshell. It supports more modern Java 
features and a lot of cool stuff on top. Plus it is probably faster than 
Beanshell most of the time.
   
   In Groovy, you could shorten this to
   ```groovy
   vars.put("content") = new File(vars.get("path")).readLines()[3]
   ```
   I used `3` for the fourth line, as the first line is at position zero.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to