Author: sebb
Date: Tue Mar 13 18:01:35 2007
New Revision: 517961

URL: http://svn.apache.org/viewvc?view=rev&rev=517961
Log:
Bug 39864 - BeanShell init files now found from currrent or bin directory

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
    jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?view=diff&rev=517961&r1=517960&r2=517961
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
 Tue Mar 13 18:01:35 2007
@@ -37,7 +37,6 @@
  * 
  * If the beanshell jar is not present at run-time, an error will be logged
  * 
- * @version $Revision$ Updated on: $Date$
  */
 
 public class BeanShellInterpreter {
@@ -106,7 +105,7 @@
                }
        }
 
-       public void init(String initFile, Object logger) throws IOException, 
JMeterException {
+       public void init(final String initFile, final Object logger) throws 
IOException, JMeterException {
                if (logger != null) {// Do this before starting the script
                        try {
                                set("log", logger);//$NON-NLS-1$
@@ -116,15 +115,22 @@
                        }
                }
                if (initFile != null && initFile.length() > 0) {
+                       String fileToUse=initFile;
                        // Check file so we can distinguish file error from 
script error
-                       File in = new File(initFile);
-                       if (!in.exists()) {
-                               throw new FileNotFoundException(initFile);
+                       File in = new File(fileToUse);
+                       if (!in.exists()){// Cannot find the file locally, so 
try the bin directory
+                               fileToUse=JMeterUtils.getJMeterHome()
+                                       +File.separator+"bin" // $NON-NLS-1$
+                                       +File.separator+initFile;
+                               in = new File(fileToUse);
+                               if (!in.exists()) {
+                                       throw new 
FileNotFoundException(initFile); // use the original name here
+                               }
                        }
                        if (!in.canRead()) {
-                               throw new IOException("Cannot read" + initFile);
+                               throw new IOException("Cannot read" + 
fileToUse);
                        }
-                       source(initFile);
+                       source(fileToUse);
                }
        }
 

Modified: jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml?view=diff&rev=517961&r1=517960&r2=517961
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml Tue Mar 13 18:01:35 2007
@@ -116,6 +116,7 @@
 <li>Bug 40933, 40945 - optional matching of embedded resource URLs</li>
 <li>Bug 41704 - Allow charset encoding to be specified for CSV DataSet</li>
 <li>Bug 40103 - various LDAP enhancements</li>
+<li>Bug 39864 - BeanShell init files now found from currrent or bin 
directory</li>
 </ul>
 
 <h4>Non-functional improvements:</h4>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to