[ http://issues.apache.org/jira/browse/SANDBOX-174?page=all ]
Maurizio Pillitu updated SANDBOX-174: ------------------------------------- Attachment: commons-jci.diff > ClassFormatException during Javaflow class enhancement > ------------------------------------------------------ > > Key: SANDBOX-174 > URL: http://issues.apache.org/jira/browse/SANDBOX-174 > Project: Commons Sandbox > Issue Type: Bug > Components: JCI > Reporter: Maurizio Pillitu > Attachments: commons-jci.diff > > > org.apache.bcel.classfile.ClassFormatException: null is not a Java .class file > at org.apache.bcel.classfile.ClassParser.readID(ClassParser.java:286) > at org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:155) > at > org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer.transform(BcelClassTransformer.java:117) > at > org.apache.commons.javaflow.stores.TransformingResourceStore.write(TransformingResourceStore.java:50) > at > org.apache.commons.javaflow.stores.JavaflowResourceStore.onStop(JavaflowResourceStore.java:81) > at > org.apache.cocoon.components.flow.java.JavaflowResourceStore.onStop(JavaflowResourceStore.java:101) > at > org.apache.commons.jci.listeners.ReloadingListener.onStop(ReloadingListener.java:120) > at > org.apache.commons.jci.monitor.FilesystemAlterationMonitor.onStop(FilesystemAlterationMonitor.java:261) > at > org.apache.commons.jci.monitor.FilesystemAlterationMonitor.run(FilesystemAlterationMonitor.java:420) > at java.lang.Thread.run(Thread.java:595) > The exception is triggered because the bytecode of the .class file is not > recognized; the error resides in > org.apache.commons.jci.listeners.ReloadingListener, that uses a FileReader > to read the file and converts it in a stream of characters : > ......... > final File file = (File) it.next(); > try { > final byte[] bytes = IOUtils.toByteArray(new > FileReader(file)); > final String resourceName = > ReloadingClassLoader.clazzName(repository, file); > //if (resourceName.endsWith(".class")) { > store.write(resourceName, bytes); > ........ > Using FileInputStream it works correctly; all relevant tests work. > Attaching patch. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]