private Class defineTransformedClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain, ClassFormatError cfe, String source) throws ClassFormatError { // Class format error - try to transform the bytecode and // define the class again // Object[] transformers = ClassFileTransformer.getTransformers(); Class c = null; for (int i = 0; transformers != null && i < transformers.length; i++) { try { // Transform byte code using transformer byte[] tb = ((ClassFileTransformer) transformers[i]).transform(b, off, len); c = defineClass1(name, tb, 0, tb.length, protectionDomain, source); break; } catch (ClassFormatError cfe2) { // If ClassFormatError occurs, try next transformer } } // Rethrow original ClassFormatError if unable to transform // bytecode to well-formed // if (c == null) throw cfe; return c; }
private Class defineTransformedClass(String name, byte[] b, int off, int len, ProtectionDomain pd, ClassFormatError cfe, String source) throws ClassFormatError { // Class format error - try to transform the bytecode and // define the class again // ClassFileTransformer[] transformers = ClassFileTransformer.getTransformers(); Class c = null; if (transformers != null) { for (ClassFileTransformer transformer : transformers) { try { // Transform byte code using transformer byte[] tb = transformer.transform(b, off, len); c = defineClass1(name, tb, 0, tb.length, pd, source); break; } catch (ClassFormatError cfe2) { // If ClassFormatError occurs, try next transformer } } } // Rethrow original ClassFormatError if unable to transform // bytecode to well-formed // if (c == null) throw cfe; return c; }