Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-06-2009, 11:08 PM   PM User | #1
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
try null catch, or something else

if con.rs.getString("prop") comes out null this will go to exception, coz split would not work

In dilema if this is best way to do it(performance, ...) ? Because I have a bunch of similar things in same procedure.

Code:
try
{
  this.prop= con.rs.getString("prop").split("\\|")[1];
}
catch(Exception ex)
{  
   this.prop= "";
}
BubikolRamios is offline   Reply With Quote
Old 09-07-2009, 02:48 AM   PM User | #2
Aradon
Moderator-san


 
Aradon's Avatar
 
Join Date: Jun 2005
Location: USA
Posts: 734
Thanks: 0
Thanked 20 Times in 19 Posts
Aradon is on a distinguished road
Can you not just check if the String is Null (Or even if it just equals "")? Or you could check the length, or any other sort of various things I believe.
__________________
"To iterate is human, to recurse divine." -L. Peter Deutsch
Aradon is offline   Reply With Quote
Old 09-22-2009, 12:47 AM   PM User | #3
jolly_nikki
New Coder

 
Join Date: Aug 2009
Posts: 94
Thanks: 0
Thanked 16 Times in 16 Posts
jolly_nikki is on a distinguished road
try
{
this.prop= con.rs.getString("prop");
if(this.prop != null){
this.prop= this.prop.split("\\|")[1];
}
}
catch(Exception ex)
{
this.prop= "";
}
jolly_nikki is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:22 AM.


Advertisement
Log in to turn off these ads.