Beanshell - assignment operator not working?

Discussion in 'Java' started by Wolfgang Groiss, Nov 19, 2003.

  1. 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
     
    Wolfgang Groiss, Nov 19, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SOl

    [BEANSHELL] Extends

    SOl, Jul 19, 2003, in forum: Java
    Replies:
    0
    Views:
    394
  2. Michael Pitoniak
    Replies:
    1
    Views:
    557
    Michael Pitoniak
    Dec 20, 2003
  3. vnssoftware
    Replies:
    0
    Views:
    445
    vnssoftware
    Feb 4, 2004
  4. Robert
    Replies:
    0
    Views:
    361
    Robert
    Jul 6, 2004
  5. Chris
    Replies:
    34
    Views:
    1,526
Loading...

Share This Page