首页   快速返回

Java异常堆栈信息     所属分类 java
异常堆栈信息实例


实例代码

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class StackTraceTest {

	private static final Map  map = new ConcurrentHashMap();

	public static void main(String[] args) throws Exception {
		String key = "a";
		String value = null;
		setValue(key, value);
	}

	private static void setValue(String key, String value) {
		setValue1(key, value);
	}

	private static void setValue1(String key, String value) {
		try {
			map.put(key, value);
		} catch (Throwable e) {
			throw new RuntimeException("put error", e);
		}
	}

}




异常堆栈输出

Exception in thread "main" java.lang.RuntimeException: put error
	at dyyx.StackTraceTest.setValue1(StackTraceTest.java:24)
	at dyyx.StackTraceTest.setValue(StackTraceTest.java:17)
	at dyyx.StackTraceTest.main(StackTraceTest.java:13)
Caused by: java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
	at dyyx.StackTraceTest.setValue1(StackTraceTest.java:22)
	... 2 more

上一篇     下一篇
样本标准差与总体标准差

guava Bloom Filter

25条趣味定律

左宗棠读书修身八句

经典红歌90首

hbase数据模型