code: @SuppressWarnings("unchecked")
     private Handler createHandler() throws Throwable
     {
        Class clz = handler;
  
        while (clz != Object.class)
        {
           try
           {
              Constructor c = clz.getDeclaredConstructor((Class[])null);
              c.setAccessible(true);
  
              return (Handler)c.newInstance((Object[])null);
           }
           catch (Throwable t)
           {
              t.printStackTrace(System.err);
           }
  
           clz = clz.getSuperclass();
        }
  
        throw new IllegalStateException("Unable to find default constructor");
     }
docs: Create handler
  @exception Throwable Thrown in case of an error