Title: RE: [jdjlist] RE: CachedRowSet problem
I looked through the source of BigDecimal and it appears all constructors set intVal and nothing sets it to null.
 

James Amos Nathaniel Stauffer (Off-site)
Yahoo Messenger: Stauffer_James
MSN Messenger: [EMAIL PROTECTED] (no email please)
Telephone: 715-688-2856

-----Original Message-----
From: Vaidya, Abhijit (CAP, GEFA, Contractor) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:58 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet problem

Hi All,
 
Looks like I have stirred up a hornests nest! Ok, to answer all your queries:
 
1. The stackTrace would look something like this:
 
java.lang.NullPointerException
at java.math.BigDecimal.hashCode(BigDecimal.java:804)
at com.gefa.genius.services.cp.rules.productValidation.AgeTesting.calculateAge(AgeTesting.java:34)
at com.gefa.genius.services.cp.rules.productValidation.AgeTesting.main(AgeTesting.java:16)
 
Now, the same error would happen regardless of which method u call on the object (toString,longValue.....they all failed except the getClass).
 
Interestingly, when we had a null value in the database, then the null check on the corresponding object resulted to True, so the code never reached to a chcdRowSet.getObject statement. However, when the database record HAD a value, the null check resulted in FALSE, the code reached the chcdRowSet.getObject statement and also showed us the class of the object thus retrieved. But the moment we call any method on this 'not NULL' object, KABOOM!! NullPointerException.
 
Our debugging told us that for some reason, the BigDecimal object, when created has an intValue internal attribute, which should have the actual numerical value retrieved from the DB. This value comes up as null. Any thoughts on this?
 
-regards,
abhi.
-----Original Message-----
From: Patrick Li [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 2:48 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet problem

The value in the database can have null if the column allows it when designing the table. Depending on implementation of the driver, when the database type is converted to java type, DB nulls may be set as java nulls.
-----Original Message-----
From: James Stauffer [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 2:43 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet problem

I am probably showing my ignorance but how can null have a type? I have seen null cast to a type to choose a sepecific overloaded method but that is the closest to that that I have seen. Please explain or point to a resource.

James Amos Nathaniel Stauffer (Off-site)
Yahoo Messenger: Stauffer_James
MSN Messenger: [EMAIL PROTECTED] (no email please)
Telephone: 715-688-2856


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:33 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet problem



Just a thought... is there a null value returned from the database for the
column CASE_DT_TY_CD  that you are refrencing?
It could still be a BigDecimal object but it also could be set to null if
the value in the column returns null for the result set.

Greg.





"Vaidya, Abhijit (CAP, GEFA, Contractor)"
<[EMAIL PROTECTED]> on 2003/01/02 02:23:37 PM

Please respond to "JDJList" <[EMAIL PROTECTED]>

To:   "JDJList" <[EMAIL PROTECTED]>
cc:

Subject:  [jdjlist] RE: CachedRowSet problem



Yes I  did, James....
The  1st line dod give me java.math.BigDecimal as output.
The  next 2 lines will both give me a NullpointerException.
-----Original Message-----
From: James Stauffer  [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003  2:21 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet  problem



Did you try the following?
   System.out.println(  "The value1 ...." +  chcdRowSet.getObject
("CASE_DT_TY_CD").getClass());
  System.out.println(  "The value1 ...." +  chcdRowSet.getObject
("CASE_DT_TY_CD"));
   System.out.println(  "The value1 ...." +  chcdRowSet.getBigDecimal
("CASE_DT_TY_CD"));

James Amos Nathaniel Stauffer (Off-site)
Yahoo Messenger: Stauffer_James
MSN Messenger:  [EMAIL PROTECTED] (no email please)
Telephone: 715-688-2856

-----Original Message-----
From:  Vaidya, Abhijit (CAP, GEFA, Contractor)
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:12 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet  problem

same instance of the same database. All machines using the  same code as
show
below, accessing the same column,  same record in the same table.

-regards,
abhi.

-----Original Message-----
From: Paul  Franz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 2:11 PM
To: JDJList
Subject: [jdjlist] RE: CachedRowSet  problem

Question: Are all machines pointing to the same  database?

Paul Franz

----- Original Message -----
From:  "Vaidya, Abhijit (CAP, GEFA, Contractor)"
<[EMAIL PROTECTED]>
To:  "JDJList" <[EMAIL PROTECTED]>
Sent:  Thursday, January 02, 2003 1:51 PM
Subject: [jdjlist]  RE: CachedRowSet problem

> Hi Irene,
> Firstly , thanks  for responding to my mail.
> I have ensured points  1 and 2 a couple of times. In fact, I have tried
this
> scenario on 4 different machines and  it works only on 1.
> 3. chcdRowSet.getObject has  the same effect--a  Nullpointer
> 4.  chcdRowSet.getObject.getClass is what I have tried, and it has
returned
> me a java.Math.BigDecimal as the returning class name.  The point is ,
this
> means that an object exists  but calling any other method on it gives a
>  Nullpointer.
>
> I hope  you can help me out.
>
>  -regards,
> abhu.
>  -----Original Message-----
> From: Troupansky,  Irene [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 02, 2003 12:57 PM
> To: JDJList
> Subject:  [jdjlist] RE: CachedRowSet problem
>
>
> Hi, Abhi,
>
> A couple of questions (some stupid  :-) )
>
> 1. A you sure  you have absolutely the same SDK on all machines?
>  2. Absolutely the same DB drivers?
> 3. What  happens if you change the 3rd println to
>            System.out.println(  "The value1 ...." +
>  chcdRowSet.getObject("CASE_DT_TY_CD"));
> 4. What  is the exact statement you are using to do getClass?
>
> Thanks,
>
> Irene Troupansky
>
>
>  -----Original Message-----
> From: Vaidya, Abhijit  (CAP, GEFA, Contractor)
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 31, 2002 2:50 PM
> To: JDJList
> Subject:  [jdjlist] CachedRowSet problem
>
>
> Hi All,
>  I have been facing a wierd problem when dealing with CachedRowSet
objects.
> This is the sun.jdbc.rowset.CachedRowSet  object
>
>  if((chcdRowSet != null) && (chcdRowSet.size() > 0)){
> while (chcdRowSet.next())
>
>            System.out.println(  "The value2 ...." +
>  chcdRowSet.getObject("CASE_DT_TY_DESC"));
>            System.out.println(  "The value3 ...." +
>  chcdRowSet.getObject("NBR_DT_TXT_IND"));
>            System.out.println(  "The value1 ...." +
>  chcdRowSet.getBigDecimal("CASE_DT_TY_CD"));
>
> }
>
> In the above piece of code, we have been experiencing
NullpointerException
> on  the 3rd Sys.out. The object in the cachedRowSet is of a BigDecimal
type,
> which is seen when we did  a getClass on the cachedRowset. However, any
other
> method called on that object returns  a NullPointerException .
> The problem seems to be  with the BigDecimal object that is made inside
the
> CachedRowset object. For some reason, any method called on this  object
> returns a NullPointerException, EXCEPT for  a getClass. If the getClass
> method works, it does  mean that the object exists!!
> The wierdest thing  about the whole issue is that this works on some
machines
> and does not work on other  machines!! We have tried everything in our
hands
> to ensure that the setup on the 2  machines is identical. But for some
> reason, the  code fails one machine and works on the other.
>
> Has anyone ever used the  CachedRowSet, and if so, have you ever faced
>  problems of a similar kind with it?
>
> I hope someone has some solution for me. I would be more  than grateful,
> since it has been bugging our  entire team for quite some time now.
>
> -regards,
> abhi.
>
>  ____________________________________________________
> To change your JDJList options, please visit:
> http://www.sys-con.com/java/list.cfm
>
> Be respectful! Clean up your posts  before replying
>  ____________________________________________________
>
>  ____________________________________________________
> To change your JDJList options, please visit:
> http://www.sys-con.com/java/list.cfm
>
> Be respectful! Clean up your posts  before replying
>  ____________________________________________________
>
>  ____________________________________________________
> To change your JDJList options, please visit:
> http://www.sys-con.com/java/list.cfm
>
> Be respectful! Clean up your posts  before replying
>  ____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your  JDJList options, please  visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up  your posts before  replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________








******************************************************************************
This email message is confidential to the intended recipient and may be
legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized.  Any unauthorised use, dissemination of the information, or copying of this message is prohibited.  If you are not the intended addressee, kindly notify the sender by return e-mail

and delete this message.
******************************************************************************


____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________ ____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to