Category: | Exception |
Applies to: | Java object |
/* Java code */ public class a { public void m() throws NullPointerException { throw new NullPointerException(); } }
/* DATA step code */
data _null_;
length e 8;
dcl javaobj j('a');
rc = j.callvoidmethod('m');
/* Check for exception. Value is returned in variable 'e' */
rc = j.exceptioncheck(e);
if (e) then
put 'exception';
else
put 'no exception';
/* Clear the exception and check it again */
rc = j.exceptionclear( );
rc = j.exceptioncheck(e);
if (e) then
put 'exception';
else
put 'no exception';
run;
DataInputStream
, which enables you to pass a FileInputStream
to the constructor. The wrapper is necessary because the constructor
actually takes an InputStream
, which
is the parent of FileInputStream
, and
the current method lookup is not robust enough to perform the superclass
lookup.
/* Java code */ public class myDataInputStream extends java.io.DataInputStream { myDataInputStream(java.io.FileInputStream fi) { super(fi); } }