forked from yeshodha02/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptionThrower.java
More file actions
46 lines (39 loc) · 1.38 KB
/
ExceptionThrower.java
File metadata and controls
46 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.edurekademo.utilities;
import java.io.IOException;
import com.edurekademo.utilities.LoggerStackTraceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExceptionThrower {
private static final Logger LOG=LoggerFactory.getLogger(ExceptionThrower.class);
public void getCounter() {
int i = 1/0; // this will throw the error...
LOG.info(""+i);
}
public void doNothing() throws IOException {
throw new IOException("TESTIOEXCEPTION");
}
private void doXXX() {
try {
doYYY();
String s = null;
if("sss".equals(s)) {
LOG.info("ssss");
}
}
catch (Exception e){
LOG.error(new LoggerStackTraceUtil().getErrorMessage(e));
}
}
private void doYYY() {
LOG.error(new LoggerStackTraceUtil().getErrorMessage(new Exception("DEAR")));
}
public void doCheck() throws Exception {
try {
doXXX();
doNothing();
}
catch (Exception e){
throw new Exception("TEST MESSAGE");
}
}
}