       next_block = @block_chain.get_block_from_instr handler.handler_pc
       @add_stmt """
         } catch (e) {
-          if (!(e instanceof util.JavaException)) throw e
+          if (!(e instanceof exceptions.JavaException)) throw e
       """
       if handler.catch_type == "<any>"
         @add_stmt "rs.push(e.exception); label = #{handler.handler_pc}; continue\n}"

# TODO: move to a separate file
if require.main == module
  fs = require 'fs'
  ClassFile = require '../src/ClassFile'
  fname = if process.argv.length > 2 then process.argv[2] else '/dev/stdin'
  bytes_array = util.bytestr_to_array fs.readFileSync(fname, 'binary')
  class_data = new ClassFile bytes_array

    var obj = rs.check_null($1);
    var array = obj.array;
    if (!(0 <= idx && idx < array.length))
      exceptions.java_throw(rs, 'java/lang/ArrayIndexOutOfBoundsException',
        idx + " not in length " + array.length + " array of type " + obj.type.toClassString());
    $2 = array[idx]
    """, b.pop(), b.pop(), temp
