svn commit: r13649 - trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2007-10-09 06:25:07-0700
New Revision: 13649

Modified:
   trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java

Log:
Fixed the failing JUnit tests.


Modified: trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java?view=diff&rev=13649&p1=trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java&p2=trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java&r1=13648&r2=13649
==============================================================================
--- trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java	(original)
+++ trunk/src_new/org/argouml/notation/providers/uml/AttributeNotationUml.java	2007-10-09 06:25:07-0700
@@ -223,7 +223,9 @@
         StringBuilder multiplicity = null;
         String name = null;
         Vector<String> properties = null;
-        StringBuilder stereotype = null;
+        StringBuilder stereotype = null; // This is null as until
+                                // the first stereotype declaration is seen.
+                                // After that it is non-null.
         String token;
         String type = null;
         StringBuilder value = null;
@@ -293,7 +295,7 @@
                     }
                 } else if ("{".equals(token)) {
                     StringBuilder propname = new StringBuilder();
-                    StringBuilder propvalue = null;
+                    String propvalue = null;
 
                     if (properties == null) {
                         properties = new Vector<String>();
@@ -303,7 +305,7 @@
                         if (",".equals(token) || "}".equals(token)) {
                             if (propname.length() > 0) {
                                 properties.add(propname.toString());
-                                properties.add(propvalue.toString());
+                                properties.add(propvalue);
                             }
                             propname = new StringBuilder();
                             propvalue = null;
@@ -320,16 +322,16 @@
                                 throw new ParseException(Translator.localize(
                                         msg, args), st.getTokenIndex());
                             }
-                            propvalue = new StringBuilder();
+                            propvalue = "";
                         } else if (propvalue == null) {
                             propname.append(token);
                         } else {
-                            propvalue.append(token);
+                            propvalue += token;
                         }
                     }
                     if (propname.length() > 0) {
                         properties.add(propname.toString());
-                        properties.add(propvalue.toString());
+                        properties.add(propvalue);
                     }
                 } else if (":".equals(token)) {
                     hasColon = true;
@@ -416,7 +418,8 @@
             LOG.debug("ParseAttribute [name: " + name 
                     + " visibility: " + visibility 
                     + " type: " + type + " value: " + value.toString() 
-                    + " stereo: " + stereotype.toString() 
+                    + " stereo: "
+                    + (stereotype != null ? stereotype.toString() : "null")
                     + " mult: " + multiplicity.toString());
         }
         if (properties != null && LOG.isDebugEnabled()) {
@@ -479,7 +482,8 @@
         }
 
         StereotypeUtility.dealWithStereotypes(attribute, 
-                stereotype.toString(), true);
+                stereotype != null ? stereotype.toString() : null,
+                true);
     }
 
     /*
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.