java.lang.SecurityException.getLocalizedMessage()方法的使用及代码示例

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

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

SecurityException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: goldmansachs/gs-collections

throw new AssertionError(e.getLocalizedMessage());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

throw new BlenderFileException(e.getLocalizedMessage(), e);
} catch (SecurityException e) {
  throw new BlenderFileException(e.getLocalizedMessage(), e);
} catch (InstantiationException e) {
  throw new BlenderFileException(e.getLocalizedMessage(), e);

代码示例来源:origin: oracle/opengrok

@SuppressWarnings("rawtypes")
private Class loadClass(AuthorizationPluginClassLoader loader, String name, boolean shouldFail) {
  Class clazz = null;
  try {
    clazz = loader.loadClass(name);
    if (shouldFail) {
      Assert.fail("Should produce some exception");
    }
  } catch (ClassNotFoundException ex) {
    if (!shouldFail) {
      Assert.fail(String.format("Should not produce ClassNotFoundException: %s", ex.getLocalizedMessage()));
    }
  } catch (SecurityException ex) {
    if (!shouldFail) {
      Assert.fail(String.format("Should not produce SecurityException: %s", ex.getLocalizedMessage()));
    }
  } catch (Exception ex) {
    if (!shouldFail) {
      Assert.fail(String.format("Should not produce any exception: %s", ex.getLocalizedMessage()));
    }
  }
  return clazz;
}

代码示例来源:origin: geotools/geotools

/**
 * Get a property as a boolean value. If the property can't be fetch for security reason, then
 * default to {@code false}.
 */
private static boolean getBoolean(final String name) {
  try {
    return Boolean.getBoolean(name);
  } catch (SecurityException exception) {
    // Note: we use Java Logger instead of Geotools Logging because this module
    // do not depends on the module that defines Logging. This class is used for
    // test purpose only anyway, so it should not be an issue.
    Logger.getLogger("org.geotools").warning(exception.getLocalizedMessage());
    return false;
  }
}

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

@Override
  public String run() {
    try {
      return System.getProperty(key);
    } catch (SecurityException e) {
      MulticastSocketFactoryImpl.this.log.warn(e.getLocalizedMessage(), e);
      return null;
    }
  }
};

代码示例来源:origin: modcluster/mod_cluster

@Override
  public String run() {
    try {
      return System.getProperty(key);
    } catch (SecurityException e) {
      DatagramChannelFactoryImpl.this.log.warn(e.getLocalizedMessage(), e);
      return null;
    }
  }
};

代码示例来源:origin: danfickle/openhtmltopdf

public static boolean isMacOSX() {
  try {
    if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
      return true;
    }
  } catch (SecurityException e) {
    System.err.println(e.getLocalizedMessage());
  }
  return false;
}

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-test-data

/**
 * Get a property as a boolean value. If the property can't be
 * fetch for security reason, then default to {@code false}.
 */
private static boolean getBoolean(final String name) {
  try {
    return Boolean.getBoolean(name);
  } catch (SecurityException exception) {
    Logger.getLogger("org.geotools").warning(exception.getLocalizedMessage());
    return false;
  }
}

代码示例来源:origin: geosolutions-it/imageio-ext

/**
 * Get a property as a boolean value. If the property can't be
 * fetch for security reason, then default to {@code false}.
 */
private static boolean getBoolean(final String name) {
  try {
    return Boolean.getBoolean(name);
  } catch (SecurityException exception) {
    Logger.getLogger("org.geotools").warning(exception.getLocalizedMessage());
    return false;
  }
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Get a property as a boolean value. If the property can't be
 * fetch for security reason, then default to {@code false}.
 */
private static boolean getBoolean(final String name) {
  try {
    return Boolean.getBoolean(name);
  } catch (SecurityException exception) {
    Logger.getLogger("org.geotools").warning(exception.getLocalizedMessage());
    return false;
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static boolean isMacOSX() {
  try {
    if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
      return true;
    }
  } catch (SecurityException e) {
    System.err.println(e.getLocalizedMessage());
  }
  return false;
}

代码示例来源:origin: org.docx4j/xhtmlrenderer

public static boolean isMacOSX() {
  try {
    if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
      return true;
    }
  } catch (SecurityException e) {
    System.err.println(e.getLocalizedMessage());
  }
  return false;
}

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

public static boolean isMacOSX() {
  try {
    if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
      return true;
    }
  } catch (SecurityException e) {
    System.err.println(e.getLocalizedMessage());
  }
  return false;
}

代码示例来源: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: 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 loadJavaClassVerbose(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException cnfExcptn) {
    throw runtime.newNameError("cannot load Java class " + className, className, cnfExcptn);
  } catch (ExceptionInInitializerError eiie) {
    throw runtime.newNameError("cannot initialize Java class " + className, className, eiie);
  } catch (LinkageError le) {
    throw runtime.newNameError("cannot link Java class " + className + ", probable missing dependency: " + le.getLocalizedMessage(), className, le);
  } catch (SecurityException se) {
    if (runtime.isVerbose()) se.printStackTrace(runtime.getErrorStream());
    throw runtime.newSecurityError(se.getLocalizedMessage());
  }
}

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

public Class loadJavaClassVerbose(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException ex) {
    throw initCause(runtime.newNameError("cannot load Java class " + className, className, ex), ex);
  } catch (ExceptionInInitializerError ex) {
    throw initCause(runtime.newNameError("cannot initialize Java class " + className, className, ex), ex);
  } catch (LinkageError ex) {
    throw initCause(runtime.newNameError("cannot link Java class " + className + ", probable missing dependency: " + ex.getLocalizedMessage(), className, ex), ex);
  } catch (SecurityException ex) {
    if (runtime.isVerbose()) ex.printStackTrace(runtime.getErrorStream());
    throw initCause(runtime.newSecurityError(ex.getLocalizedMessage()), ex);
  }
}

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

public Class loadJavaClassVerbose(String className) {
  try {
    return loadJavaClass(className);
  } catch (ClassNotFoundException ex) {
    throw initCause(runtime.newNameError("cannot load Java class " + className, className, ex), ex);
  } catch (ExceptionInInitializerError ex) {
    throw initCause(runtime.newNameError("cannot initialize Java class " + className, className, ex), ex);
  } catch (LinkageError ex) {
    throw initCause(runtime.newNameError("cannot link Java class " + className + ", probable missing dependency: " + ex.getLocalizedMessage(), className, ex), ex);
  } catch (SecurityException ex) {
    if (runtime.isVerbose()) ex.printStackTrace(runtime.getErrorStream());
    throw initCause(runtime.newSecurityError(ex.getLocalizedMessage()), ex);
  }
}

代码示例来源: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);
  }
}

相关文章