Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 07-26-2004, 03:05 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
NumberFormatException: multiple points

i've been working on this for the past 2 hours and can't seem to figure out where this exception is coming from. it is very intermitant.

i am calling the same method with the same customerID and it only throws an exception sometimes.

Quote:
getProducts() java.lang.NumberFormatException: multiple points
Code:
  private static SimpleDateFormat formatDateOut = new SimpleDateFormat("yyyy-MM-dd");

...
public static ArrayList getProducts(String customerID){
    
    ArrayList al = new ArrayList();
    String sql = "SELECT SVPRID,SVMODN,SVSERL,SVPCHD,SVPSTR,SVPCTY,SVPSTA FROM MRKCPRD WHERE SVCUSN='" + customerID + "' AND SVSTAT='1'";

    try{
      
      Connection con = Pool.getConnection();
      
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      
      while(rs.next()){
        
        Product prd = new Product();
        prd.setProductID(rs.getInt("SVPRID"));
        prd.setModelID(rs.getString("SVMODN"));
        prd.setSerial(rs.getString("SVSERL"));
        prd.setDatePurchased((Date)formatDateOut.parse(rs.getString("SVPCHD")));
        prd.setStorePurchased(rs.getString("SVPSTR"));
        prd.setCityPurchased(rs.getString("SVPCTY"));
        prd.setStatePurchased(rs.getString("SVPSTA"));
        
        al.add(prd);
      }
      
      con.close();
      
    }catch(Exception e){
      System.out.println("getProducts() " + e.toString());
    }
    
    return al; 
  }
is there anything obviously wrong that might be throwing this exception?
__________________
Mike
sde is offline   Reply With Quote
Old 07-26-2004, 07:13 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
It's probably either
Code:
prd.setProductID(rs.getInt("SVPRID"));
or

Code:
prd.setDatePurchased((Date)formatDateOut.parse(rs.getString("SVPCHD")));
and I'm leaning towards the former. You probably have some bogus data in your DB, or the number is too big for an int.

What you could do is put println() after every set method to track down exactly what line it's occuring on.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 07-26-2004, 08:12 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
it happens in setting the products, but i have hard coded good data in there and it does the same thing.
Code:
prd.setProductID(1);
prd.setModelID("");        prd.setSerial("");
prd.setDatePurchased((Date)formatDateOut.parse("2004-01-01"));    prd.setStorePurchased("");
prd.setCityPurchased("");
prd.setStatePurchased("");
i'm thinking it is the formatDateOut, but i can't figure out why it throws an exception intermitantly even hard coded. =/ i use that same format Date method in other places in this project and it works just fine. if i comment out all those lines where i am setting the product, it is consistant and does not throw exceptions.

i'll be spending more time tomorrow on this little section of code. i'll post when i figure it out.
__________________
Mike
sde is offline   Reply With Quote
Old 07-27-2004, 08:44 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
well after setting up a main class calling that method, it did not generate errors .. so i just re-wrote the jsp that was calling that method and now it works fine.

seems like for some reason it was executing that code twice everytime.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Would be really grateful for help with inserting multiple records debbieau PHP 2 06-16-2004 04:06 PM
capturing multiple keys sde MS Technologies ( ASP, VB, C#, .NET ) 0 01-20-2004 02:17 PM
sending POST multiple post requests in one php script. sde PHP 2 08-09-2003 05:10 PM
multiple ips in debian sde Linux / BSD / OS X 7 04-01-2003 06:23 PM


All times are GMT -8. The time now is 06:12 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting