Beanshell - assignment operator not working?

W

Wolfgang Groiss

Hi,

Beanshell seems to ignore an assignment operation in my code.

My code (excerpt, line numbers added for easier reference):

<snip>
float days = 0.0f;

System.out.println("SAZ "+object.getObjectId()+": fDauer "+fDauer);

if (fDauer != null) {
FloatValue vDauer = (FloatValue)fDauer.getValue();
System.out.println("SAZ "+object.getObjectId()+": vDauer "+ vDauer);

if (vDauer != null) {
System.out.println("SAZ "+object.getObjectId()+": setting days to
"+ vDauer.getValue().floatValue());
float f = vDauer.getValue().floatValue();

System.out.println("SAZ "+object.getObjectId()+": setting days to
"+ f+", honestly!");
days = f;

System.out.println("SAZ "+object.getObjectId()+": inner days:
"+days+ "( f is "+f+")");
}
}

System.out.println("SAZ "+object.getObjectId()+": days: "+days);
<snap>

(fDauer and vDauer are basically containers for values of various types,
and vDauer.getValue() returns a Float object, which, in my test case,
contains the value 5.0f)

when executed, my output is this:

<snip>
SAZ 13378: fDauer com.jc4solutions.nba.object.Field@946d22
SAZ 13378: vDauer 5.0
SAZ 13378: setting days to 5.0
SAZ 13378: setting days to 5.0, honestly!
SAZ 13378: inner days: 1.0( f is 5.0)
SAZ 13378: days: 1.0
<snap>

Obviously, beanshell chooses to ignore the "days = f" statement.
Has anyone here had this happen before, maybe even have a
solution/workaround/whatever?

Wolfgang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top