This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 25652 - ClassCastException in generated bytecode
Summary: ClassCastException in generated bytecode
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-16 06:30 UTC by _ briansmith
Modified: 2002-07-19 15:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ briansmith 2002-07-16 06:30:43 UTC
Martin wrote: "In the current version of MDR you
should get no exception from the generated
bytecode directly. Send me the stacktrace if you
are unable to track it down." 

     [java] parser exception:
java.lang.ClassCastException
     [java] java.lang.ClassCastException
     [java]     at
javax.jmi.model.IsOfType$Impl._add(Unknown Source)
     [java] [Model, ModelElement, name]
     [java] [Model, ModelElement]
     [java] [Model]
     [java]     at
org.netbeans.mdr.handlers.InstanceHandler._handleSetR(Instanc
eHandler.java:127)
     [java]     at
org.netbeans.mdr.handlers.InstanceHandler._setReference(Insta
nceHandler.java:55)
     [java]     at
org.netbeans.mdr.handlers.InstanceHandler.refSetValue(Instanc
eHandler.java:272)
     [java]     at
org.brianlsmith.ssm.parser.ModelElementFactory.link(ModelElem
entFactory.java:207)
     [java]     at
org.brianlsmith.ssm.parser.SsmRepositoryLoader.main(SsmReposi
toryLoader.java:22)
Comment 1 _ briansmith 2002-07-16 06:38:07 UTC
Note, that this is very likely an error in my code and I merely
reported it because Martin said that no exceptions should ever
originate from the generated bytecode.

The cause of the exception was code like this:
    void foo(Attribute attr, MofPackage pkg) {
       attr.refSetValue("type", pkg);
    }

Obviously, this was an error in my code. But I believe that you need
to check for TypeMismatchException before the generated bytecode is
called (per Martin's comment quoted above).
Comment 2 Martin Matula 2002-07-16 08:04:39 UTC
You are absolutely right Brian. Thanks.
Comment 3 Martin Matula 2002-07-18 11:49:59 UTC
Should be fixed.