org.jruby.Ruby.newSecurityError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.jruby.Ruby.newSecurityError方法的一些代码示例,展示了Ruby.newSecurityError的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newSecurityError方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newSecurityError

Ruby.newSecurityError介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-core

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject) method.invoke(null, runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + clazz + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.jruby/jruby-complete

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject) method.invoke(null, runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + clazz + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject)method.invoke(null, runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject)method.invoke(null, runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
  public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) {
    try {
      field.set(null, arg.toJava(field.getType()));
    } catch (IllegalAccessException iae) {
      throw context.runtime.newSecurityError(iae.getMessage());
    } catch (IllegalArgumentException iae) {
      throw context.runtime.newTypeError(iae.getMessage());
    }
    return arg;
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
  public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) {
    try {
      field.set(null, arg.toJava(field.getType()));
    } catch (IllegalAccessException iae) {
      throw context.runtime.newSecurityError(iae.getMessage());
    } catch (IllegalArgumentException iae) {
      throw context.runtime.newTypeError(iae.getMessage());
    }
    return arg;
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      RubyBasicObject object = (RubyBasicObject)cls.newInstance();
      object.setMetaClass(klazz);
      return object;
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with default constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible default constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.jruby/jruby-complete

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return constructor.newInstance(runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + clazz + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      RubyBasicObject object = (RubyBasicObject)cls.newInstance();
      object.setMetaClass(klazz);
      return object;
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with default constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible default constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      RubyBasicObject object = (RubyBasicObject)cls.newInstance();
      object.setMetaClass(klazz);
      return object;
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with default constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible default constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.jruby/jruby-core

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return constructor.newInstance(runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + clazz + " with (Ruby, RubyClass) constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + clazz + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.jruby/jruby-core

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      RubyBasicObject object = (RubyBasicObject)cls.newInstance();
      object.setMetaClass(klazz);
      return object;
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with default constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible default constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject)constructor.newInstance(runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
    try {
      return (IRubyObject)constructor.newInstance(runtime, klazz);
    } catch (InvocationTargetException ite) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ite);
    } catch (InstantiationException ie) {
      throw runtime.newTypeError("could not allocate " + cls + " with (Ruby, RubyClass) constructor:\n" + ie);
    } catch (IllegalAccessException iae) {
      throw runtime.newSecurityError("could not allocate " + cls + " due to inaccessible (Ruby, RubyClass) constructor:\n" + iae);
    }
  }
};

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private RubyRegexp initializeCommon(ByteList bytes, RegexpOptions newOptions) {
  Ruby runtime = getRuntime();
  // Options needs a little more set up.
  checkFrozen();
  if (isLiteral()) throw runtime.newSecurityError("can't modify literal regexp");
  options = newOptions;
  pattern = getRegexpFromCache(runtime, bytes, options.getKCode().getEncoding(), options);
  bytes.getClass();
  str = bytes;
  return this;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private RubyRegexp initializeCommon(ByteList bytes, RegexpOptions newOptions) {
  Ruby runtime = getRuntime();
  // Options needs a little more set up.
  checkFrozen();
  if (isLiteral()) throw runtime.newSecurityError("can't modify literal regexp");
  options = newOptions;
  pattern = getRegexpFromCache(runtime, bytes, options.getKCode().getEncoding(), options);
  bytes.getClass();
  str = bytes;
  return this;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public Class loadJavaClassQuiet(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException cnfExcptn) {
    throw runtime.newNameError("cannot load Java class " + className, className, cnfExcptn, false);
  } catch (ExceptionInInitializerError eiie) {
    throw runtime.newNameError("cannot initialize Java class " + className, className, eiie, false);
  } catch (LinkageError le) {
    throw runtime.newNameError("cannot link Java class " + className, className, le, false);
  } catch (SecurityException se) {
    throw runtime.newSecurityError(se.getLocalizedMessage());
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public Class loadJavaClassQuiet(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException cnfExcptn) {
    throw runtime.newNameError("cannot load Java class " + className, className, cnfExcptn, false);
  } catch (ExceptionInInitializerError eiie) {
    throw runtime.newNameError("cannot initialize Java class " + className, className, eiie, false);
  } catch (LinkageError le) {
    throw runtime.newNameError("cannot link Java class " + className, className, le, false);
  } catch (SecurityException se) {
    throw runtime.newSecurityError(se.getLocalizedMessage());
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public Class loadJavaClassQuiet(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException ex) {
    throw initCause(runtime.newNameError("cannot load Java class " + className, className, ex, false), ex);
  } catch (ExceptionInInitializerError ex) {
    throw initCause(runtime.newNameError("cannot initialize Java class " + className, className, ex, false), ex);
  } catch (LinkageError ex) {
    throw initCause(runtime.newNameError("cannot link Java class " + className, className, ex, false), ex);
  } catch (SecurityException ex) {
    throw initCause(runtime.newSecurityError(ex.getLocalizedMessage()), ex);
  }
}

代码示例来源:origin: org.jruby/jruby-core

public Class loadJavaClassQuiet(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException ex) {
    throw initCause(runtime.newNameError("cannot load Java class " + className, className, ex, false), ex);
  } catch (ExceptionInInitializerError ex) {
    throw initCause(runtime.newNameError("cannot initialize Java class " + className, className, ex, false), ex);
  } catch (LinkageError ex) {
    throw initCause(runtime.newNameError("cannot link Java class " + className, className, ex, false), ex);
  } catch (SecurityException ex) {
    throw initCause(runtime.newSecurityError(ex.getLocalizedMessage()), ex);
  }
}

相关文章

Ruby类方法