File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -462,9 +462,21 @@ javaclassname(class::Symbol) = replace(string(class), "."=>"/")
462
462
javaclassname (class:: AbstractString ) = replace (class, " ." => " /" )
463
463
javaclassname (:: Type{T} ) where T <: AbstractVector = JavaCall. signature (T)
464
464
465
- function checknull (ptr)
465
+ macro checknull (expr, msg= " " )
466
+ if expr isa Expr && expr. head == :call
467
+ :( checknull ($ expr, $ msg, $ (expr. args[1 ])) )
468
+ else
469
+ :( checknull ($ expr, $ msg) )
470
+ end
471
+ end
472
+
473
+ function checknull (ptr, msg= " Unexpected null pointer from Java Native Interface" , jnifun= nothing )
466
474
if isnull (ptr) && geterror () === nothing
467
- throw (JavaCallError (" Null from Java. Not known how" ))
475
+ if jnifun === nothing
476
+ throw (JavaCallError (msg))
477
+ else
478
+ throw (JavaCallError (" JavaCall.JNI.$jnifun : $msg " ))
479
+ end
468
480
end
469
481
ptr
470
482
end
You can’t perform that action at this time.
0 commit comments