PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

LDAP> <java_last_exception_clear
Last updated: Fri, 30 Jan 2009

view this page in

java_last_exception_get

(PHP 4 >= 4.0.2)

java_last_exception_get直近の Java 例外を取得する

説明

object java_last_exception_get ( void )

直近の Java の例外を取得します。

返り値

例外オブジェクトを返します。

以下の例は、Java 例外ハンドラをPHPから使用する方法を示すものです。

例1 Java 例外ハンドラ

<?php
$stack 
= new Java('java.util.Stack');
$stack->push(1);

// 以下のコードは実行に成功します
$result $stack->pop();
$ex java_last_exception_get();
if (!
$ex) {
  echo 
"$result\n";
}

// 以下のコードは失敗します (エラー出力は、@により抑制されています)
$result = @$stack->pop();
$ex java_last_exception_get();
if (
$ex) {
  echo 
$ex->toString();
}

// 直近の例外をクリア
java_last_exception_clear();
?>

注意

警告

この関数は、 実験的 なものです。この関数の動作・ 名前・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 この関数は自己責任で使用してください。



add a note add a note User Contributed Notes
java_last_exception_get
molli at loria dot fr
25-Jul-2001 01:50
Just pay attention to the return value
of java_last_exception_get(), it's an
exception java object.

To use it just call normal operations on a exception java object:

ex:

@$myconnect->execute(); // @ to avoid warning...
$exc=java_last_exception_get();
$res=$exc->getMessage(); // method call on a exception object...
$exres="class nToxic.Connect:login failed";
$this->assert($res == $exres, "$res == $exres");

LDAP> <java_last_exception_clear
Last updated: Fri, 30 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites