[Uml-devel] KDE/kdesdk/umbrello/umbrello/codeimport

Oliver Kellogg okellogg at users.sourceforge.net
Mon Feb 13 07:25:51 UTC 2012


SVN commit 1279716 by okellogg:

parseStmt(): Check for keyword == "<" and skipToClosing('<') short before
expecting `keyword' to be a type name. If `keyword' is then not a type name,
avoid accessing m_klass in the error message if m_klass is NULL.

CCBUG: 293770


 M  +16 -1     javaimport.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #1279715:1279716
@@ -273,7 +273,7 @@
 bool JavaImport::parseStmt()
 {
     const int srcLength = m_source.count();
-    const QString& keyword = m_source[m_srcIndex];
+    QString keyword = m_source[m_srcIndex];
     //uDebug() << '"' << keyword << '"';
     if (keyword == "package") {
         m_currentPackage = advance();
@@ -469,13 +469,28 @@
             uError() << "importJava: too many }";
         return true;
     }
+    if (keyword == "<") {  // @todo generic parameters
+        if (! skipToClosing('<')) {
+            uError() << "importJava(" << keyword << "): template syntax error";
+            return false;
+        }
+        advance();
+        if (m_srcIndex == srcLength)
+            return false;
+	keyword = m_source[m_srcIndex];
+    }
     // At this point, we expect `keyword' to be a type name
     // (of a member of class or interface, or return type
     // of an operation.) Up next is the name of the attribute
     // or operation.
     if (! keyword.contains( QRegExp("^\\w") )) {
+	if (m_klass) {
         uError() << "importJava: ignoring " << keyword <<
             " at " << m_srcIndex << ", " << m_source.count() << " in " << m_klass->name();
+	} else {
+            uError() << "importJava: ignoring " << keyword <<
+                " at " << m_srcIndex << ", " << m_source.count() << " (outside class)";
+	}
         return false;
     }
     QString typeName = m_source[m_srcIndex];




More information about the umbrello-devel mailing list