Index: src/java/oracle/toplink/essentials/internal/localization/i18n/LoggingLocalizationResource.java =================================================================== RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/localization/i18n/LoggingLocalizationResource.java,v retrieving revision 1.20 diff -c -w -r1.20 LoggingLocalizationResource.java *** src/java/oracle/toplink/essentials/internal/localization/i18n/LoggingLocalizationResource.java 1 Mar 2007 22:17:15 -0000 1.20 --- src/java/oracle/toplink/essentials/internal/localization/i18n/LoggingLocalizationResource.java 9 Mar 2007 10:14:08 -0000 *************** *** 253,258 **** --- 253,259 ---- { "weaver_change_tracking_disabled_not_supported", "Weaving for change tracking not enabled for class [{0}] because it is not supported by the mapping for field [{1}]."}, { "weaver_not_overwriting", "Weaver is not overwriting class {0} because it has not been set to overwrite."}, { "weaver_could_not_write", "Weaver encountered an exception while trying to write class {0} to the file system. The exception was: {1}"}, + { "weaver_failed", "Weaver failed while processing class [{0}]. The exception was: {1}"}, { "relational_descriptor_support_only", "The default table generator currently only supports generating default table schema from a relational project."}, Index: src/java/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java =================================================================== RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java,v retrieving revision 1.7 diff -c -w -r1.7 TraceLocalizationResource.java *** src/java/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java 4 Jan 2007 14:31:26 -0000 1.7 --- src/java/oracle/toplink/essentials/internal/localization/i18n/TraceLocalizationResource.java 9 Mar 2007 10:14:08 -0000 *************** *** 248,253 **** --- 248,254 ---- { "weaver_found_field_lock", "Weaving for change tracking not enabled for class [{0}] because it uses field-based optimisitic locking."}, { "weaver_class_not_in_project", "Weaver found class [{0}] in configuration but not in TopLink project."}, { "weaver_processing_class", "Weaver processing class [{0}]."}, + { "weaver_transformed_class", "Weaver transformed class [{0}]."}, { "cmp_init_invoke_predeploy", "javaSECMPInitializer - predeploying {0}."}, { "cmp_init_register_transformer", "javaSECMPInitializer - registering transformer for {0}."}, { "cmp_init_tempLoader_created", "javaSECMPInitializer - created temporary ClassLoader: {0}."}, Index: src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java =================================================================== RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java,v retrieving revision 1.9 diff -c -w -r1.9 TopLinkWeaver.java *** src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java 31 Aug 2006 02:58:15 -0000 1.9 --- src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java 9 Mar 2007 10:14:08 -0000 *************** *** 51,56 **** --- 51,58 ---- public static final String WEAVING_SHOULD_OVERWRITE = "toplink.weaving.overwrite.existing"; public static final String WEAVER_NOT_OVERWRITING = "weaver_not_overwriting"; public static final String WEAVER_COULD_NOT_WRITE = "weaver_could_not_write"; + public static final String WEAVER_FAILED = "weaver_failed"; + public static final String WEAVER_TRANSFORMED_CLASS = "weaver_transformed_class"; protected Session session; // for logging // Map where the key is className in JVM '/' format *************** *** 86,92 **** --- 88,105 ---- ClassReader cr = new ClassReader(classfileBuffer); ClassWriter cw = new ClassWriter(true, true); TopLinkClassWeaver tcw = new TopLinkClassWeaver(cw, classDetails); + try { cr.accept(tcw, Attributes.getDefaultAttributes(), false); + } catch (Throwable e) { + // RuntimeException or Error could be thrown from ASM + // log here because ClassLoader ignore any Throwable + log(SessionLog.SEVERE, WEAVER_FAILED, new Object[]{className, e}); + log(SessionLog.SEVERE, e); + + IllegalClassFormatException ex = new IllegalClassFormatException(); + ex.initCause(e); + throw ex; + } if (tcw.alreadyWeaved) { return null; } *************** *** 98,103 **** --- 111,117 ---- outputFile(className, bytes, outputPath); } if (tcw.weavedVH) { + log(SessionLog.FINER, WEAVER_TRANSFORMED_CLASS, new Object[]{className}); return bytes; } } *************** *** 126,133 **** file.createNewFile(); } else { if (!System.getProperty(WEAVING_SHOULD_OVERWRITE, "false").equalsIgnoreCase("true")){ ! ((oracle.toplink.essentials.internal.sessions.AbstractSession)session).log( ! SessionLog.WARNING, SessionLog.WEAVER, WEAVER_NOT_OVERWRITING, className); return; } } --- 140,146 ---- file.createNewFile(); } else { if (!System.getProperty(WEAVING_SHOULD_OVERWRITE, "false").equalsIgnoreCase("true")){ ! log(SessionLog.WARNING, WEAVER_NOT_OVERWRITING, new Object[]{className}); return; } } *************** *** 135,142 **** fos.write(classBytes); fos.close(); } catch (Exception e){ ! ((oracle.toplink.essentials.internal.sessions.AbstractSession)session).log( ! SessionLog.WARNING, SessionLog.WEAVER, WEAVER_COULD_NOT_WRITE, className, e); } } --- 148,154 ---- fos.write(classBytes); fos.close(); } catch (Exception e){ ! log(SessionLog.WARNING, WEAVER_COULD_NOT_WRITE, new Object[]{className, e}); } } *************** *** 153,156 **** --- 165,178 ---- } return ""; } + + protected void log(int level, String msg, Object[] params) { + ((oracle.toplink.essentials.internal.sessions.AbstractSession)session).log(level, + SessionLog.WEAVER, msg, params); + } + + protected void log(int level, Throwable t) { + ((oracle.toplink.essentials.internal.sessions.AbstractSession)session).logThrowable(level, + SessionLog.WEAVER, t); + } }