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

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

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

Ruby.getErrno介绍

暂无

代码示例

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

@Override
  public RaiseException newRaiseException(Ruby runtime) {
    return runtime.newRaiseException(runtime.getErrno().getClass(errnoClass), path);
  }
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

@Override
  public RaiseException newRaiseException(Ruby runtime) {
    return runtime.newRaiseException(runtime.getErrno().getClass(errnoClass), path);
  }
}

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

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

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

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

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

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

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

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

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

protected static void rb_sys_fail(Ruby runtime, String message) {
  final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    throw runtime.newSystemCallError(message);
  } else {
    throw runtime.newErrnoFromInt(n, message);
  }
}

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

protected static void rb_sys_fail(Ruby runtime, String message) {
  final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    throw runtime.newSystemCallError(message);
  } else {
    throw runtime.newErrnoFromInt(n, message);
  }
}

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

protected static void rb_sys_fail(Ruby runtime, String message) {
  final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    throw runtime.newSystemCallError(message);
  } else {
    throw runtime.newErrnoFromInt(n, message);
  }
}

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

protected static void rb_sys_fail(Ruby runtime, String message) {
  final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    throw runtime.newSystemCallError(message);
  } else {
    throw runtime.newErrnoFromInt(n, message);
  }
}

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

@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
  try {
    return context.runtime.getDir().callMethod(context, "unlink", path);
  } catch (RaiseException ex) {
    if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
      throw ex;
    }
    return context.runtime.getFile().callMethod(context, "unlink", path);
  }
}

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

@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
  try {
    return context.runtime.getDir().callMethod(context, "unlink", path);
  } catch (RaiseException ex) {
    if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
      throw ex;
    }
    return context.runtime.getFile().callMethod(context, "unlink", path);
  }
}

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

public static void sysFail(Ruby runtime, String message, int n) {
  IRubyObject arg = (message != null) ? runtime.newString(message) : runtime.getNil();
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    instance = runtime.getSystemCallError();
    throw new RaiseException((RubyException)(instance.newInstance(runtime.getCurrentContext(), new IRubyObject[]{arg, runtime.newFixnum(n)}, Block.NULL_BLOCK)));
  } else {
    throw new RaiseException((RubyException)(instance.newInstance(runtime.getCurrentContext(), new IRubyObject[]{arg}, Block.NULL_BLOCK)));
  }
}

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

public static void sysFail(Ruby runtime, String message, int n) {
  IRubyObject arg = (message != null) ? runtime.newString(message) : runtime.getNil();
  RubyClass instance = runtime.getErrno(n);
  if(instance == null) {
    instance = runtime.getSystemCallError();
    throw new RaiseException((RubyException)(instance.newInstance(runtime.getCurrentContext(), new IRubyObject[]{arg, runtime.newFixnum(n)}, Block.NULL_BLOCK)));
  } else {
    throw new RaiseException((RubyException)(instance.newInstance(runtime.getCurrentContext(), new IRubyObject[]{arg}, Block.NULL_BLOCK)));
  }
}

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

@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
  IRubyObject oldExc = context.runtime.getGlobalVariables().get("$!"); // Save $!
  try {
    return context.runtime.getDir().callMethod(context, "unlink", getPath());
  } catch (RaiseException ex) {
    if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
      throw ex;
    }
    context.runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
    return context.runtime.getFile().callMethod(context, "unlink", getPath());
  }
}

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

@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
  IRubyObject oldExc = context.runtime.getGlobalVariables().get("$!"); // Save $!
  try {
    return context.runtime.getDir().callMethod(context, "unlink", getPath());
  } catch (RaiseException ex) {
    if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
      throw ex;
    }
    context.runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
    return context.runtime.getFile().callMethod(context, "unlink", getPath());
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法