Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 137281 Details for
Bug 277994
"org is not defined" JavaScript error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to solve the problem
resource-manager-impl-patch.txt (text/plain), 9.83 KB, created by
Igor Pavlenko
on 2009-05-27 04:16:55 EDT
(
hide
)
Description:
Patch to solve the problem
Filename:
MIME Type:
Creator:
Igor Pavlenko
Created:
2009-05-27 04:16:55 EDT
Size:
9.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java,v >retrieving revision 1.4 >diff -u -r1.4 ResourceManagerImpl.java >--- src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java 12 Jun 2008 13:12:16 -0000 1.4 >+++ src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java 27 May 2009 07:39:36 -0000 >@@ -46,6 +46,7 @@ > private ClassLoader loader; > private ThreadLocal contextLoader; > private JsConcatenator jsConcatenator; >+ private Object jsConcatenatorLock = new Object(); > > private static final class Resource { > /** the 'raw' content of the resource. In case of a text resource (charset >@@ -157,8 +158,6 @@ > } > return result; > } >- >- > ////////////////////// > // interface Adaptable > >@@ -166,32 +165,41 @@ > Object result = null; > if( adapter == JsConcatenator.class ){ > if( jsConcatenator == null ) { >- jsConcatenator = new JsConcatenator() { >- private String content; >- private boolean registered = false; >- public String getLocation() { >- String concatedName = "rap.js"; >- if( !registered ) { >- byte[] content = getContent().getBytes(); >- register( concatedName, >- new ByteArrayInputStream( content ), >- HTML.CHARSET_NAME_UTF_8, >- RegisterOptions.VERSION ); >- registered = true; >- } >- return ResourceManagerImpl.this.getLocation( concatedName ); >- } >- >- public void startJsConcatenation() { >- ResourceUtil.startJsConcatenation(); >- } >- public String getContent() { >- if( content == null ) { >- content = ResourceUtil.getJsConcatenationContentAsString(); >- } >- return content; >+ synchronized( jsConcatenatorLock ) { >+ if (jsConcatenator == null) { >+ jsConcatenator = new JsConcatenator() { >+ private String content; >+ private boolean registered = false; >+ private Object registeredLock = new Object(); >+ public String getLocation() { >+ String concatedName = "rap.js"; >+ if( !registered ) { >+ synchronized( registeredLock ) { >+ if( !registered ) { >+ byte[] content = getContent().getBytes(); >+ register( concatedName, >+ new ByteArrayInputStream( content ), >+ HTML.CHARSET_NAME_UTF_8, >+ RegisterOptions.VERSION ); >+ registered = true; >+ } >+ } >+ } >+ return ResourceManagerImpl.this.getLocation( concatedName ); >+ } >+ >+ public void startJsConcatenation() { >+ ResourceUtil.startJsConcatenation(); >+ } >+ public String getContent() { >+ if( content == null ) { >+ content = ResourceUtil.getJsConcatenationContentAsString(); >+ } >+ return content; >+ } >+ }; > } >- }; >+ } > } > result = jsConcatenator; > } >@@ -228,15 +236,17 @@ > ParamCheck.notNull( name, "name" ); > ParamCheck.notNull( is, "is" ); > String key = createKey( name ); >- try { >- int[] content = ResourceUtil.readBinary( is ); >- doRegister( name, null, RegisterOptions.NONE, key, content ); >- } catch ( IOException e ) { >- String text = "Failed to register resource ''{0}''."; >- String msg = MessageFormat.format( text, new Object[] { name } ); >- throw new ResourceRegistrationException( msg, e ) ; >+ synchronized( repository ) { >+ try { >+ int[] content = ResourceUtil.readBinary( is ); >+ doRegister( name, null, RegisterOptions.NONE, key, content ); >+ } catch ( IOException e ) { >+ String text = "Failed to register resource ''{0}''."; >+ String msg = MessageFormat.format( text, new Object[] { name } ); >+ throw new ResourceRegistrationException( msg, e ) ; >+ } >+ repository.put( key, name ); > } >- repository.put( key, name ); > } > > public void register( final String name, >@@ -250,15 +260,17 @@ > ParamCheck.notNull( options, "options" ); > boolean compress = shouldCompress( options ); > String key = createKey( name ); >- try { >- int[] content = ResourceUtil.read( is, charset, compress ); >- doRegister( name, charset, options, key, content ); >- } catch ( IOException e ) { >- String text = "Failed to register resource ''{0}''."; >- String msg = MessageFormat.format( text, new Object[] { name } ); >- throw new ResourceRegistrationException( msg, e ) ; >+ synchronized( repository ) { >+ try { >+ int[] content = ResourceUtil.read( is, charset, compress ); >+ doRegister( name, charset, options, key, content ); >+ } catch ( IOException e ) { >+ String text = "Failed to register resource ''{0}''."; >+ String msg = MessageFormat.format( text, new Object[] { name } ); >+ throw new ResourceRegistrationException( msg, e ) ; >+ } >+ repository.put( key, name ); > } >- repository.put( key, name ); > } > > public String getCharset( final String name ) { >@@ -270,16 +282,20 @@ > public boolean isRegistered( final String name ) { > ParamCheck.notNull( name, "name" ); > String key = createKey( name ); >- String fileName = ( String )repository.get( key ); >- return fileName != null; >+ synchronized( repository ) { >+ String fileName = ( String )repository.get( key ); >+ return fileName != null; >+ } > } > > public String getLocation( final String name ) { > ParamCheck.notNull( name, "name" ); > String key = createKey( name ); >- String fileName = ( String )repository.get( key ); >- Assert.isNotNull( fileName, "No resource registered for key " + name ); >- return createRequestURL( fileName, findVersion( name ) ); >+ synchronized( repository ) { >+ String fileName = ( String )repository.get( key ); >+ Assert.isNotNull( fileName, "No resource registered for key " + name ); >+ return createRequestURL( fileName, findVersion( name ) ); >+ } > } > > public URL getResource( final String name ) { >@@ -316,18 +332,20 @@ > public InputStream getRegisteredContent( final String name ) { > InputStream result = null; > String key = createKey( name ); >- String fileName = ( String )repository.get( key ); >- if( fileName != null ) { >- // TODO [rst] Works only for non-versioned content for now >- File file = getDiskLocation( name, null ); >- try { >- result = new FileInputStream( file ); >- } catch( FileNotFoundException e ) { >- // should not happen >- throw new RuntimeException( e ); >+ synchronized( repository ) { >+ String fileName = ( String )repository.get( key ); >+ if( fileName != null ) { >+ // TODO [rst] Works only for non-versioned content for now >+ File file = getDiskLocation( name, null ); >+ try { >+ result = new FileInputStream( file ); >+ } catch( FileNotFoundException e ) { >+ // should not happen >+ throw new RuntimeException( e ); >+ } > } >+ return result; > } >- return result; > } > > ////////////////// >@@ -383,11 +401,15 @@ > private String doLoad( final String resource ) { > String key = createKey( resource ); > if( !repository.containsKey( key ) ) { >- try { >- register( resource ); >- } catch( ResourceRegistrationException e ) { >- // application file which is not managed by the resource manager >- repository.put( key, resource ); >+ synchronized( repository ) { >+ if ( !repository.containsKey( key ) ) { >+ try { >+ register( resource ); >+ } catch( ResourceRegistrationException e ) { >+ // application file which is not managed by the resource manager >+ repository.put( key, resource ); >+ } >+ } > } > } > return createRequestURL( resource, null ); >@@ -401,16 +423,20 @@ > // TODO [rh] should throw exception if contains key but has different > // charset or options > if( !repository.containsKey( key ) ) { >- boolean compress = shouldCompress( options ); >- try { >- int[] content = ResourceUtil.read( name, charset, compress ); >- doRegister( name, charset, options, key, content ); >- } catch ( IOException e ) { >- String text = "Failed to register resource ''{0}''."; >- String msg = MessageFormat.format( text, new Object[] { name } ); >- throw new ResourceRegistrationException( msg, e ) ; >+ synchronized( repository ) { >+ if ( !repository.containsKey( key ) ) { >+ boolean compress = shouldCompress( options ); >+ try { >+ int[] content = ResourceUtil.read( name, charset, compress ); >+ doRegister( name, charset, options, key, content ); >+ } catch ( IOException e ) { >+ String text = "Failed to register resource ''{0}''."; >+ String msg = MessageFormat.format( text, new Object[] { name } ); >+ throw new ResourceRegistrationException( msg, e ) ; >+ } >+ repository.put( key, name ); >+ } > } >- repository.put( key, name ); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 277994
: 137281