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

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

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

Ruby.isSecurityRestricted介绍

暂无

代码示例

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

FieldMethodZero(String name, RubyModule host, Field field) {
  super(host, Visibility.PUBLIC);
  if (!Ruby.isSecurityRestricted()) {
    field.setAccessible(true);
  }
  this.field = field;
}

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

protected FieldMethodZero(RubyModule host, Field field, String name) {
  super(host, Visibility.PUBLIC, name);
  if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true);
  this.field = field;
}

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

protected FieldMethodOne(RubyModule host, Field field, String name) {
  super(host, Visibility.PUBLIC, name);
  if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true);
  this.field = field;
}

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

protected FieldMethodZero(RubyModule host, Field field, String name) {
  super(host, Visibility.PUBLIC, name);
  if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true);
  this.field = field;
}

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

protected FieldMethodOne(RubyModule host, Field field, String name) {
  super(host, Visibility.PUBLIC, name);
  if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true);
  this.field = field;
}

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

static void trySetAccessible(AccessibleObject[] accObjs) {
  if (!Ruby.isSecurityRestricted()) {
    try {
      AccessibleObject.setAccessible(accObjs, true);
    } catch(SecurityException e) {}
  }
}

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

static void trySetAccessible(AccessibleObject[] accObjs) {
  if (!Ruby.isSecurityRestricted()) {
    try {
      AccessibleObject.setAccessible(accObjs, true);
    } catch(SecurityException e) {}
  }
}

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

FieldMethodZero(String name, RubyModule host, Field field) {
  super(host, Visibility.PUBLIC);
  if (!Ruby.isSecurityRestricted()) {
    field.setAccessible(true);
  }
  this.field = field;
}

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

void addConstructor(Constructor ctor, Class<?> javaClass) {
  if (constructors == null) {
    constructors = new ArrayList<Constructor>(4);
  }
  if (!Ruby.isSecurityRestricted()) {
    try {
      ctor.setAccessible(true);
    } catch(SecurityException e) {}
  }
  constructors.add(ctor);
  haveLocalConstructor |= javaClass == ctor.getDeclaringClass();
}

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

public static String getNormalizedHome(Ruby runtime) {
  normalizedHome = runtime.getJRubyHome();
  if (normalizedHome == null && Ruby.isSecurityRestricted()) {
    normalizedHome = "SECURITY RESTRICTED";
  }
  return normalizedHome;
}

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

public static JRubyFile create(String cwd, String pathname) {
  if (pathname == null || pathname.length() == 0 || Ruby.isSecurityRestricted()) {
    return JRubyFile.DUMMY;
  }
  if (pathname.startsWith("file:")) {
    pathname = pathname.substring(5);
  }
  return createNoUnicodeConversion(cwd, pathname, new File(pathname));
}

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

public static String getNormalizedHome(Ruby runtime) {
  normalizedHome = runtime.getJRubyHome();
  if ((normalizedHome == null) && Ruby.isSecurityRestricted()) {
    normalizedHome = "SECURITY RESTRICTED";
  }
  return normalizedHome;
}

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

public static JRubyFile create(String cwd, String pathname) {
  if (pathname == null || pathname.length() == 0 || Ruby.isSecurityRestricted()) {
    return JRubyFile.DUMMY;
  }
  if (pathname.startsWith("file:")) {
    pathname = pathname.substring(5);
  }
  return createNoUnicodeConversion(cwd, pathname, new File(pathname));
}

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

public static String getNormalizedHome(Ruby runtime) {
  normalizedHome = runtime.getJRubyHome();
  if (normalizedHome == null && Ruby.isSecurityRestricted()) {
    normalizedHome = "SECURITY RESTRICTED";
  }
  return normalizedHome;
}

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

/**
* Returns java system properties as a Map<RubyString,RubyString>.
 * @param runtime
 * @return the java system properties as a Map<RubyString,RubyString>.
 */
public static Map<RubyString, RubyString> systemPropertiesMap(Ruby runtime) {
  if ( Ruby.isSecurityRestricted() ) return Collections.emptyMap();
  return asMapOfRubyStrings(runtime, (Properties) System.getProperties().clone());
}

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

public static String getNormalizedHome(Ruby runtime) {
  normalizedHome = runtime.getJRubyHome();
  if ((normalizedHome == null) && Ruby.isSecurityRestricted()) {
    normalizedHome = "SECURITY RESTRICTED";
  }
  return normalizedHome;
}

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

public Class loadJavaClass(String className) throws ClassNotFoundException {
  Class primitiveClass;
  if ((primitiveClass = PRIMITIVE_CLASSES.get(className)) == null) {
    if (!Ruby.isSecurityRestricted()) {
      return Class.forName(className, true, runtime.getJRubyClassLoader());
    }
    return Class.forName(className);
  }
  return primitiveClass;
}

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

/**
 * Returns the environment as a hash of Ruby strings.
 *
 * @param runtime
 */
public static Map<RubyString, RubyString> environmentVariableMap(Ruby runtime) {
  @SuppressWarnings("unchecked")
  Map<String, String> env = runtime.getInstanceConfig().getEnvironment();
  if ( env != null ) return asMapOfRubyStrings(runtime, env);
  if ( Ruby.isSecurityRestricted() ) return Collections.emptyMap();
  return asMapOfRubyStrings(runtime, System.getenv());
}

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

@JRubyMethod(name = "security_restricted?", module = true)
public static RubyBoolean is_security_restricted(IRubyObject recv) {
  final Ruby runtime = recv.getRuntime();
  return RubyBoolean.newBoolean(runtime, Ruby.isSecurityRestricted());
}

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

static boolean exist(ThreadContext context, RubyString path) {
  final String pathStr = path.decodeString();
  if (!Ruby.isSecurityRestricted()) {
    if (JRubyFile.createResource(context.runtime, pathStr).exists()) return true;
  }
  return existsOnClasspath(context, pathStr);
}

相关文章

微信公众号

最新文章

更多

Ruby类方法