Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364674

Summary: Changing the function name in an interface is not considered a structural change
Product: z_Archived Reporter: Zhi Zhu <zhuzhi>
Component: EDTAssignee: Paul Harmon <pharmon>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cdlwuxin, chenzhh, jqian, jvincens, smythew, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
PI
none
patch lasher: iplog+

Description Zhi Zhu CLA 2011-11-24 02:28:20 EST
1 Define an interface for calling third-part service which contains a function:

  	function search(query string in) returns(GeoNamesData) 
   		{@GetRest {uriTemplate="http://ws.geonames.org/search?q={query}&maxRows=20&username=demo", responseFormat=XML}};

2 When you deploy the app and the URL for calling third-party service like this:
   http://ws.geonames.org/search?q=London

  does not include the parameter "maxRows=20&username=demo"

 for reproducing it, please see attached project
Comment 1 Zhi Zhu CLA 2011-11-24 02:29:31 EST
Created attachment 207460 [details]
PI
Comment 2 Jing Qian CLA 2011-11-24 10:16:41 EST
is this a deployment issue?
Comment 3 Joseph Vincens CLA 2011-11-24 10:50:22 EST
I used the latest build 0.7.0.v201111240901-17D-7zHW3Jmz-AgOXOQAhuz-bajw    

I opened the html page in firebug so I could see the url.

Here's what was sent for XML:
{"uri":"http:\/\/ws.geonames.org\/search?q=BeiJing&maxRows=20&username=demo","headers":{"content-type":"text\/html;
charset=UTF-8"},"body":null,"method":1}

Here's what is sent for JSON:
{"uri":"http:\/\/ws.geonames.org\/searchJSON?q=BeiJing&maxRows=10&username=demo","headers":{"content-type":"text\/html;
charset=UTF-8"},"body":null,"method":1}

both include maxRows=x0&username=demo 

Also if I look at the deployed JS I see
egl.eglx.http.HttpMethod._GET, uri : "http://ws.geonames.org/search?q=" +
egl.eglx.http.HttpLib.convertToURLEncoded(egl.checkNull(this.queryStringField).getText())
+ "&maxRows=20&username=demo"
......
egl.eglx.http.HttpMethod._GET, uri : "http://ws.geonames.org/searchJSON?q=" +
egl.eglx.http.HttpLib.convertToURLEncoded(egl.checkNull(this.queryStringField).getText())
+ "&maxRows=10&username=demo"
.....
Which shows both URLs have the suffix.


I've seen cases where the browser caches the html and js files and I have to
close the browser to refresh it to the newly deployed application.
or is it possible you didn't redeploy after making the change or didn't restart
the server?

If you continue to see the problem please attach your war file so I can deploy
it and reproduce the problem.
Comment 4 Zhi Zhu CLA 2011-11-24 20:06:32 EST
As Joe mentioned this problem is likely related to some cache.

You can easily re-produce it, I will take the attached project as an example:
 1. In IGeoName.egl, define function:
   function search(query string in) returns(GeoNamesData) 
   		{@GetRest {uriTemplate="http://ws.geonames.org/search?q={query}&maxRows=20&username=demo", responseFormat=XML}};

2. Generate target project GeoNamesTest, and deploy project GeoNames to GeoNamesTest, GeoNamesTest/WebContent/handlers/GeoName.js, check this file's 
  "invokeService" function, it contains the segment:
  { method : egl.eglx.http.HttpMethod._GET, uri : "http://ws.geonames.org/search?q=" + egl.eglx.http.HttpLib.convertToURLEncoded(egl.checkNull(this.queryStringField).getText()) + "&maxRows=20&username=demo"

 And some information is generated based on IGeoName's function definition.

3.Change function definition in IGeoName.egl
    function search(query string in) returns(GeoNamesData) 
   		{@GetRest {uriTemplate="http://ws.geonames.org/search?q={query}&maxRows=20", responseFormat=XML}};

4. Re-deploy the project

5. Check "invokeService" from  GeoNamesTest/WebContent/handlers/GeoName.js, one can see: 

  { method : egl.eglx.http.HttpMethod._GET, uri : "http://ws.geonames.org/search?q=" + egl.eglx.http.HttpLib.convertToURLEncoded(egl.checkNull(this.queryStringField).getText()) + "&maxRows=20&username=demo"

is not changed:
  should changed to:
 
{ method : egl.eglx.http.HttpMethod._GET, uri : "http://ws.geonames.org/search?q=" + egl.eglx.http.HttpLib.convertToURLEncoded(egl.checkNull(this.queryStringField).getText()) + "&maxRows=20"

and "&username=demo" is not needed here.
Comment 5 Zhi Zhu CLA 2011-11-24 20:44:46 EST
If you update GeoName.egl(handler) and IGeoName.egl(interface) simultaneously, and deploy the project, all generated files will be updated accordingly
Comment 6 Brian Svihovec CLA 2011-11-24 21:44:16 EST
Regarding the changes in comment 4, if you restart the server, is the problem resolved?  If restarting the server does not resolve the issue, can the issue be resolved by removing and then adding the project back to the server?
Comment 7 Tony Chen CLA 2011-11-24 21:54:56 EST
The problem seemed to be: when uriTemplate in IGeoName was modified. The RUI Handler GeoName was not regenerated to get the new uriTemplate. 

Do a clean, or modify GeoName to make it re-generated will resolve the issue. 

In RBD, when interface changes, the RUI Handler gets regenerated. But this function is not in EDT. 

I think we should close this bug and open an enhancement.
Comment 8 Zhi Zhu CLA 2011-11-24 22:09:27 EST
Regarding to Comment 6, both ways cannot resolve the issue.
The ways in Comment 7 are acceptable
Comment 9 Brian Svihovec CLA 2011-11-24 22:15:25 EST
I changed the title to better reflect this issue, which is a defect and not an enhancement.  I also changed the ownership to Paul Harmon and the component to Compiler.  

We can leave this as P1 for now and we will discuss this in the US on Monday.
Comment 10 Tony Chen CLA 2011-11-28 04:50:34 EST
I encounter some similar problems. When you are developing a database app, and modified your Entity Record, the programs & services using that record do not regenerate and still uses the old annotation information. You'll have to 'touch' it to force a regen to pickup the changes in the record.
Comment 11 Brian Svihovec CLA 2011-11-28 13:35:01 EST
Deferring until Future.  The change is too risky to make at this point in time.
Comment 12 Paul Harmon CLA 2011-11-28 14:19:15 EST
The problem is that the code that "calculates" if a part is structurally changed does not take into account the annotations. Therefore, adding/changing/removing annotations is not considered a structural change.


I am attaching a patch that fixes this problem
Comment 13 Paul Harmon CLA 2011-11-28 14:20:07 EST
Created attachment 207620 [details]
patch
Comment 14 Paul Harmon CLA 2011-12-09 13:54:09 EST
I have committed the change to TypeUtils
Comment 15 Zhi Zhu CLA 2012-01-15 20:36:14 EST
verify and close it