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

Bug 277994

Summary: "org is not defined" JavaScript error
Product: [RT] RAP Reporter: Igor Pavlenko <dopperst>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: b.muskalla, Istvan.Ballok, jboehme, stefan.roeck, swimmer_86
Version: 1.2   
Target Milestone: 1.5 M1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch to solve the problem none

Description Igor Pavlenko CLA 2009-05-27 04:10:39 EDT
Sometimes user browser can get a corrupted JavaSript.

It is difficult to redproduce becouse of this is a bug with synchronization.
But if you can run your application id debug mode you can set a breakpoint in org.eclipse.rwt.internal.resources.ResourceUtil.write(File, int[]). Run your app and try to open your application twice (in two browser instances, for example).

You will see more than one thread stopped on your breakpoint.

Look at the org.eclipse.rwt.internal.resources.ResourceUtil.write(File, int[]) againt. As you can see, this method works with jsConcatenationBuffer static field.

It is a bad thing.
Comment 1 Igor Pavlenko CLA 2009-05-27 04:16:55 EDT
Created attachment 137281 [details]
Patch to solve the problem

All calls of the org.eclipse.rwt.internal.resources.ResourceUtil.write(File, int[]) method are in the org.eclipse.rwt.internal.resources.ResourceManagerImpl.

So it is possible to add some synchronization code in ResourceManagerImpl to solve described problem.

I do not know if this patch solves the problem with "org is not defined", but I cannot reproduce the problem with this patch (and I can without it). But this solves the problem with asynchronous call of the ResourceUtil.write.
Comment 2 Ralf Sternberg CLA 2009-08-05 06:54:03 EDT
Thanks for the patch, Igor. We are aware of this issue but as it only affects the first request after launch, we do not consider this highest priority.

The very first request to a RAP application must always run uninterrupted. After this, everything should be thread-safe.
Comment 3 Ralf Sternberg CLA 2011-11-28 10:46:52 EST
This issue has been fixed by the introduction of the ApplicationContext. Since RAP 1.5M1, the resources are not registered by the first session anymore, but by activating an ApplicationContext on server start. This happens before the RWT servlet is even registered. Therefore, the breakpoint mentioned in the original post is now only reached once from ApplicationContext#activate().
Comment 4 Ivan Furnadjiev CLA 2012-03-22 08:57:35 EDT
*** Bug 374934 has been marked as a duplicate of this bug. ***