FieldMethodZero(String name, RubyModule host, Field field) { super(host, Visibility.PUBLIC); if (!Ruby.isSecurityRestricted()) { field.setAccessible(true); } this.field = field; }
protected FieldMethodZero(RubyModule host, Field field, String name) { super(host, Visibility.PUBLIC, name); if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true); this.field = field; }
protected FieldMethodOne(RubyModule host, Field field, String name) { super(host, Visibility.PUBLIC, name); if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true); this.field = field; }
protected FieldMethodZero(RubyModule host, Field field, String name) { super(host, Visibility.PUBLIC, name); if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true); this.field = field; }
protected FieldMethodOne(RubyModule host, Field field, String name) { super(host, Visibility.PUBLIC, name); if ( ! Ruby.isSecurityRestricted() ) field.setAccessible(true); this.field = field; }
static void trySetAccessible(AccessibleObject[] accObjs) { if (!Ruby.isSecurityRestricted()) { try { AccessibleObject.setAccessible(accObjs, true); } catch(SecurityException e) {} } }
static void trySetAccessible(AccessibleObject[] accObjs) { if (!Ruby.isSecurityRestricted()) { try { AccessibleObject.setAccessible(accObjs, true); } catch(SecurityException e) {} } }
FieldMethodZero(String name, RubyModule host, Field field) { super(host, Visibility.PUBLIC); if (!Ruby.isSecurityRestricted()) { field.setAccessible(true); } this.field = field; }
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(); }
public static String getNormalizedHome(Ruby runtime) { normalizedHome = runtime.getJRubyHome(); if (normalizedHome == null && Ruby.isSecurityRestricted()) { normalizedHome = "SECURITY RESTRICTED"; } return normalizedHome; }
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)); }
public static String getNormalizedHome(Ruby runtime) { normalizedHome = runtime.getJRubyHome(); if ((normalizedHome == null) && Ruby.isSecurityRestricted()) { normalizedHome = "SECURITY RESTRICTED"; } return normalizedHome; }
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)); }
public static String getNormalizedHome(Ruby runtime) { normalizedHome = runtime.getJRubyHome(); if (normalizedHome == null && Ruby.isSecurityRestricted()) { normalizedHome = "SECURITY RESTRICTED"; } return normalizedHome; }
/** * 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()); }
public static String getNormalizedHome(Ruby runtime) { normalizedHome = runtime.getJRubyHome(); if ((normalizedHome == null) && Ruby.isSecurityRestricted()) { normalizedHome = "SECURITY RESTRICTED"; } return normalizedHome; }
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; }
/** * 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()); }
@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()); }
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); }