Bug 63037 - CSVRead function cannot open relative files under script directory
Summary: CSVRead function cannot open relative files under script directory
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.13
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.1
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2018-12-24 08:34 UTC by ChongYuan Yin
Modified: 2019-01-04 19:43 UTC (History)
1 user (show)



Attachments
Use FileServer to resolve files (3.17 KB, patch)
2018-12-24 11:20 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ChongYuan Yin 2018-12-24 08:34:28 UTC
Steps to Reproduce:
1. open JMeter Gui, create a script.
2. In the script, use CSVRead function, with a relative file path, e.g. abc.csv
3. Put the file abc.csv under the same directory as the script.
4. Run the script, there will be a warning message shows in the LogView: o.a.j.f.FileRowColContainer: java.nio.file.NoSuchFileException: abc.txt

It seems CSVRead function only recognizes relative file under the installation directory for JMeter. It should be more reasonable to recognize relative file under the script directory.
Comment 1 Felix Schumacher 2018-12-24 11:20:06 UTC
Created attachment 36349 [details]
Use FileServer to resolve files

CSVRead didn't use the FileServer to resolve filenames. The attached patch changes that.
Comment 2 Felix Schumacher 2018-12-24 13:15:44 UTC
Thanks for your report. This will be included in version 5.1.

It would be nice, if you could test the next nightly and report back, whether the fix really helps you.

Date: Mon Dec 24 13:13:31 2018
New Revision: 1849687

URL: http://svn.apache.org/viewvc?rev=1849687&view=rev
Log:
When using CSVRead search the script base path for files, too.

Bugzilla Id: 63037

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
    jmeter/trunk/xdocs/changes.xml
Comment 3 ChongYuan Yin 2018-12-25 07:52:31 UTC
Tried the latest nightly build, the exception is no longer there.

Thanks.
Comment 4 Philippe Mouawad 2018-12-28 07:24:19 UTC
Nightly build failures:
1) testColumns(org.apache.jmeter.functions.TestFileRowColContainer)
     [java] java.lang.NullPointerException
     [java] 	at org.apache.jmeter.services.FileServer$FileEntry.access$200(FileServer.java:534)
     [java] 	at org.apache.jmeter.services.FileServer.getResolvedFile(FileServer.java:531)
     [java] 	at org.apache.jmeter.functions.FileRowColContainer.load(FileRowColContainer.java:78)
     [java] 	at org.apache.jmeter.functions.FileRowColContainer.<init>(FileRowColContainer.java:73)
     [java] 	at org.apache.jmeter.functions.TestFileRowColContainer.testColumns(TestFileRowColContainer.java:91)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java] 	at java.lang.reflect.Method.invoke(Method.java:498)
     [java] 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
     [java] 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
     [java] 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
     [java] 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
     [java] 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
     [java] 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
     [java] 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
     [java] 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
     [java] 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
     [java] 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
     [java] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
     [java] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
     [java] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
     [java] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
     [java] 	at java.lang.Thread.run(Thread.java:748)
Comment 5 Philippe Mouawad 2018-12-28 21:46:11 UTC
pmouawad@apache.org
	
10:45 PM (0 minutes ago)
	
to commits
Author: pmouawad
Date: Fri Dec 28 21:45:36 2018
New Revision: 1849888

URL: http://svn.apache.org/viewvc?rev=1849888&view=rev
Log:
Bug 63037 : When using CSVRead search the script base path for files, too.

Try to fix nightly build failure
Bugzilla Id: 63037

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
Comment 6 The ASF infrastructure team 2022-09-24 20:38:15 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4963