aboutsummaryrefslogtreecommitdiff
path: root/website/usageExamples/SneakyThrowsExample_post.jpage
blob: 916d94f0e3b8e75b01fa9f3416591c96f6c8da45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import lombok.Lombok;

public class SneakyThrowsExample implements Runnable {
	public String utf8ToString(byte[] bytes) {
		try {
			return new String(bytes, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			throw Lombok.sneakyThrow(e);
		}
	}
	
	public void run() {
		try {
			throw new Throwable();
		} catch (Throwable t) {
			throw Lombok.sneakyThrow(t);
		}
	}
}