Catching exceptions in JPL
[email protected] Tue, 7 Nov 2000 10:49:44 -0500
| Newsgroups | perl.jpl |
|---|---|
| Message-ID | <[email protected]> |
Does anyone know of a way to catch a Java exception from JPL? For example,
I have a login method in Java that throws an exception if the login fails
for any number of reasons. I have JPL code that calls the login method
from Perl but since the method is a void method, I get no return value to
evaluate for success or failure. The login code is not mine or I would
change it to return a boolean just for this reason.
So, how can I access the exception stack to check for a failure?
Here is some pseudocode of what I am talking about.
Java method
===========
public static void login (String[] args)
{
try
{
// login
}
catch (Exception e)
{
// display reason for failed login
// exit code
}
}
JPL Perl sub
===========
$username = "me\\you\@thisplace.com";
$login = JPL::AutoLoader::getmeth('login',['java.lang.String'],[]);
&$login($username);
# if (exception) {
# error message
# exit program
#}
Any ideas would be appreciated. Thanks!
Cheers,
Scott.
====================================================
M. Scott Roth,
<[email protected]>
Information Systems Engineer
Science Applications International Corporation
703-375-2260
========================<><=========================