Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    8

    Unanswered: Number Format Exception

    I am having a jsp page and I am getting the data in the EJB bean using a SQL (script Below)

    public ArrayList getOrderLines(SotOrderHeaderJavaBean SotOJB)
    {
    ArrayList a = new ArrayList();
    StringBuffer lineSQL = new StringBuffer();
    lineSQL.append("select ");
    lineSQL.append("product_status,");
    lineSQL.append("group_number,");
    lineSQL.append("product_id,");
    lineSQL.append("bucket_id,");
    lineSQL.append("coverage_code,");
    lineSQL.append("exclude_line,");
    lineSQL.append("bmr,");
    lineSQL.append("bmr_usd,");
    lineSQL.append("discretionary_disc,");
    lineSQL.append("NR_ZB_LOCAL,");
    lineSQL.append("quantity,");
    lineSQL.append("NVL(nr_zb_local,0)*NVL(quantity,0) ");
    lineSQL.append("from spt_quote_line ");
    lineSQL.append("where quote_number = " + Double.parseDouble(SotOJB.getOrderNumber()));
    lineSQL.append(" and version_number = " + Integer.parseInt(SotOJB.getQuoteVersion()));

    try
    {
    mq.setQuery(lineSQL.toString());
    int rStat = mq.QExecute();
    if (mq.getRowCount() > 1)
    {
    for (int r=0; (r < mq.getRowCount());r++)
    {
    final int numColumns = mq.getColumnCount();
    String [] line = new String[numColumns];
    for(int c = 0; c < numColumns;c++)
    {
    line[c] = mq.getCell(c , r);
    }
    a.add(line);
    }
    }
    }
    catch(Exception e)
    {
    LOGUtils.debugMsg(SOT, FILE + "::getOrderLines(), Exception: " + e.toString());
    }
    return a;

    This is script of JSP :::::

    Connection conn = null;
    int onRow = 0;
    String tot = "Not initialized";
    try
    {
    final int numParams = 4;
    conn = SOTDBConnection.login();
    CallableStatement cs = conn.prepareCall("{ ? = call SPT_Pricing_Round(?,?,?)}");
    cs.registerOutParameter(numParams, Types.INTEGER);
    cs.setString(2, currency);
    cs.setString(3, extendedCountry);
    for(int row = 0;row < numLines;row++)
    {
    String [] l = (String []) lines.get(row);
    tot = l[TOTAL];
    if(!tot.equals(""))
    {
    StringBuffer b = new StringBuffer(tot.length());
    b.setLength(tot.length());
    int current = 0;
    for(int i = 0;i < tot.length();i++)
    {
    char ch = tot.charAt(i);
    if(ch != ',')
    {
    b.setCharAt(current++, ch);
    }
    }
    String noComma = b.toString();
    cs.setDouble(1, Double.parseDouble(noComma));
    cs.execute();
    double price = Double.parseDouble(cs.getString(4));
    NumberFormat nf = NumberFormat.getNumberInstance();
    nf.setMaximumFractionDigits(numDecimals);
    nf.setMinimumFractionDigits(numDecimals);
    tot = new String(nf.format(price));
    data.set(row*numColumns + TOTAL, tot);
    }
    }
    }
    catch (Exception ex)
    {
    String errorMsg = "SotOrderLine.jsp, row: " + onRow + ",tot: " + tot + ",curr: " + currency + ",ext: " + extendedCountry;
    LOGUtils.debugMsg(SOT, errorMsg + ", exception: " + ex.toString());
    }

    I am getting the number format exception i think it is silly but cudnt figure out...the bug..help needed...URGENT
    Exception is :
    SOT-2003-04-11.log:<Fri Apr 11 12:59:00 EDT 2003> <Debug> <SOT> SotOrderLine.jsp, row: 0,tot: NVL(NR_ZB_LOCAL,0)*NVL(QUANTITY,0),curr: NZD,ext: N, exception: java.lang.NumberFormatException:

  2. #2
    Join Date
    Feb 2003
    Posts
    8
    PROBLEM SOLVED FOLKS THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posting Permissions

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