Re: RE: Re: FileNotFoundException when loading interface ClassNode

Peter Veentjer <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
I think I have solved the issue. I guess it was related to
maven/intellij integration somehow. A clean build fixed the issue. So
I'm off to the next problem :)

On Mon, Mar 1, 2010 at 9:04 PM, Tim Eck <[email protected]> wrote:
> I agree with Eugene here, something seems off. What is the stack trace of
> the FileNotFoundException?
>
>> -----Original Message-----
>> From: Eugene Kuleshov [mailto:[email protected]]
>> Sent: Monday, March 01, 2010 8:08 AM
>> To: [email protected]
>> Subject: [asm] Re: FileNotFoundException when loading interface
>> ClassNode
>>
>>   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
>> >
>> >
>
>
> --
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.