krishnafru
12-28-2009, 05:04 AM
I am using PHP for presentation and Java for Business Logic.
My code is working fine. But when i throw exceptions from Business Logic its giving problem.
Here is the code segment:
Java Code
package com.vm.php;
public class Database
{
public String addProfile(Profile profile) throws NullException, InvalidDataException
{
if(null == profile)
throw new NullException();
if(null == profile.getFirstName())
throw new InvalidDataException();
return "success";
}
}
PHP Code
<?php
import com.vm.php.Database;
import com.vm.php.exceptions.NullException;
import com.vm.php.exceptions.InvalidDataException;
echo "<pre>";
echo "working";
$database = new Java("Database");
try {
print_r($database->addProfile(null));
} catch(NullException $ex) {
echo "<br />";
echo 'NullException: ', $ex->getMessage(), "\n";
} catch(InvalidDataException $ex) {
echo "<br />";
echo 'InvalidDataException: ', $ex->getMessage(), "\n";
}
echo "</pre>";
?>
It is possible to catch exceptions using Quercus?
Thanks in advance..... :)
Raghu Krishna Kuchi
My code is working fine. But when i throw exceptions from Business Logic its giving problem.
Here is the code segment:
Java Code
package com.vm.php;
public class Database
{
public String addProfile(Profile profile) throws NullException, InvalidDataException
{
if(null == profile)
throw new NullException();
if(null == profile.getFirstName())
throw new InvalidDataException();
return "success";
}
}
PHP Code
<?php
import com.vm.php.Database;
import com.vm.php.exceptions.NullException;
import com.vm.php.exceptions.InvalidDataException;
echo "<pre>";
echo "working";
$database = new Java("Database");
try {
print_r($database->addProfile(null));
} catch(NullException $ex) {
echo "<br />";
echo 'NullException: ', $ex->getMessage(), "\n";
} catch(InvalidDataException $ex) {
echo "<br />";
echo 'InvalidDataException: ', $ex->getMessage(), "\n";
}
echo "</pre>";
?>
It is possible to catch exceptions using Quercus?
Thanks in advance..... :)
Raghu Krishna Kuchi