From: Max R. A. <ma...@eo...> - 2002-10-25 09:18:06
|
Hi! The following code is found in CharacterType: public Object get(ResultSet rs, String name) throws SQLException { return new Character(rs.getString(name).charAt(0)); } Shouldn't this be something like the following to avoid a possible null value ?!: public Object get(ResultSet rs, String name) throws SQLException { String s = rs.getString(name); if(s!=null) { return new Character(s.charAt(0)); } else { return null; } } |
From: Gavin K. <ga...@ap...> - 2002-10-25 11:46:16
|
Wow, what an absolutely ancient bug!! Its in the very first CVS revision. Easy to see how it could slip through, though. I doubt many people have properties of type java.lang.Character.... You get some kind of prize for that. ----- Original Message ----- From: "Max Rydahl Andersen" <ma...@eo...> To: <hib...@li...> Sent: Friday, October 25, 2002 7:17 PM Subject: [Hibernate] Bug in CharacterType... > Hi! > > The following code is found in CharacterType: > public Object get(ResultSet rs, String name) throws SQLException { > > return new Character(rs.getString(name).charAt(0)); > > } > > > > Shouldn't this be something like the following to avoid a possible null > value ?!: > > public Object get(ResultSet rs, String name) throws SQLException { > > String s = rs.getString(name); > > if(s!=null) { > > return new Character(s.charAt(0)); > > } else { > > return null; > > } > > } > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Max R. A. <ma...@eo...> - 2002-10-25 11:54:33
|
hehe - I asked on this list BECAUSE it was in the first CVS revision and had not changed since then - so I was not really sure if it was intentional or not :) But now its fixed and my generic browser works again :) (note: I have also submitted a patch - so if you have checked something in, please update the patch tracking too :) /max p.s. looking forward to the prize :) ----- Original Message ----- From: "Gavin King" <ga...@ap...> To: "Max Rydahl Andersen" <ma...@eo...>; <hib...@li...> Sent: Friday, October 25, 2002 1:48 PM Subject: Re: [Hibernate] Bug in CharacterType... > Wow, what an absolutely ancient bug!! Its in the very first CVS revision. > Easy to see how it could slip through, though. I doubt many people have > properties of type java.lang.Character.... > > You get some kind of prize for that. > > ----- Original Message ----- > From: "Max Rydahl Andersen" <ma...@eo...> > To: <hib...@li...> > Sent: Friday, October 25, 2002 7:17 PM > Subject: [Hibernate] Bug in CharacterType... > > > > Hi! > > > > The following code is found in CharacterType: > > public Object get(ResultSet rs, String name) throws SQLException { > > > > return new Character(rs.getString(name).charAt(0)); > > > > } > > > > > > > > Shouldn't this be something like the following to avoid a possible null > > value ?!: > > > > public Object get(ResultSet rs, String name) throws SQLException { > > > > String s = rs.getString(name); > > > > if(s!=null) { > > > > return new Character(s.charAt(0)); > > > > } else { > > > > return null; > > > > } > > > > } > > > > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: Influence the future > > of Java(TM) technology. Join the Java Community > > Process(SM) (JCP(SM)) program now. > > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > > _______________________________________________ > > hibernate-devel mailing list > > hib...@li... > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > |
From: Gavin K. <ga...@ap...> - 2002-10-25 11:56:33
|
Woops yeah, I fixed it myself ... didn't get notified of the patch. ----- Original Message ----- From: "Max Rydahl Andersen" <ma...@eo...> To: "Gavin King" <ga...@ap...>; <hib...@li...> Sent: Friday, October 25, 2002 9:54 PM Subject: Re: [Hibernate] Bug in CharacterType... > hehe - I asked on this list BECAUSE it was in the first CVS revision and > had not changed since then - so I was not really sure if it was intentional > or not :) > > But now its fixed and my generic browser works again :) (note: I have also > submitted a patch - so if > you have checked something in, please update the patch tracking too :) > > /max > > p.s. looking forward to the prize :) > > ----- Original Message ----- > From: "Gavin King" <ga...@ap...> > To: "Max Rydahl Andersen" <ma...@eo...>; > <hib...@li...> > Sent: Friday, October 25, 2002 1:48 PM > Subject: Re: [Hibernate] Bug in CharacterType... > > > > Wow, what an absolutely ancient bug!! Its in the very first CVS revision. > > Easy to see how it could slip through, though. I doubt many people have > > properties of type java.lang.Character.... > > > > You get some kind of prize for that. > > > > ----- Original Message ----- > > From: "Max Rydahl Andersen" <ma...@eo...> > > To: <hib...@li...> > > Sent: Friday, October 25, 2002 7:17 PM > > Subject: [Hibernate] Bug in CharacterType... > > > > > > > Hi! > > > > > > The following code is found in CharacterType: > > > public Object get(ResultSet rs, String name) throws SQLException { > > > > > > return new Character(rs.getString(name).charAt(0)); > > > > > > } > > > > > > > > > > > > Shouldn't this be something like the following to avoid a possible null > > > value ?!: > > > > > > public Object get(ResultSet rs, String name) throws SQLException { > > > > > > String s = rs.getString(name); > > > > > > if(s!=null) { > > > > > > return new Character(s.charAt(0)); > > > > > > } else { > > > > > > return null; > > > > > > } > > > > > > } > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by: Influence the future > > > of Java(TM) technology. Join the Java Community > > > Process(SM) (JCP(SM)) program now. > > > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > > > _______________________________________________ > > > hibernate-devel mailing list > > > hib...@li... > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > |