1
2
3
4
5
6
7
8 package it.imolinfo.jbi4ejb.webservice.generator.bcm;
9
10 import it.imolinfo.jbi4ejb.Logger;
11 import it.imolinfo.jbi4ejb.LoggerFactory;
12
13 import org.objectweb.asm.ClassAdapter;
14 import org.objectweb.asm.ClassVisitor;
15 import org.objectweb.asm.MethodVisitor;
16
17
18
19
20 public class AddExceptionSuperclass extends ClassAdapter {
21
22
23
24 private static final Logger LOG
25 = LoggerFactory.getLogger(AddExceptionSuperclass.class);
26
27
28
29
30
31
32
33
34 public AddExceptionSuperclass(ClassVisitor cv) {
35 super(cv);
36 }
37
38
39
40
41
42
43
44
45
46
47
48
49 public void visit(int version,
50 int access,
51 String name,
52 String signature,
53 String superName,
54 String [] interfaces) {
55
56 LOG.debug("Adding the java.lang.Exception superclass to class: " + name);
57
58
59 String javaLangExceptionClassName = "java/lang/Exception";
60
61 super.visit(version, access, name, signature, javaLangExceptionClassName, interfaces);
62 }
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 public MethodVisitor visitMethod(int access,
83 String name,
84 String desc,
85 String signature,
86 String[] exceptions) {
87
88 LOG.debug(">>>>> visitMethod - begin");
89
90
91 if ("<init>".equals(name)) {
92
93 LOG.debug("Default constructor modifications of the class:" + name);
94
95 return null;
96
97 }
98 return super.visitMethod(access, name, desc, signature, exceptions);
99 }
100
101
102 }