forked from actframework/actframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRythmError.java
More file actions
70 lines (55 loc) · 1.7 KB
/
RythmError.java
File metadata and controls
70 lines (55 loc) · 1.7 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package act.view;
import act.app.SourceInfo;
import org.osgl.util.C;
import org.rythmengine.exception.RythmException;
import java.util.List;
public class RythmError extends ActServerError {
private SourceInfo templateInfo;
public RythmError(RythmException t) {
super(t);
}
public RythmException rythmException() {
return (RythmException) getCause();
}
public SourceInfo templateSourceInfo() {
return templateInfo;
}
@Override
protected void populateSourceInfo(Throwable t) {
RythmException re = (RythmException) t;
sourceInfo = new RythmSourceInfo(re, true);
templateInfo = new RythmSourceInfo(re, false);
}
private static class RythmSourceInfo implements SourceInfo {
RythmSourceInfo(RythmException e, boolean javaSource) {
fileName = e.templateName;
if (javaSource) {
lineNumber = e.javaLineNumber;
String jsrc = e.javaSource;
lines = null != jsrc ? C.listOf(jsrc.split("[\n]")) : C.<String>list();
} else {
lineNumber = e.templateLineNumber;
lines = C.listOf(e.templateSource.split("[\n]"));
}
}
private String fileName;
private List<String> lines;
private int lineNumber;
@Override
public String fileName() {
return fileName;
}
@Override
public List<String> lines() {
return lines;
}
@Override
public Integer lineNumber() {
return lineNumber;
}
@Override
public boolean isSourceAvailable() {
return true;
}
}
}