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

Summary: ClassCastException in generated bytecode
Product: java Reporter: _ briansmith <briansmith>
Component: UnsupportedAssignee: issues@java <issues>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:

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.