热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Java中处理NullPointerException:getStackTrace()方法详解与实例代码

本文整理了Java中java.lang.NullPointerException.getStackTrace()方法的一些代码示例,展示了NullPointerException.getStackTr

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

NullPointerException.getStackTrace介绍

暂无

代码示例

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

@Override
public final NullPointerException nullParamNPE(final String name) {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullParamNPE$str(), name));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String invalidPermissiOnAction= "COM00007: Invalid permission action '%s'";

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

@Override
public final NullPointerException sendChallengeReturnedNull(final AuthenticationMechanism mechanism) {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), sendChallengeReturnedNull$str(), mechanism));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String bodyIsSetAndNotReadyForFlush = "UT000155: Framed channel body was set when it was not ready for flush";

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

@Override
public final NullPointerException nullTransaction() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullTransaction$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
@Override

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

StackTraceElement[] elements = npe.getStackTrace();
if(elements.length == 0 || !elements[0].getMethodName().equals("skipChar")) { //NOI18N

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

private String getMethodName()
{
final NullPointerException npe = new NullPointerException();
final StackTraceElement[] trace = npe.getStackTrace();
final StackTraceElement methodElement = trace[1];
return methodElement.getMethodName() + " (archiver line: " + methodElement.getLineNumber() + ")";
}

代码示例来源:origin: org.terracotta/terracotta-ee

/**
* Determine whether the NPE should be ignored due to bug 6427854. See
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6427854
*
* @param npe Exception to examine
* @return True if exception should be ignored
*/
public static boolean selectorOpenRace(NullPointerException npe) {
StackTraceElement source = npe.getStackTrace()[0];
if (source.getClassName().equals("sun.nio.ch.Util") && source.getMethodName().equals("atBugLevel")) { return true; }
return false;
}

代码示例来源:origin: org.terracotta/terracotta-l1

/**
* Determine whether the NPE should be ignored due to bug 6427854. See
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6427854
*
* @param npe Exception to examine
* @return True if exception should be ignored
*/
public static boolean selectorOpenRace(NullPointerException npe) {
StackTraceElement source = npe.getStackTrace()[0];
if (source.getClassName().equals("sun.nio.ch.Util") && source.getMethodName().equals("atBugLevel")) { return true; }
return false;
}

代码示例来源:origin: io.undertow/undertow-servlet

@Override
public final NullPointerException headerNameWasNull() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), headerNameWasNull$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String noCOnfidentialPortAvailable= "UT010053: No confidential port is available to redirect the current request.";

代码示例来源:origin: io.undertow/undertow-core

@Override
public final NullPointerException sendChallengeReturnedNull(final AuthenticationMechanism mechanism) {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), sendChallengeReturnedNull$str(), mechanism));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String bodyIsSetAndNotReadyForFlush = "UT000155: Framed channel body was set when it was not ready for flush";

代码示例来源:origin: org.wildfly.transaction/wildfly-transaction-client

@Override
public final NullPointerException nullTransaction() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullTransaction$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
@Override

代码示例来源:origin: io.undertow.jastow/jastow

@Override
public final NullPointerException elResolverNullContext() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), elResolverNullContext$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String errorResolvingVariable = "JBWEB004224: Error resolving variable %s due to %s";

代码示例来源:origin: io.undertow/undertow-servlet

@Override
public final NullPointerException listenerCannotBeNull() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), listenerCannotBeNull$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String sslCannotBeCombinedWithAnyOtherMethod = "UT010045: SSL cannot be combined with any other method";

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public final NullPointerException nullTransaction() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullTransaction$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
@Override

代码示例来源:origin: org.jboss.eap/wildfly-webservices-server-integration

@Override
public final NullPointerException nullEndpointClass() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullEndpointClass$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String classLoaderResolutiOnFailed= "WFLYWS0025: Cannot resolve module or classloader for deployment %s";

代码示例来源:origin: io.undertow/undertow-servlet

@Override
public final NullPointerException paramCannotBeNullNPE(final String name) {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), paramCannotBeNullNPE$str(), name));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String trailersNotSupported = "UT010060: Trailers not supported for this request due to %s";

代码示例来源:origin: io.undertow/undertow-servlet

@Override
public final NullPointerException nullName() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullName$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String invalidRequestRespOnseType= "UT010048: Can only handle HTTP type of request / response: %s / %s";

代码示例来源:origin: org.wildfly/wildfly-webservices-server-integration

@Override
public final NullPointerException nullEndpointName() {
final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullEndpointName$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String nullEndpointClass = "WFLYWS0024: Null endpoint class";

代码示例来源:origin: EvoSuite/evosuite

public MockNullPointerException() {
super();
delegate = new MockThrowable();
delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: EvoSuite/evosuite

public MockNullPointerException(String message) {
super(message);
delegate = new MockThrowable(message);
delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public StackTraceElement[] getStackTrace() {
if(!MockFramework.isEnabled()){
return super.getStackTrace();
}
return getDelegate().getStackTrace();
}

推荐阅读
author-avatar
我们的生活小窍门
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有