Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-15428 - No JAX-RS problems when importing a project that contains HTTPMethod annotation without @Target and @Retention #93

Merged
merged 1 commit into from Oct 17, 2013

Conversation

xcoulon
Copy link
Member

@xcoulon xcoulon commented Oct 10, 2013

Added accepted change event on a project: RESOLVED_CLASSPATH. This event is triggered when m2e adds the dependencies as libraries to the
project. In that case, a metamodel build should be triggered as it may resolve some compilation problems.

Move the call the JaxrsMetamodel#setBuildStatus() to finally{} blocks of JaxrsMetamodel#processXXX() methods

Adjusted some javadoc, log messages and catch() blocks (avoiding to catch Exception or Throwable)

Also, added a few synchronized() blocks to avoid concurrent access to the metamodel by different threads, for example if an async build
is still running and the validation is started. This avoids the following type of error:

{code}
!ENTRY org.jboss.tools.common 4 0 2013-10-09 18:17:54.307
!MESSAGE
!STACK 0
org.jboss.tools.common.validation.JBTValidationException
at org.jboss.tools.common.validation.ValidatorManager.validateInJob(ValidatorManager.java:101)
at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:78)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$ValueIterator.next(HashMap.java:822)
at org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator.validateAll(JaxrsMetamodelValidator.java:268)
at org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator.validate(JaxrsMetamodelValidator.java:153)
at org.jboss.tools.common.validation.ValidatorManager.validate(ValidatorManager.java:117)
at org.jboss.tools.common.validation.ValidatorManager.validateInJob(ValidatorManager.java:81)
... 2 more
{code}

new ResourceDelta(WtpUtils.getWebDeploymentDescriptor(getProject()), ADDED, 0), progressMonitor);
public synchronized void processProject(final IProgressMonitor progressMonitor) throws CoreException {
// avoid concurrent access on
synchronized(this) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having both synchronized on method and then synchronized(this) means the same thing afaik.

…ns HTTPMethod annotation without @target and @retention

Skipping the Java ElementChangeEvents when the Java Project is not open yet. This avoids race conditions during import.
Bonus: import seem to be twice as fast as before ;-)

Other changes:
- Move the call the JaxrsMetamodel#setBuildStatus() to finally{} blocks of JaxrsMetamodel#processXXX() methods
- Adjusted some javadoc, log messages and catch() blocks (avoiding to catch Exception or Throwable)
- Added a ReadWriteLock on all public methods of the JaxrsMetamodel to avoid concurrent access to the metamodel by different threads, for example if an async build
is still running and the validation is started. This avoids the following type of error:

{code}
!ENTRY org.jboss.tools.common 4 0 2013-10-09 18:17:54.307
!MESSAGE
!STACK 0
org.jboss.tools.common.validation.JBTValidationException
	at org.jboss.tools.common.validation.ValidatorManager.validateInJob(ValidatorManager.java:101)
	at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:78)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
	at java.util.HashMap$ValueIterator.next(HashMap.java:822)
	at org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator.validateAll(JaxrsMetamodelValidator.java:268)
	at org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator.validate(JaxrsMetamodelValidator.java:153)
	at org.jboss.tools.common.validation.ValidatorManager.validate(ValidatorManager.java:117)
	at org.jboss.tools.common.validation.ValidatorManager.validateInJob(ValidatorManager.java:81)
	... 2 more
{code}

- added some tests to increase code coverage
@maxandersen
Copy link
Member

+1 (see jira)

@xcoulon xcoulon merged commit b4db78c into jbosstools:jbosstools-4.1.x Oct 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants