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