ASF Bugzilla – Attachment 25466 Details for
Bug 43389
Allow Include files to be found relative to the current JMX file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Patch to allow loading files relative to the main jmx file
IncludeController-patch.txt (text/plain), 2.30 KB, created by
Luciana Moreira
on 2010-05-20 12:20:59 UTC
(
hide
)
Description:
Patch to allow loading files relative to the main jmx file
Filename:
MIME Type:
Creator:
Luciana Moreira
Created:
2010-05-20 12:20:59 UTC
Size:
2.30 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P jmeterSVN >Index: src/components/org/apache/jmeter/control/IncludeController.java >=================================================================== >--- src/components/org/apache/jmeter/control/IncludeController.java (revision 946591) >+++ src/components/org/apache/jmeter/control/IncludeController.java (working copy) >@@ -18,14 +18,17 @@ > > package org.apache.jmeter.control; > >+import java.io.File; > import java.io.FileInputStream; > import java.io.FileNotFoundException; >+import java.io.IOException; > import java.io.InputStream; > import java.util.Iterator; > import java.util.LinkedList; > > import org.apache.jmeter.gui.tree.JMeterTreeNode; > import org.apache.jmeter.save.SaveService; >+import org.apache.jmeter.services.FileServer; > import org.apache.jmeter.testelement.TestElement; > import org.apache.jmeter.util.JMeterUtils; > import org.apache.jorphan.collections.HashTree; >@@ -116,8 +119,22 @@ > HashTree tree = null; > if (includePath != null && includePath.length() > 0) { > try { >- String file=prefix+includePath; >- log.info("loadIncludedElements -- try to load included module: "+file); >+ String fileName=prefix+includePath; >+ File file = new File(fileName); >+ log.info("loadIncludedElements -- try to load included module: "+file.getAbsolutePath()); >+ >+ if(!file.exists()){ >+ //Should probably also verify if the file is a relative path with java.nio.file.Path.isAbsolute() >+ //Unfortunately this may impose a restriction on the java version used to run JMeter >+ log.info("loadIncludedElements -failed for: "+file.getAbsolutePath()); >+ file = new File(FileServer.getFileServer().getBaseDir(), includePath); >+ log.info("loadIncludedElements -Attempting to read it from: "+file.getAbsolutePath()); >+ if(!file.exists()){ >+ log.error("loadIncludedElements -failed for: "+file.getAbsolutePath()); >+ throw new IOException("loadIncludedElements -failed for: "+file.getAbsolutePath()); >+ } >+ } >+ > reader = new FileInputStream(file); > tree = SaveService.loadTree(reader); > removeDisabledItems(tree);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43389
: 25466