本文整理汇总了PHP中Protocol::writeException方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::writeException方法的具体用法?PHP Protocol::writeException怎么用?PHP Protocol::writeException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::writeException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
/**
*
* @param Arg $arg
* @throws JavaException
*/
public function apply($arg)
{
$name = $arg->p;
$object = $arg->v;
$ob = $object == null ? $name : array(&$object, $name);
$isAsync = $this->isAsync;
$methodCache = $this->methodCache;
$currentArgumentsFormat = $this->currentArgumentsFormat;
try {
$res = $arg->getResult(true);
if ($object == null && !function_exists($name) || !($object == null) && !method_exists($object, $name)) {
throw new Exception\JavaException("java.lang.NoSuchMethodError", "{$name}");
}
$res = call_user_func_array($ob, $res);
if (is_object($res) && !$res instanceof JavaType) {
trigger_error("object returned from {$name}() is not a Java object", E_USER_WARNING);
$this->protocol->invokeBegin(0, "makeClosure");
$this->protocol->writeULong($this->globalRef->add($res));
$this->protocol->invokeEnd();
$res = $this->getResult();
}
$this->protocol->resultBegin();
$this->writeArg($res);
$this->protocol->resultEnd();
} catch (Exception\JavaException $e) {
$trace = $e->getTraceAsString();
$this->protocol->resultBegin();
$this->protocol->writeException($e->__java, $trace);
$this->protocol->resultEnd();
} catch (\Exception $ex) {
error_log($ex->__toString());
trigger_error("Unchecked exception detected in callback", E_USER_ERROR);
die(1);
}
$this->isAsync = $isAsync;
$this->methodCache = $methodCache;
$this->currentArgumentsFormat = $currentArgumentsFormat;
}