cancel
Showing results for 
Search instead for 
Did you mean: 

Try catch

Former Member
0 Kudos

I need to write a try catch method wrapped around this logic, in the try though I am checking to see if z7 is true then return DUNS then a catch statement that will return "FALSE", but for some reason z7 s not looking for the boolean true it is looking to find a string true, how do I get it to recognize booleon? and write the try catch?

String soldTo = "";

soldTo = CommonFunctions.executeValueMapping(z1[0],z2[0],z3[0],z4[0],z5[0],z6[0],z7[0],z8[0], container);

for (int i =0;i < z8.length; i++) {

if (z7<i>.equals(true)){

result.addValue("DUNS");

}

else{

result.addValue("false");

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Try this logic

What is the data type of Z7 ? is it boolean or string?

If it is boolean then code as  

//if(z7)   as given below...

if it is string then

//if(z7.equals("TRUE"))



try{
String soldTo = "";

soldTo = CommonFunctions.executeValueMapping(z1[0],z2[0],z3[0],z4[0],z5[0],z6[0],z7[0],z8[0], container); 
 for (int i =0;i < z8.length; i++) {
   if (z7){
     result.addValue("DUNS");
   }
 }
} catch(Exception e){

    result.addValue("FALSE");

}

Edited by: Baskar Gopal on Apr 25, 2011 12:42 PM