Re: FileNotFoundException when loading interface ClassNode
Eugene Kuleshov <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Unless I am missing something, that likely doesn't have much to do with ASM. Also, I can't see how ClassReader could throw a FileNotFoundException (not in ASM 3 API anyways). You need to check the value of classInternalForm and maybe also add the leading slash to it in order to tell the classloader to look at the exact folder/package. regards, Eugene On Mon, Mar 1, 2010 at 10:48 AM, Peter Veentjer <[email protected]> wrote: > Hi Guys, > > I have the following problem: when I try to load interfaces the system > is not able to find the resource. > > public static ClassNode loadAsClassNode(ClassLoader loader, String > classInternalForm) { > if (loader == null || classInternalForm == null) { > throw new NullPointerException(); > } > > String fileName = classInternalForm + ".class"; > InputStream is = loader.getResourceAsStream(fileName); > > try { > ClassNode classNode = new ClassNode(); > ClassReader reader = new ClassReader(is); > reader.accept(classNode, ClassReader.EXPAND_FRAMES); > return classNode; > } catch (FileNotFoundException ex) { > throw new RuntimeException(format("Could not find file > '%s' for class '%s': ", > fileName, > classInternalForm)); > } catch (IOException e) { > throw new RuntimeException("A problem ocurred while > loading class: " + fileName, e); > } > } > > In the case of an interface, I get the FileNotFoundException, so this > means that I don't get the chance > to enhance interfaces. I work on an STM and for every transactional > method of an interface, I add an additional > one that also is able to receive a transaction). > > The strange thing is that it works perfectly for classes (that are > exact the same directory). So something must be working good. > > PS: the classloader is the one that is received in the JavaAgent, so I > don't have the impression that that is the cause. > > > -- > You receive this message as a subscriber of the [email protected] mailing list. > To unsubscribe: mailto:[email protected] > For general help: mailto:[email protected]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > >
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws