Token Parsing Error: Lexical error
Token Parsing Error: Lexical error
当我使用 BeanshellPostProcessor 对一些数据进行正则表达式并写入文件时出现以下错误:
2015/06/11 12:11:19 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: `` import java.io.FileOutputStream; import java.util.Map; import java.u . . . '' Token Parsing Error: Lexical error at line 10, column 45. Encountered: "d" (100), after : "\"c:\"
2015/06/11 12:11:19 WARN - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: `` import java.io.FileOutputStream; import java.util.Map; import java.u . . . '' Token Parsing Error: Lexical error at line 10, column 45. Encountered: "d" (100), after : "\"c:\"
我的代码:
import java.io.FileOutputStream;
import java.util.Map;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.*;
String entirePage = new String(data);
FileWriter fstream = new FileWriter("c:\downloads\results.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
Pattern totalNetValue = Pattern.compile("totalNetValue\">([^\"]+)</span>");
Matcher mTotalNetValue = totalNetValue.matcher(entirePage);
mTotalNetValue.find();
//out.write(${date});
out.write(mTotalNetValue.group(1));
out.write("\n");
out.close();
知道我的代码有什么问题吗?谢谢:-)
如何将代码读入 bsh 解释器?看起来双反斜杠确实减少为单反斜杠。
作为快速修复,只需使用正斜杠而不是反斜杠,例如
FileWriter fstream = new FileWriter("c:/downloads/results.txt",true);
当我使用 BeanshellPostProcessor 对一些数据进行正则表达式并写入文件时出现以下错误:
2015/06/11 12:11:19 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: `` import java.io.FileOutputStream; import java.util.Map; import java.u . . . '' Token Parsing Error: Lexical error at line 10, column 45. Encountered: "d" (100), after : "\"c:\"
2015/06/11 12:11:19 WARN - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: `` import java.io.FileOutputStream; import java.util.Map; import java.u . . . '' Token Parsing Error: Lexical error at line 10, column 45. Encountered: "d" (100), after : "\"c:\"
我的代码:
import java.io.FileOutputStream;
import java.util.Map;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.*;
String entirePage = new String(data);
FileWriter fstream = new FileWriter("c:\downloads\results.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
Pattern totalNetValue = Pattern.compile("totalNetValue\">([^\"]+)</span>");
Matcher mTotalNetValue = totalNetValue.matcher(entirePage);
mTotalNetValue.find();
//out.write(${date});
out.write(mTotalNetValue.group(1));
out.write("\n");
out.close();
知道我的代码有什么问题吗?谢谢:-)
如何将代码读入 bsh 解释器?看起来双反斜杠确实减少为单反斜杠。
作为快速修复,只需使用正斜杠而不是反斜杠,例如
FileWriter fstream = new FileWriter("c:/downloads/results.txt",true);