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

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

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

Ruby.newLoadError介绍

暂无

代码示例

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

protected void checkEmptyLoad(String file) throws RaiseException {
  if (file.isEmpty()) {
    throw runtime.newLoadError("no such file to load -- " + file, file);
  }
}

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

protected void checkEmptyLoad(String file) throws RaiseException {
  if (file.equals("")) {
    throw runtime.newLoadError("no such file to load -- " + file, file);
  }
}

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

protected void checkEmptyLoad(String file) throws RaiseException {
  if (file.isEmpty()) {
    throw runtime.newLoadError("no such file to load -- " + file, file);
  }
}

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

protected void checkEmptyLoad(String file) throws RaiseException {
  if (file.equals("")) {
    throw runtime.newLoadError("no such file to load -- " + file, file);
  }
}

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

private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String file, Throwable t) {
  if (RubyInstanceConfig.DEBUG_PARSER) t.printStackTrace();
  
  return runtime.newLoadError(String.format("load error: %s -- %s: %s", file, t.getClass().getName(), t.getMessage()), file);
}

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

private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String file, Throwable t) {
  if (RubyInstanceConfig.DEBUG_PARSER || RubyInstanceConfig.IR_READING_DEBUG) t.printStackTrace();
  return runtime.newLoadError(String.format("load error: %s -- %s: %s", file, t.getClass().getName(), t.getMessage()), file);
}

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

private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String file, Throwable t) {
  if (RubyInstanceConfig.DEBUG_PARSER) t.printStackTrace();
  
  return runtime.newLoadError(String.format("load error: %s -- %s: %s", file, t.getClass().getName(), t.getMessage()), file);
}

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

private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String file, Throwable t) {
  if (RubyInstanceConfig.DEBUG_PARSER || RubyInstanceConfig.IR_READING_DEBUG) t.printStackTrace();
  return runtime.newLoadError(String.format("load error: %s -- %s: %s", file, t.getClass().getName(), t.getMessage()), file);
}

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

public void load(final Ruby runtime, boolean wrap) throws IOException {
    if (!runtime.getInstanceConfig().isNativeEnabled()) {
      throw runtime.newLoadError("Native API access is disabled");
    }
    if (!Platform.getPlatform().isSupported()) {
      throw runtime.newLoadError("Unsupported platform: " + Platform.getPlatform().getName());
    }

    RubyModule ffi = runtime.defineModule("FFI");
    try {
      Factory.getInstance().init(runtime, ffi);
    } catch (Exception e) {
      throw runtime.newLoadError("Could not load FFI Provider: " + e.getLocalizedMessage()
          + " See http://jira.codehaus.org/browse/JRUBY-4583");
    }
  }
}

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

public void load(final Ruby runtime, boolean wrap) throws IOException {
    if (!runtime.getInstanceConfig().isNativeEnabled()) {
      throw runtime.newLoadError("Native API access is disabled");
    }
    if (!Platform.getPlatform().isSupported()) {
      throw runtime.newLoadError("Unsupported platform: " + Platform.getPlatform().getName());
    }

    RubyModule ffi = runtime.defineModule("FFI");
    try {
      Factory.getInstance().init(runtime, ffi);
    } catch (Exception e) {
      throw runtime.newLoadError("Could not load FFI Provider: " + e.getLocalizedMessage()
          + " See http://jira.codehaus.org/browse/JRUBY-4583");
    }
  }
}

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

public void load(final Ruby runtime, boolean wrap) throws IOException {
    if (!runtime.getInstanceConfig().isNativeEnabled()) {
      throw runtime.newLoadError("Native API access is disabled");
    }
    if (!Platform.getPlatform().isSupported()) {
      throw runtime.newLoadError("Unsupported platform: " + Platform.getPlatform().getName());
    }

    RubyModule ffi = runtime.defineModule("FFI");
    try {
      Factory.getInstance().init(runtime, ffi);
    } catch (Exception e) {
      throw runtime.newLoadError("Could not load FFI Provider: " + e.getLocalizedMessage()
          + " See http://jira.codehaus.org/browse/JRUBY-4583");
    }
  }
}

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

public void load(final Ruby runtime, boolean wrap) throws IOException {
    if (!runtime.getInstanceConfig().isNativeEnabled()) {
      throw runtime.newLoadError("Native API access is disabled");
    }
    if (!Platform.getPlatform().isSupported()) {
      throw runtime.newLoadError("Unsupported platform: " + Platform.getPlatform().getName());
    }

    RubyModule ffi = runtime.defineModule("FFI");
    try {
      Factory.getInstance().init(runtime, ffi);
    } catch (Exception e) {
      throw runtime.newLoadError("Could not load FFI Provider: " + e.getLocalizedMessage()
          + " See http://jira.codehaus.org/browse/JRUBY-4583");
    }
  }
}

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

@JRubyMethod(name = {  "open" }, meta = true)
public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
  final String libName = libraryName.isNil() ? null : libraryName.toString();
  try {
    Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
    if (library == null) {
      throw new UnsatisfiedLinkError(Library.getLastError());
    }
    return new DynamicLibrary(context.runtime, (RubyClass) recv,
        libName, library);
  } catch (UnsatisfiedLinkError ex) {
    throw context.runtime.newLoadError(String.format("Could not open library '%s' : %s",
        libName != null ? libName : "current process", ex.getMessage()));
  }
}
@JRubyMethod(name = {  "find_variable", "find_symbol" })

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

@JRubyMethod(name = {  "open" }, meta = true)
public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
  final String libName = libraryName.isNil() ? null : libraryName.toString();
  try {
    Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
    if (library == null) {
      throw new UnsatisfiedLinkError(Library.getLastError());
    }
    return new DynamicLibrary(context.runtime, (RubyClass) recv,
        libName, library);
  } catch (UnsatisfiedLinkError ex) {
    throw context.runtime.newLoadError(String.format("Could not open library '%s' : %s",
        libName != null ? libName : "current process", ex.getMessage()));
  }
}
@JRubyMethod(name = {  "find_variable", "find_symbol" })

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

@JRubyMethod(name = {  "open" }, meta = true)
public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
  final String libName = libraryName.isNil() ? null : libraryName.toString();
  try {
    Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
    if (library == null) {
      throw new UnsatisfiedLinkError(Library.getLastError());
    }
    return new DynamicLibrary(context.runtime, (RubyClass) recv,
        libName, library);
  } catch (UnsatisfiedLinkError ex) {
    throw context.runtime.newLoadError(String.format("Could not open library '%s' : %s",
        libName != null ? libName : "current process", ex.getMessage()));
  }
}
@JRubyMethod(name = {  "find_variable", "find_symbol" })

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

public static void createDigestRMD160(Ruby runtime) {
  runtime.getLoadService().require("digest");
  if(provider == null) {
    throw runtime.newLoadError("RMD160 not supported without BouncyCastle");
  }
  RubyModule Digest = runtime.getModule("Digest");
  RubyClass Base = Digest.getClass("Base");
  RubyClass RMD160 = Digest.defineClassUnder("RMD160", Base, Base.getAllocator());
  RMD160.setInternalVariable("metadata", new Metadata("RIPEMD160", 64));
}

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

public static void createDigestRMD160(Ruby runtime) {
  runtime.getLoadService().require("digest");
  if(provider == null) {
    throw runtime.newLoadError("RMD160 not supported without BouncyCastle");
  }
  RubyModule Digest = runtime.getModule("Digest");
  RubyClass Base = Digest.getClass("Base");
  RubyClass RMD160 = Digest.defineClassUnder("RMD160", Base, Base.getAllocator());
  RMD160.setInternalVariable("metadata", new Metadata("RIPEMD160", 64));
}

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

public static void createDigestRMD160(Ruby runtime) {
  runtime.getLoadService().require("digest");
  if(provider == null) {
    throw runtime.newLoadError("RMD160 not supported without BouncyCastle");
  }
  RubyModule mDigest = runtime.getModule("Digest");
  RubyClass cDigestBase = mDigest.getClass("Base");
  RubyClass cDigest_RMD160 = mDigest.defineClassUnder("RMD160",cDigestBase,cDigestBase.getAllocator());
  cDigest_RMD160.setInternalVariable("metadata", new Metadata("RIPEMD160", 64));
}

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

public static void createDigestRMD160(Ruby runtime) {
  runtime.getLoadService().require("digest");
  if(provider == null) {
    throw runtime.newLoadError("RMD160 not supported without BouncyCastle");
  }
  RubyModule mDigest = runtime.getModule("Digest");
  RubyClass cDigestBase = mDigest.getClass("Base");
  RubyClass cDigest_RMD160 = mDigest.defineClassUnder("RMD160",cDigestBase,cDigestBase.getAllocator());
  cDigest_RMD160.setInternalVariable("metadata", new Metadata("RIPEMD160", 64));
}

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

public static void createDigestSHA2(Ruby runtime) {
  runtime.getLoadService().require("digest");
  try {
    createMessageDigest(runtime, "SHA-256");
  } catch(NoSuchAlgorithmException e) {
    throw runtime.newLoadError("SHA2 not supported");
  }
  RubyModule mDigest = runtime.getModule("Digest");
  RubyClass cDigestBase = mDigest.getClass("Base");
  RubyClass cDigest_SHA2_256 = mDigest.defineClassUnder("SHA256",cDigestBase,cDigestBase.getAllocator());
  Metadata sha256Metadata = new Metadata("SHA-256", 64);
  cDigest_SHA2_256.setInternalVariable("metadata", sha256Metadata);
  RubyClass cDigest_SHA2_384 = mDigest.defineClassUnder("SHA384",cDigestBase,cDigestBase.getAllocator());
  cDigest_SHA2_384.setInternalVariable("metadata", new Metadata("SHA-384", 128));
  RubyClass cDigest_SHA2_512 = mDigest.defineClassUnder("SHA512",cDigestBase,cDigestBase.getAllocator());
  cDigest_SHA2_512.setInternalVariable("metadata", new Metadata("SHA-512", 128));
}

相关文章

微信公众号

最新文章

更多

Ruby类方法