google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

Extra class diagram generated when renaming the class in the code section #503

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Draw a class diagram in the canvas
2. In the code section, rename the class name

What is the expected output?
I should expect a class diagram drew to be renamed.

What do you see instead?
I see an extra class diagram generated.

What version of the product are you using? On what operating system?
Tested with Chrome & Safari & Firefox. Mac OS X 10.9.1

Please provide any additional information below.

Original issue reported on code.google.com by cmw...@cornell.edu on 9 Feb 2014 at 5:37

GoogleCodeExporter commented 9 years ago
Image Attached.

Original comment by cmw...@cornell.edu on 9 Feb 2014 at 5:41

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 13 Feb 2014 at 8:52

GoogleCodeExporter commented 9 years ago
The issue is that when one changes the class name in the code section, the 
class name in the layout editor does not change. The model generator thinks 
that there are two different classes.

Original comment by cmw...@cornell.edu on 15 Feb 2014 at 2:54

GoogleCodeExporter commented 9 years ago
I think the "id" of the dom element of the class model should be assigned as a 
number rather than the class name.

Original comment by CharlesH...@gmail.com on 17 Feb 2014 at 6:58

GoogleCodeExporter commented 9 years ago
May have solved this issue.
Performing test.
The only modified file is umpleonline/scripts/compiler_config.php .

There are two problems with this issue.
First problem is listed in Issue 542.
Second problem is in the compiler_config.php, the right actionCode has not been 
sent.
The double quotes in the actionCode (json) are required to be escaped e.g. \" .
Lastly the first and last double quotes should not be escaped.

Will submit a patch shortly.

The demo file is attached.

Original comment by cmw...@cornell.edu on 21 Apr 2014 at 8:03

Attachments:

GoogleCodeExporter commented 9 years ago
I am adding a more detailed explanation.

As one creates a class, move it, and rename it, a form data of (removed some 
characters for display purpose):

action=addPositioning&actionCode=<p>URL_SPLIT{"umpleClasses":[{"po....ciations":
[] }&...filename=../ump/tmp449776/model.ump

is sent to the php.

In the function handleUmpleTextChange() inside the compile_config.php, a java 
command is executed. It sends this format to the server:

java -jar umplesync.jar -addPositioning 
"\<p\>URL_SPLIT{"umpleClasses":[{"position": {"x": 
50.”………umpleAssociations":[] }" ../ump/tmp777086/model.ump

Firstly, \<p\>URL_SPLIT needs to be removed in the actionCode as the 
UmpleSync_Code.ump's json parser will always cause its ParserResult to fail. 
This will send back the original umpleCode with the layout code not cleaned 
(the old class still remained). The javascript files will parse the umpleCode 
and as a result, will generate an extra class diagram.

Secondly, the double quotes in the actionCode need to be escaped. A shell 
command is executed from the php and that without escaping the characters, it 
thinks as multiple arguments are sent. By escaping the double quotes, the 
actionCode is sent as one argument.

Thirdly, the escaped double quotes in the beginning and the end of the 
actionCode needs to be replaced by non-escaped double quotes, which is 
interpreted as a string in a shell.

So, by performing these, the result looks like:

java -jar umplesync.jar -addPositioning "{\"umpleClasses\":[{\"position\": 
{\"x\": 50.”………umpleAssociations\":[] }" ../ump/tmp777086/model.ump

The result of this command returns an umpleCode with a layout part cleaned. 

Original comment by cmw...@cornell.edu on 21 Apr 2014 at 2:38

GoogleCodeExporter commented 9 years ago
For the <p>URL_SPLIT, see Issue 542

Original comment by CharlesH...@gmail.com on 21 Apr 2014 at 4:27

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 26 Apr 2014 at 6:51