Bug 130792 - importing java class (enum pattern) cause umbrello to hang
Summary: importing java class (enum pattern) cause umbrello to hang
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-14 02:37 UTC by JP Fournier
Modified: 2006-07-16 09:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JP Fournier 2006-07-14 02:37:49 UTC
Version:           compiled snapshot - kdesdk-561582 - umbrello 1.5.4 (using KDE KDE 3.5.0)
Installed from:    Slackware Packages
Compiler:          gcc 3.4.4 
OS:                Linux

importing this class causes umbrello to prompt for seversl class names and then the gui hangs.



import java.io.*;


public final class Visibility   implements Serializable {

	public static final Visibility  PUBLIC = 
			new Visibility("public",  "public" );
	public static final Visibility  PROTECTED = 
			new Visibility("protected",  "protected" );
	public static final Visibility  PRIVATE = 
			new Visibility("private", "private" );
	public static final Visibility  PACKAGE = 
			new Visibility ("",  "package" );

	private static Visibility[] all = {
		PUBLIC, PROTECTED, PRIVATE, PACKAGE
	};

	private String value;
	private String display;

	private Visibility( String newValue, String newDisplay ) {
		value = newValue;
		display = newDisplay;
	}		

	public String toString() {
		return display;
	}		

	public String getValue() {
		return value;
	}

	public boolean isValidForClass() {
		return ( this != PROTECTED ); 
	}	

	public static Visibility[] getAllValues() {
		return all;
	}	
	
	public  Visibility internalize() {
		for (int index=0; index < all.length; index ++ )
			if ( all[index].value.equals( this.value ) )
				return all[index];
		return PACKAGE;		
	}	

//	private void writeObject(java.io.ObjectOutputStream out)
//     throws IOException {
//
//			out.writeUTF( name );
//	 }
//	 
// 	private void readObject(java.io.ObjectInputStream in)
//     throws IOException, ClassNotFoundException {
//			name = in.readUTF();
//	 }	 
// 

}
Comment 1 JP Fournier 2006-07-15 18:24:07 UTC
The patch below seems to address the crashiness associated with this bug.

regards

jp

jape@puma:~/tmp/uml/kdesdk-561582$ diff -c umbrello-561582/umbrello/javaimport.cpp umbrello/umbrello/javaimport.cpp
*** umbrello-561582/umbrello/javaimport.cpp     2006-07-15 07:24:49.000000000 -0400
--- umbrello/umbrello/javaimport.cpp    2006-07-15 12:17:29.000000000 -0400
***************
*** 285,297 ****
          return false;
      }
      QString typeName = joinTypename();
!     QString name;
!     if (typeName == m_klass->getName()) {
          // Constructor.
          name = typeName;
          typeName = QString::null;
      } else {
!         name = advance();
      }
      if (name.contains( QRegExp("\\W") )) {
          kdError() << "importJava: expecting name in " << name << endl;
--- 285,299 ----
          return false;
      }
      QString typeName = joinTypename();
!     QString name = advance();
!     QString nextToken ;
!     if ((typeName == m_klass->getName()) && (name == "(") ) {
          // Constructor.
+         nextToken = name;
          name = typeName;
          typeName = QString::null;
      } else {
!         nextToken = advance();
      }
      if (name.contains( QRegExp("\\W") )) {
          kdError() << "importJava: expecting name in " << name << endl;
***************
*** 302,308 ****
          kdError() << "importJava: no class set for " << name << endl;
          return false;
      }
-     QString nextToken = advance();
      if (nextToken == "(") {
          // operation
          UMLOperation *op = Import_Utils::makeOperation(m_klass, name);
--- 304,309 ----
Comment 2 Oliver Kellogg 2006-07-16 01:56:13 UTC
Applied in r562848, thanks.
Comment 3 Oliver Kellogg 2006-07-16 09:34:31 UTC
SVN commit 562901 by okellogg:

It doesn't crash or freeze for me now, thanks again JP.
BUG:130792


 M  +1 -0      ChangeLog  
 M  +1 -0      THANKS  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #562900:562901
@@ -4,6 +4,7 @@
 * Fix crash when importing classes from a java file (129107, 130093)
 * Crash after single click on the "UML Model" tree window (126560/129252)
 * Cannot insert transition/association TO fork/join node in activity diagram (129914)
+* Importing java class (enum pattern) cause umbrello to hang (130792)
 * Importing java subinterface before superinterface results in superinterface
   not being treated as an interface (130793)
 * Java import: method and class visibility ignored (130794)
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #562900:562901
@@ -29,6 +29,7 @@
 Jean-Remy Falleri <jr.falleri @gmail.com>
 Andi Fischer <andi.fischer @hispeed.ch>
 Pascal Fleury <fleury @users.sourceforge.net>
+JP Fournier (jfournier121 @rogers.com)
 Gregorio Guidi <g.guidi @sns.it>
 Esben Mose Hansen <esben @despammed.com>
 Olaf Hartig <OleBowle @gmx.de>