Login | Register
My pages Projects Community openCollabNet

Discussions > Notification of Issues > FIX / RE: [argouml-bugs] [Bug 291] New - Class Cast Exception wi th Tagged values

argouml
Discussion topic

Back to topic list

FIX / RE: [argouml-bugs] [Bug 291] New - Class Cast Exception wi th Tagged values

Author "Edward J dot Lyons Jr dot " <ed at netnumina dot com>
Full name "Edward J dot Lyons Jr dot " <ed at netnumina dot com>
Date 2001-01-04 17:27:22 PST
Message Hi Guys -

Well, since I don't have commit rights, here is a fix for Bug 291, which I
just submitted. (This is for 0.9 release of argo)

The error is in org.argouml.language​.java.generator.Gene​ratorJava. Here is
the original and fixed code... ( I tested the fix and it works )

Original Code Lines 352 - 365 GeneratorJava.java :

*****************

public String generateTaggedValues​(MModelElement e) {
    Collection tvs = e.getTaggedValues();
    if (tvs == null || tvs.size() == 0) return "";
    String s = "// {";
    int size = tvs.size();
    MTaggedValue[] tvsarray = (MTaggedValue[])tvs.toArray();
    for (int i = 0; i < size; i++) {
      MTaggedValue tv = (MTaggedValue) tvsarray[i];
      s += generateTaggedValue(tv);
      if (i < size-1) s += ", ";
    }
    s += "}\n";
    return s;
  }
  
  
Fixed Code:

*****************

public String generateTaggedValues​(MModelElement e) {
   Collection tvs = e.getTaggedValues();
   Object[] tvsArray = tvs.toArray();

    if (tvsArray == null || tvsArray.length == 0) return "";
    String s = "// {";
    int size = tvsArray.length;

    for (int i = 0; i < size; i++) {
      MTaggedValue tv = (MTaggedValue) tvsArray[i];
      s += generateTaggedValue(tv);
      if (i < size-1) s += ", ";
    }
    s += "}\n";
    return s;
  }

Let me know if you have any questions.

Ed Lyons

-----Original Message-----
From: bugmaster at tigris dot org [mailto:bugmaster at tigris dot org]
Sent: Thursday, January 04, 2001 8:08 PM
To: bugs at argouml dot tigris dot org
Subject: [argouml-bugs] [Bug 291] New - Class Cast Exception with Tagged
values


http://www.tigris.or​g/bugs/show_bug.cgi?​id=291

*** shadow/291 Thu Jan 4 17:08:15 2001
--- shadow/291.tmp.8543 Thu Jan 4 17:08:15 2001
***************
*** 0 ****
--- 1,34 ----
+ Bug#: 291
+ Product: argouml
+ Version: 0.9
+ Platform: PC
+ OS/Version: Windows NT
+ Status: NEW
+ Resolution:
+ Severity: normal
+ Priority: P2
+ Component: src
+ Area: BUILD
+ AssignedTo: bugs at argouml dot tigris dot org
+ ReportedBy: ed at netnumina dot com
+ URL:
+ Summary: Class Cast Exception with Tagged values
+
+ Well, this is a ClassCastException being generated on line 352 of:
+
+ org.argouml.language​.java.generator.Gene​ratorJava
+
+ The offending line is:
+
+ MTaggedValue[] tvsarray = (MTaggedValue[])tvs.toArray();
+
+ You can cause this error in several ways. The most obvious is the
following:
+
+ 1. Create a new class
+ 2. Go to the tagged values tab and create a new tag and value
+ 3. Mouse click on that class in the navigator pane
+ 4. Exception will appear and screw things up
+
+ I will submit the fix very soon.
+
+ Ed

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

FIX / RE: [argouml-bugs] [Bug 291] New - Class Cast Exception wi th Tagged values "Edward J dot Lyons Jr dot " <ed at netnumina dot com> "Edward J dot Lyons Jr dot " <ed at netnumina dot com> 2001-01-04 17:27:22 PST
Messages per page: