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

Exception when serializing EMV2 #1327

Closed
philip-alldredge opened this issue Jun 15, 2018 · 6 comments
Closed

Exception when serializing EMV2 #1327

philip-alldredge opened this issue Jun 15, 2018 · 6 comments
Assignees
Milestone

Comments

@philip-alldredge
Copy link
Collaborator

@philip-alldredge philip-alldredge commented Jun 15, 2018

Using the test case below, an exception is thrown. This was found while working with the graphical editor. In the graphical editor's case, the save appears to succeed but it is unclear what the side effects are.

There are multiple problems demonstrated by the test case. The first error can be resolved by making EMV2AnnexUnparser public. Once that is done, other exceptions will be thrown. The latter exceptions only occur if there are more than one EMV2 subclause in the package.

Interestingly, the test does not fail even though many exceptions are thrown. I believe this is due to the exception being thrown in another thread. I am unaware of a mechanism to test for such errors.

Steps to Reproduce

  1. Run the test case below.

Test Case

package org.osate.core.tests.issues

import com.google.inject.Inject
import com.itemis.xtext.testing.XtextTest
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.junit.Test
import org.junit.runner.RunWith
import org.osate.aadl2.AadlPackage
import org.osate.testsupport.TestHelper

import org.eclipse.xtext.resource.SaveOptions
import com.google.common.io.ByteStreams
import org.osate.testsupport.Aadl2UiInjectorProvider

@RunWith(XtextRunner)
@InjectWith(Aadl2UiInjectorProvider)
class Issue_NEW extends XtextTest {

	@Inject
	TestHelper<AadlPackage> testHelper;
	
	@Test
	def void issueNew() {
		val pkg = testHelper.parseString(aadlText)

		pkg.eResource().save(ByteStreams.nullOutputStream, SaveOptions.newBuilder().format().getOptions().toOptionsMap());
		 
	}
	
	val aadlText = '''
		package issue_new
		public
			system top
				annex EMV2 {**
				**};
			end top;
		
			system top2
				annex EMV2 {**
				**};
			end top2;
		end issue_new;
	'''
}

Environment

  • OSATE Version: Develop
  • Operating System: Windows 10
  • Java Version: 1.8.0_141
@lwrage
Copy link
Contributor

@lwrage lwrage commented Jun 16, 2018

Tests involving annexes must use Aad2UiInjectorProvider.

@philip-alldredge
Copy link
Collaborator Author

@philip-alldredge philip-alldredge commented Jun 16, 2018

Okay. Good to know. This issue was originally seen in the graphical editor. The test was just written to make it easier to reproduce.

@philip-alldredge
Copy link
Collaborator Author

@philip-alldredge philip-alldredge commented Jun 19, 2018

I have updated the issue to use Aadl2UiInjectorProvider in the test case. However, rerunning the test case while using Aadl2UiInjectorProvider results in the same result.

@philip-alldredge
Copy link
Collaborator Author

@philip-alldredge philip-alldredge commented Jun 20, 2018

This can also occur when deleting classifiers in the graphical editor if the model contains EMV annex.

@lwrage
Copy link
Contributor

@lwrage lwrage commented Jun 25, 2018

This is also an issue in the use types step of the FHA workflow.

@lwrage lwrage self-assigned this Jun 25, 2018
@lwrage lwrage added in progress and removed next labels Jun 25, 2018
@lwrage
Copy link
Contributor

@lwrage lwrage commented Jun 25, 2018

The unparser must be public, other exceptions are from the emv2 formatter.

@ghost ghost added review and removed in progress labels Jun 25, 2018
@lwrage lwrage added this to the 2.3.4 milestone Jun 25, 2018
@ghost ghost removed the review label Jul 2, 2018
lwrage added a commit that referenced this issue Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.