Results 1 to 5 of 5
  1. #1
    rafamd11 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default [SOLVED] Please, I need help with this issue.

    You can see everything in the attachment.

    The line in green fails because "value" variable has a strange value. It should be something like "key" variable.

    Thank you so so much.

    ps. I've been 4 hours and counting with this. I can't take it anymore.
    Attached Thumbnails Attached Thumbnails [SOLVED] Please, I need help with this issue.-code.jpg  

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    I wish I could help you, but I left my crystal ball at work. Sorry.

  3. #3
    rafamd11 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default just in case you can't see the attachment.

    This is the code that fails:

    if (cantidadesAlimentos != null){
    Iterator mapIterator = cantidadesAlimentos.entrySet().iterator();
    for (int i = 0; i < cantidadesAlimentos.size(); i++){
    Map.Entry entry = (Map.Entry) mapIterator.next();
    String key = entry.getKey().toString();
    String value = entry.getValue().toString();
    if(key.compareTo("recalcular") != 0){
    fails here>>>> double limiteVariable = (Double.valueOf(value).doubleValue()) / 100;
    motorPL.setBounds(motorPL.getNameindex(key, false), limiteVariable, limiteVariable);
    }
    }
    }

    this map comes from a JSP:

    Map<String, String> cantidadesAlimentos = null;
    if (!session.isNew()){
    cantidadesAlimentos = request.getParameterMap();
    }

    The program fails where shown. The variable "key" is OK, it contains "11547" but the variable "value" contains "String[1] (id=142)" (well, when converted to a string it is something else), where it should be "30".

    I can see the value 30 expanding the contents of "key". But I couldn't get it out of there

  4. #4
    rafamd11 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default

    getValue() is returning an array of strings, so:

    String value = ((String[])entry.getValue())[0];

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    More specifically it's returning a String array of one item.

Similar Threads

  1. DST issue being faced
    By JavaMan in forum New To Java
    Replies: 0
    Last Post: 08-01-2008, 04:30 PM
  2. WAR issue,please see the details
    By milindvijayshah@gmail.com in forum Advanced Java
    Replies: 0
    Last Post: 07-25-2008, 11:51 AM
  3. Log4j Issue
    By nag98 in forum Forum Lobby
    Replies: 0
    Last Post: 06-22-2008, 09:22 PM
  4. Issue with JNI and C library
    By AlakaAlaki in forum New To Java
    Replies: 1
    Last Post: 06-13-2008, 01:06 AM
  5. Issue
    By chaitu444 in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •