(ClassLoader loader, String className, Class<?> classBeingRedefined,
ProtectionDomain protectionDomain, byte[] classfileBuffer)
| 12 | |
| 13 | public class Swinghtml implements ClassFileTransformer { |
| 14 | public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, |
| 15 | ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { |
| 16 | if(className.equals("javax/swing/plaf/basic/BasicHTML")){ |
| 17 | try { |
| 18 | ClassPool classPool = ClassPool.getDefault(); |
| 19 | classPool.appendClassPath(new LoaderClassPath(loader)); |
| 20 | CtClass clazz = classPool.makeClass(new ByteArrayInputStream(classfileBuffer), false); |
| 21 | CtMethod method = clazz.getDeclaredMethod("isHTMLString"); |
| 22 | method.setBody("return false;"); |
| 23 | System.out.println("Successfully Patched."); |
| 24 | return clazz.toBytecode(); |
| 25 | } catch (Exception e) { |
| 26 | e.printStackTrace(); |
| 27 | System.out.println("Patch Failed."); |
| 28 | } |
| 29 | } |
| 30 | return null; |
| 31 | } |
| 32 | } |
nothing calls this directly
no outgoing calls
no test coverage detected