You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Keith Young <yo...@gmail.com> on 2012/11/26 15:36:02 UTC

Typed Variable Declaration error

I'm feeling slightly brain-dead this morning, and can't for the life of me
see what is causing the errors below (code after errors):

2012/11/26 09:23:41 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of: ``//because
this is a post-processor we need to use the prev variable to //get the . .
. '' : Typed variable declaration
2012/11/26 09:23:41 WARN  - jmeter.extractor.BeanShellPostProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
invoking bsh method: eval Sourced file: inline evaluation of: ``//because
this is a post-processor we need to use the prev variable to //get the . .
. '' : Typed variable declaration

BeanShell PostProcessor:
//because this is a post-processor we need to use the prev variable to
//get the label (i.e. the sampler is no longer in the current scope)
samplerLabel = prev.getSampleLabel();
logLabel = "[" + samplerLabel + " BSH PostProcessor] ";

String[] qsAra = new URL(prev.getRedirectLocation()).getQuery().split("&");
String paramKeys = "";

for(String param : qsAra){
  //log.info(logLabel+"param found: " + param);
  String[] qsParam = param.split("=");
  //only start adding the split token after we have at least one key in the
string
  if(paramKeys.length() > 0){
    paramKeys += "/";
  }
  paramKeys += qsParam[0];
  vars.put(qsParam[0],qsParam[1]);
}

vars.put("paramKeys", paramKeys);


Does anyone have an idea why that error is being thrown?

Re: Typed Variable Declaration error

Posted by sebb <se...@gmail.com>.
On 26 November 2012 14:36, Keith Young <yo...@gmail.com> wrote:
> I'm feeling slightly brain-dead this morning, and can't for the life of me
> see what is causing the errors below (code after errors):
>
> 2012/11/26 09:23:41 ERROR - jmeter.util.BeanShellInterpreter: Error
> invoking bsh method: eval Sourced file: inline evaluation of: ``//because
> this is a post-processor we need to use the prev variable to //get the . .
> . '' : Typed variable declaration
> 2012/11/26 09:23:41 WARN  - jmeter.extractor.BeanShellPostProcessor:
> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error
> invoking bsh method: eval Sourced file: inline evaluation of: ``//because
> this is a post-processor we need to use the prev variable to //get the . .
> . '' : Typed variable declaration
>
> BeanShell PostProcessor:
> //because this is a post-processor we need to use the prev variable to
> //get the label (i.e. the sampler is no longer in the current scope)
> samplerLabel = prev.getSampleLabel();
> logLabel = "[" + samplerLabel + " BSH PostProcessor] ";
>
> String[] qsAra = new URL(prev.getRedirectLocation()).getQuery().split("&");
> String paramKeys = "";
>
> for(String param : qsAra){
>   //log.info(logLabel+"param found: " + param);
>   String[] qsParam = param.split("=");
>   //only start adding the split token after we have at least one key in the
> string
>   if(paramKeys.length() > 0){
>     paramKeys += "/";
>   }
>   paramKeys += qsParam[0];
>   vars.put(qsParam[0],qsParam[1]);
> }
>
> vars.put("paramKeys", paramKeys);
>
>
> Does anyone have an idea why that error is being thrown?

Beanshell was written before Java 5 for loops were introduced.

Try recoding

for(String param : qsAra)

using Java 1.4 syntax.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org