commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maurizio Pillitu (JIRA)" <j...@apache.org>
Subject [jira] Created: (SANDBOX-174) ClassFormatException during Javaflow class enhancement
Date Sat, 23 Sep 2006 16:23:22 GMT
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message