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

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

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

SecurityException.printStackTrace介绍

暂无

代码示例

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

/**
 * Creates the directory where the MRU file list will be written.
 * The "lf5" directory is created in the Documents and Settings
 * directory on Windows 2000 machines and where ever the user.home
 * variable points on all other platforms.
 */
public static void createConfigurationDirectory() {
 String home = System.getProperty("user.home");
 String sep = System.getProperty("file.separator");
 File f = new File(home + sep + "lf5");
 if (!f.exists()) {
  try {
   f.mkdir();
  } catch (SecurityException e) {
   e.printStackTrace();
  }
 }
}
//--------------------------------------------------------------------------

代码示例来源:origin: apache/zookeeper

static HashMap<String, Method> constructFactory() {
  HashMap<String, Method> factory = new HashMap<String, Method>();
  try {
    factory.put("binary",
        BinaryOutputArchive.class.getDeclaredMethod(
          "getArchive", new Class[]{ OutputStream.class }));
    factory.put("csv",
        CsvOutputArchive.class.getDeclaredMethod(
          "getArchive", new Class[]{ OutputStream.class }));
    factory.put("xml",
        XmlOutputArchive.class.getDeclaredMethod(
          "getArchive", new Class[]{ OutputStream.class }));
  } catch (SecurityException ex) {
    ex.printStackTrace();
  } catch (NoSuchMethodException ex) {
    ex.printStackTrace();
  }
  return factory;
}

代码示例来源:origin: evernote/android-job

@Override
GenericWorkItem dequeueWork() {
  try {
    return super.dequeueWork();
  } catch (SecurityException e) {
    e.printStackTrace();
    return null;
  }
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

@Nullable
public static Field getPrivateField(final @Nullable Class<?> targetClass, final @Nullable String name) {
  if (targetClass == null || TextUtils.isEmpty(name)) return null;
  try {
    Field field = targetClass.getDeclaredField(name);
    field.setAccessible(true);
    return field;
  } catch (SecurityException e) {
    e.printStackTrace();
    // ignore
  } catch (NoSuchFieldException e) {
    e.printStackTrace();
    // ignore
  }
  return null;
}

代码示例来源:origin: evernote/android-job

@Override
  public void complete() {
    synchronized (mLock) {
      if (mParams != null) {
        try {
          mParams.completeWork(mJobWork);
        } catch (SecurityException se) {
          // ignore
          se.printStackTrace();
        }
      }
    }
  }
}

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

@Override
public void checkPermission(Permission perm) {
  if (TypeQualifierValue.DEBUG_CLASSLOADING) {
    System.out.println("Checking for " + perm + " permission in thread " + Thread.currentThread().getName());
  }
  if (performingValidation.get() && inValidation()) {
    SecurityException e = new SecurityException("No permissions granted while performing JSR-305 validation");
    if (TypeQualifierValue.DEBUG_CLASSLOADING) {
      e.printStackTrace(System.out);
    }
    throw e;
  }
}

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

@Override
public void checkPermission(Permission perm, Object context) {
  if (TypeQualifierValue.DEBUG_CLASSLOADING) {
    System.out.println("Checking for " + perm + " permission with content in thread " + Thread.currentThread().getName());
  }
  if (performingValidation.get() && inValidation()) {
    SecurityException e = new SecurityException("No permissions granted while performing JSR-305 validation");
    if (TypeQualifierValue.DEBUG_CLASSLOADING) {
      e.printStackTrace(System.out);
    }
    throw e;
  }
}

代码示例来源:origin: org.apache.ant/ant

private Constructor<? extends ProjectHelper> getProjectHelperBySystemProperty() {
  String helperClass = System.getProperty(ProjectHelper.HELPER_PROPERTY);
  try {
    if (helperClass != null) {
      return getHelperConstructor(helperClass);
    }
  } catch (SecurityException e) {
    System.err.println("Unable to load ProjectHelper class \""
              + helperClass + " specified in system property "
              + ProjectHelper.HELPER_PROPERTY + " ("
              + e.getMessage() + ")");
    if (DEBUG) {
      e.printStackTrace(System.err); //NOSONAR
    }
  }
  return null;
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

static HashMap constructFactory() {
  HashMap factory = new HashMap();
  Class[] params = { OutputStream.class };
  try {
    factory.put("binary",
        BinaryOutputArchive.class.getDeclaredMethod(
          "getArchive", params));
    factory.put("csv",
        CsvOutputArchive.class.getDeclaredMethod(
          "getArchive", params));
    factory.put("xml",
        XmlOutputArchive.class.getDeclaredMethod(
          "getArchive", params));
  } catch (SecurityException ex) {
    ex.printStackTrace();
  } catch (NoSuchMethodException ex) {
    ex.printStackTrace();
  }
  return factory;
}

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

static List<String> getDefinition(Class inter) {
  try {
    // JUtils.LOG("TR1=" + inter);
    if (inter == null) {
      return null;
    }
    final Field field = inter.getField("DEFINITION");
    return (List<String>) field.get(null);
  } catch (NoSuchFieldException e) {
    System.err.println("inter=" + inter);
    e.printStackTrace();
    throw new UnsupportedOperationException();
  } catch (SecurityException e) {
    e.printStackTrace();
    throw new UnsupportedOperationException();
  } catch (IllegalArgumentException e) {
    e.printStackTrace();
    throw new UnsupportedOperationException();
  } catch (IllegalAccessException e) {
    e.printStackTrace();
    throw new UnsupportedOperationException();
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void registerRestSpecification( Class<?> serviceClass, String serviceName ) {
 try {
  registerSpecification( WebServiceSpecification.getRestServiceSpecification( serviceClass, serviceName ) );
 } catch ( NoSuchMethodException e ) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch ( SecurityException e ) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }
}

代码示例来源:origin: chentao0707/SimplifyReader

e.printStackTrace();
} catch (NoSuchMethodException e) {
  e.printStackTrace();

代码示例来源:origin: chentao0707/SimplifyReader

e.printStackTrace();
} catch (NoSuchMethodException e) {
  e.printStackTrace();

代码示例来源:origin: internetarchive/heritrix3

return (T) inst;
} catch (SecurityException e) {
  e.printStackTrace();
} catch (NoSuchMethodException e) {
  e.printStackTrace();

代码示例来源:origin: apache/geode

/**
 * Init method to populate the TIntObjectHashMap for Non-english locales
 * <code>data = new TIntObjectHashMap();</code>
 *
 * The default bundle, English, will be <code>data = null</code>
 */
private void initData(String baseName, Locale l) {
 StringBuffer sb = new StringBuffer(baseName);
 sb.append("_").append(l.getLanguage()).append(".txt");
 String resource = sb.toString();
 InputStream is = null;
 try {
  is = ClassPathLoader.getLatest().getResourceAsStream(getClass(), resource);
 } catch (SecurityException se) {
  // We do not have a logger yet
  System.err.println(
    "A SecurityException occurred while attempting to load the resource bundle, defaulting to English."
      + se.toString());
  se.printStackTrace();
  System.err.flush();
 }
 if (is == null) {
  // No matching data file for the requested langauge,
  // defaulting to English
  data = null;
 } else {
  data = readDataFile(is);
 }
}

代码示例来源:origin: alibaba/Sentinel

e.printStackTrace();
} catch (IOException e) {
  e.printStackTrace();

代码示例来源:origin: cloudfoundry/uaa

@BeforeClass
public static void addBCProvider() throws Exception {
  try {
    Security.addProvider(new BouncyCastleProvider());
  } catch (SecurityException e) {
    e.printStackTrace();
    System.err.println("Ignoring provider error, may already be added.");
  }
}

代码示例来源:origin: cloudfoundry/uaa

@BeforeClass
public static void addBCProvider() throws Exception {
  try {
    Security.addProvider(new BouncyCastleProvider());
  } catch (SecurityException e) {
    e.printStackTrace();
    System.err.println("Ignoring provider error, may already be added.");
  }
}

代码示例来源:origin: org.testng/testng

e.printStackTrace();

代码示例来源:origin: evernote/android-job

/**
   * Dequeue some work.
   */
  @Override
  public JobIntentService.GenericWorkItem dequeueWork() {
    JobWorkItem work = null;
    synchronized (mLock) {
      if (mParams == null) {
        return null;
      }
      try {
        work = mParams.dequeueWork();
      } catch (SecurityException se) {
        //ignore
        se.printStackTrace();
      }
    }
    if (work != null) {
      work.getIntent().setExtrasClassLoader(mService.getClassLoader());
      return new WrapperWorkItem(work);
    } else {
      return null;
    }
  }
}

相关文章