Token Parsing Error: Lexical error
NickName:ratsstack Ask DateTime:2015-06-11T08:15:05

Token Parsing Error: Lexical error

I am getting the following error when I use a BeanshellPostProcessor to regex some data and write to file:

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:\\" 

My code:

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();

Any ideas what's wrong with my code? Thanks :-)

Copyright Notice:Content Author:「ratsstack」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30769498/token-parsing-error-lexical-error

More about “Token Parsing Error: Lexical error” related questions

Token Parsing Error: Lexical error

I am getting the following error when I use a BeanshellPostProcessor to regex some data and write to file: 2015/06/11 12:11:19 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: ...

Show Detail

JMeter (Beanshell sampler) Token Parsing Error: Lexical error at line 2, column 15. Encountered: "?"

I'm passing XML from a variable into a string: def request = '${variable}' When I run my beanshell script, the response shows the following (note; line 1 is a comment): Token Parsing Error: Lexi...

Show Detail

Lexical error at line 0, column 0

In the grammar below, I am trying configure any line that starts with ' as a single line comment and anything betweeen /' Multiline Comment '/. The single line comment works ok. But for some reason...

Show Detail

How to instantiate lexical.Scanner in a JavaTokenParsers class?

I am writing a parser which inherits from JavaTokenParsers in that I have a function as follow: import scala.util.parsing.combinator.lexical._ import scala.util.parsing._ import scala.util.pars...

Show Detail

getting error ERROR 1000: Error during parsing. Lexical error

I wrote pig script as : my_script.pig bag_1 = LOAD '$INPUT' USING PigStorage('|') AS (LN_NR:chararray,ET_NR:chararray,ET_ST_DT:chararray,ED_DT:chararray,PI_ID:chararray); bag_2 = LIMIT bag_1 $SI...

Show Detail

Lexical analyser and parser communication

Most of the resources on lexical analyzers and parsers illustrate use of streams to communicate between them (or so I understand). It is explained that the parser asks for the next token, say by c...

Show Detail

Token Parsing Error .. encountered \' .. in Beanshell?

I am trying to run the following Beanshell code-- assignee.toString()!='' Here 'assignee' is a variable in Beanshell context. But I am getting the following error-- Caused by: Sourced file: in...

Show Detail

Why these statements give lexical error (not syntax error)?

In my Compiler Design course, my professor told that these statements should generate error when analyzed by Lexical Analyzer. Not writing operator after cout: cout &quot;Hello&quot;; Not writing ...

Show Detail

How to solve an error saying object delimiters is not a member of package scala.util.parsing.combinator.lexical

I am writing a parser in Scala, part of the code is as follow : import scala.util.parsing.combinator.syntactical._ object ExprParser extends JavaTokenParsers { lexical.delimiters ++= List(...

Show Detail

Using "~[]" token with lexical states

I'm trying to write a javacc-based parser that involves the following tokens / lexical states: TOKEN : { &lt;"{"&gt; : FIRST } &lt;FIRST, DEFAULT&gt; TOKEN : { &lt;"~[]"&

Show Detail